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: |
Example: |
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) |
An |
An |
The format conversions are subject to the following limitations:
Alphanumeric fields are limited to 256 characters. Elementary fields that exceed 256 characters are truncated to 256 characters and have filler fields inserted to provide for the total length. Group fields that exceed 256 characters are commented.
Unsigned zoned fields that exclude a decimal point are described with a USAGE of packed (P) or alphanumeric (A), depending on the value entered for the Zoned Numeric Field Usage option on the Translator menu.
COMP-4 binary fields are described the same as COMP fields.
Binary fields that exceed 9 digits in the picture clause are described with ACTUAL format A8 and USAGE format A8.
The maximum length of the packed USAGE format depends on the software release that uses the generated Master File. For releases that support long packed fields (16 or more digits), the maximum ACTUAL length is 16 bytes and the maximum USAGE length is 31 digits (or 32 characters including a decimal point and sign). For earlier releases, the maximum ACTUAL length is 8 bytes and the maximum USAGE length is 15 total digits, including decimal and sign. The number of decimal places is limited to one fewer than the total USAGE length.
In general, the USAGE length of packed fields is calculated as the sum of the digits to the left of the decimal (n), the number of decimal positions (m), one for the leading minus sign if present (S), and one for the decimal (V) if present.
The ACTUAL and USAGE formats for GROUP fields are always alphanumeric (A). The ACTUAL length is the sum of the ACTUAL lengths of its components. The USAGE length is the sum of the following:
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.
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.
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.
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 |