Field Formatting

When formatting fields, apply the rules described in General Format Conversion Notes. Additional formatting information is provided in Zoned Numeric Field Usage and in Numeric Field Edit Options.

In this section:

General Format Conversion Notes

Zoned Numeric Field Usage

Numeric Field Edit Options

Example:

Zoned Numeric Field Usage

Numeric Field Edit Options

General Format Conversion Notes

Format conversion is the process of defining the ACTUAL and USAGE formats based on the COBOL format. The Translator performs the conversion as described in the following table:

COBOL Format

ACTUAL

USAGE

PICTURE X(n)
PICTURE 9(n)
PICTURE 9(n)
PICTURE S9(n)
PICTURE 9(n)V9(m)
PICTURE S9(n)V9(m)
PICTURE 9(n) COMP (1
£ n £ 4)
PICTURE 9(n) COMP (5
£ n £ 9)
PICTURE 9(n) COMP (n
> 9)
COMP-1
COMP-2
PICTURE 9(n) COMP-3
PICTURE S9(n) COMP-3
PICTURE 9(n)V9(m) COMP-3
PICTURE S9(n)V9(m) COMP-3

An
Zn (packed option)
An (alpha option)
Zn
Zn+m
Zn+m
I2
I4
A8
F4
D8
P(n+2/2)
P(n+2/2)
P(n+m+2/2)
P(n+m+2/2)

An
Pn (packed option)
An (alpha option)
Pn+1
Pn+m+1.m
Pn+m+2.m
I9
I9
A8
F8
D15
Pn
Pn+1
Pn+m+1.m
Pn+m+2.m

The format conversions are subject to the following limitations:


Top of page

Zoned Numeric Field Usage

A COBOL FD may describe alphanumeric characters as zoned decimal numeric data using the PICTURE 9(n) clause. This clause is commonly used for numeric string data on which no arithmetic operations is performed, such as phone numbers, identification numbers, and dates. The Translator allows you to describe these fields in packed numeric or alphanumeric USAGE format (enter the values P or A, respectively). The ACTUAL format is described as zoned (Z).

If you intend to use COBOL numeric display fields for summing or in mathematical operations, use the packed option. If you intend to use these elements for display only, use the alphanumeric option. Only simple numeric display elements of the format PICTURE 9(n) are subject to this feature. Signed elements (PICTURE S9(n)) and elements with decimal positions (PICTURE 9(n)V(m)) are always described as packed.


Top of page

Example: Zoned Numeric Field Usage

Consider the following COBOL input description:

01 EMPL-REC.                                                     
02 EMPL-SOC-SEC-NUM PIC 9(8).
02 EMPL-HIRE-DATE.
03 EMPL-HIRE-YEAR PIC 9(2).
03 EMPL-HIRE-MONTH PIC 9(2).
03 EMPL-HIRE-DAY PIC 9(2).
02 EMPL-SICK-DAYS-ALLOWED PIC S9(2).
02 EMPL-SICK-DAYS-TAKEN PIC 9(2).
02 EMPL-YTD-HOURS-WORKED PIC 9(4)V9(2).

The Translator can generate the following two Master Files from this input, depending on the value entered for Zoned Numeric Field Usage.

For a value of P:

FILE=ZONEDP,                       SUFFIX=FIX,                      $
SEGNAME=RECSEG, SEGTYPE=S0, $
GROUP=REC, ALIAS=E01, USAGE=A56, ACTUAL=A24, $
FIELD=SOCSECNUM, ALIAS=E02, USAGE=P8, ACTUAL=Z8, $
GROUP=HIREDATE, ALIAS=E03, USAGE=A24, ACTUAL=A6, $
FIELD=HIREYEAR, ALIAS=E04, USAGE=P2, ACTUAL=Z2, $
FIELD=HIREMONTH, ALIAS=E05, USAGE=P2, ACTUAL=Z2, $
FIELD=HIREDAY, ALIAS=E06, USAGE=P2, ACTUAL=Z2, $
FIELD=SICKDAYSALLO, ALIAS=E07, USAGE=P3, ACTUAL=Z2, $
FIELD=SICKDAYSTAKE, ALIAS=E08, USAGE=P2, ACTUAL=Z2, $
FIELD=YTDHOURSWORK, ALIAS=E09, USAGE=P7.2, ACTUAL=Z6, $

