Easytrieve Guide for Mainframe Programmers (4 of 20)

ID-100309057

Read previous post-3 on Easytrieve.

DECIMAL POSITIONS

For numeric data items, you can indicate the number of decimal places  (0 – 18)      by adding the appropriate numeric value AFTER the data format value.

The use of the DECIMAL indicator also informs EZT+ that this data item will be QUANTIFIED.  This tells the EZT+ job that the accumulated value for the designated data item will be automatically maintained and printed by EZT+ at programmer defined control breaks.  More will be said regarding this in the REPORT ACTIVITY section on control breaks.

The use of the DECIMAL indicator also guarantees that a sign will be generated   for NEGATIVE values.

The addition of the numeric entry AFTER the definition of the PAY-NET field accomplishes several things for the EZT+ programmer . . . . . . .

*      it defines the PAY-NET field as having two (2) decimal fields

*      it makes the data item QUANTITATIVE

*      it will insure that a sign will be generated when it is appropriate

FILE  file-name

NAME                     17        33        A

ADDRESS              37        33        A

PAY-NET                90          4        P  2

SAMPLE OF A FIELD DEFINITION

A typical field definition looks like this:

GROSS – PAY           94        4          P          2

.                     .          .           .           .

field name . . . . . .  . .  .                     .          .           .           .

.          .           .           .

starting location . . . . . . . . . . . .  . .  .           .           .           .

.           .           .

field length . . . . . . . . . . . . . . . . . . . .  . . .  .             .           .

.           .

type (packed decimal) . . . . . . . . . . . . . . . . . . . . . .  .

.

number of decimals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

REDEFINITION OF A FIELD NAME

Redefinition can occur in a FILE entry or in the Working Storage section of your EZT+ program.

Explicit redefinition is done within the FILE ENTRY of the FIELD NAME definition

            • >    FILE ENTRY

DATE-OF-BIRTH              103      6          N

MONTH                     103      2          N

DAY                           105      2          N

YEAR                         107      2          N

 

The redefinition in the FILE ENTRY is similar to the IMPLIED redefinition in a COBOL program’s FILE SECTION entry. Since the DATE-OF-BIRTH entry has a specific starting location (103), the REDEFINED fields will be coded AFTER the original entry and will use the same storage locations as the original.

          • ->     WORKING STORAGE

 

W-HOLD-STA                       W        8          N

STATE W-HOLD-STA                      2          N

TERR W-HOLD-STA            +2        2          N

AGENCY W-HOLD-STA     +2        4          N

With a Working-Storage item there is NO specific starting location. Therefore, you use RELATIVE starting locations as well as QUALIFIED data names to redefine the Working Storage entry.

 

*          When QUALIFYING the redefined data item you simply add the name of the object of the redefine AFTER the redefined entry.

*          The first redefined entry has NO relative starting location and the EZT+ program assumes that it will start at the beginning of the Working Storage item it is redefining.

*          Subsequent redefined entries have RELATIVE starting locations which are the sum of ALL previous record lengths.

 EDIT MASK

*          An edit Mask is a pattern specifying how numeric data is to be printed.                  (Alphanumeric fields cannot have masks attached).

*          The edit MASK allows you to format dollar signs (or other currency signs),            asterisks, dashes, and parentheses, into your output.

*          An edit mask is created by using combinations of the following characters:

9      Formats digits.

Z     Suppresses leading zeroes.

*      Replaces leading zeroes with asterisk.

–      Prints a minus sign prior to first non-zero digit of a negative number.

$      Prints a currency symbol prior to the first non-zero digit.

*          Each digit in the field must be designated in the mask. This includes PACKED fields.  A data-item that is 9 (04) and packed will use a mask that contains seven             (7) characters because a four (4) byte packed data-item has seven (7) digits plus the sign field . . . .

For example:

Mask                           Field                Result

$$,$$9                         01234              $1,234

The edit MASK is part of your field definition.  All masks are defined as literals in single quotes.

Syntax rules for EDIT MASKS

*          The mask is part of the field definition

*          Continuation characters MUST be coded if the MASK is NOT coded on the same line as the field definition

*          Multiple parameters coded with the MASK must be enclosed in parentheses.

Mask Examples

GROSS-PAY             94        4          P     2  +

MASK          (G  BWZ  ‘$$,$$9.99-‘)

*      The above field definition uses the plus-sign (+) to continue because the                                  MASK is on the next line.

*      The mask parameters are enclosed in parentheses since there are MULTIPLE                          (3) parameters.

*      The mask value is enclosed in single quotes.

*      The character ‘G’ names the mask.  Subsequent data items may use the same mask by simply coding the edit mask as follows. . . . . . .

NET-PAY       98        4          P  2  +

MASK    (G)

NOTE:  Any ALPHABETIC character (excluding ‘Z’) can be used to name an edit mask

*      The BWZ is an optional parameter for BLANK WHEN ZERO which will                  zero suppress the whole field when the contents of the entire record are                      ZEROES.

*      The mask should contain the same number of characters as digits in the field-name.  The mask (defined above) has seven (7) characters in it due to the fact that there are seven (7) digits in a PACKED four-byte data item.

*      The negative sign at the end of the mask will print when the contents of the data item are NEGATIVE.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

Comments are closed.