For a value of A:

FILE=ZONEDA,                       SUFFIX=FIX,                      $
SEGNAME=RECSEG, SEGTYPE=S0, $
GROUP=REC, ALIAS=E01, USAGE=A32, ACTUAL=A24, $
FIELD=SOCSECNUM, ALIAS=E02, USAGE=A8, ACTUAL=Z8, $
GROUP=HIREDATE, ALIAS=E03, USAGE=A6, ACTUAL=A6, $
FIELD=HIREYEAR, ALIAS=E04, USAGE=A2, ACTUAL=Z2, $
FIELD=HIREMONTH, ALIAS=E05, USAGE=A2, ACTUAL=Z2, $
FIELD=HIREDAY, ALIAS=E06, USAGE=A2, ACTUAL=Z2, $
FIELD=SICKDAYSALLO, ALIAS=E07, USAGE=P3, ACTUAL=Z2, $
FIELD=SICKDAYSTAKE, ALIAS=E08, USAGE=A2, ACTUAL=Z2, $
FIELD=YTDHOURSWORK, ALIAS=E09, USAGE=P7.2, ACTUAL=Z6, $

The two generated Master Files contains zoned decimal fields that are truly used in numeric and alphanumeric formats, but the Translator cannot distinguish between the two cases. You must select the option most appropriate to your situation. You may edit the resulting Master File to change the formats to packed or alphanumeric as necessary. The USAGE length of any GROUP fields that contain these zoned fields must also be changed, according to the format conversion rules in General Format Conversion Notes.


Top of page

Numeric Field Edit Options

The Translator automatically adds any edit options that you supply to all numeric fields in the generated Master File. Edit options affect how the numeric data is displayed. The options are as follows:

S - Suppresses printing of the digit zero for a field whose value is zero.

C - Includes commas where appropriate, for example, 1,234.

B - Brackets negative values, for example, (1234).

R - Credits negative values, for example, 1234 CR.

M- Displays a floating dollar sign with commas, for example, $1,234.

N - Displays a fixed dollar sign with commas, for example, $ 1,234.

L - Displays leading zeroes, for example, 001234.

You may enter up to five edit options. You may leave this option blank to tell the Translator not to edit numeric fields. Edit options may be entered in any order and combination except for the pairs SL, MN, and BR, which are mutually exclusive.


Top of page

Example: Numeric Field Edit Options

Consider the following COBOL input description:

01  PAYROLL-REC.                                                  
05 PAYROLL-NAME.
10 PAYROLL-LAST-NAME PIC X(20).
10 PAYROLL-FIRST-NAME PIC X(10).
05 PAYROLL-AMT-FIELDS.
10 PAYROLL-AMT-CURR-YR PIC S9(7)V99 COMP-3.
10 PAYROLL-AMT-PREV-YR PIC S9(7)V99 COMP-3.

The Translator generates the following Master Files from this input when MB is entered for Numeric Field Edit Options:

FILE=EDITOPT,                      SUFFIX=FIX,                      $
SEGNAME=RECSEG, SEGTYPE=S0, $
GROUP=REC, ALIAS=E01, USAGE=A46, ACTUAL=A40, $
GROUP=NAME, ALIAS=E02, USAGE=A30, ACTUAL=A30, $
FIELD=LASTNAME, ALIAS=E03, USAGE=A20, ACTUAL=A20, $
FIELD=FIRSTNAME, ALIAS=E04, USAGE=A10, ACTUAL=A10, $
GROUP=AMTFIELDS, ALIAS=E05, USAGE=A16, ACTUAL=A10, $
FIELD=AMTCURRYR, ALIAS=E06, USAGE=P11.2MB, ACTUAL=P5, $
FIELD=AMTPREVYR, ALIAS=E07, USAGE=P11.2MB, ACTUAL=P5, $

Information Builders