Previous Topic: About Work Fields ParametersNext Topic: Implied Subscript Parameters


Work Field Parameters

Purpose

Define work fields for use during report and SELECT/BYPASS processing.

Syntax

      Col
      2
      ▼
►►─┬─ nn ─┬─┬┬─ 0 ─┬┬─────────────────────────────────────────────────────────►
   └─ GW ─┘ │└─ W ─┘│
            └── 1 -─┘

   ┌────────────────────────────────────────────────────────────────────────┐
 ►─▼─ field-name ─┬─────────────┬─┬─────────────────────┬─┬───────────────┬─┴─►◄
                  └ .occurrence ┘ └ DP = decimal-places ┘ └ initial-value ┘

Syntax Rules

nn

Identifies the report with which the work field is associated. It is a 2-digit number in the range 00 through 99 and must be coded starting in column 2.

GW

Identifies a global work field that is available to all reports in the run. GW must be coded starting in column 2.

The value of a global work field passed to a report depends on whether the field value is altered by the type 7 or type 8 procedure logic in the previous report. The value is determined as follows:

The following table illustrates how the value of a global work field can change from report to report in a CA Culprit run. Global work fields are commonly used as a constant value accessed by more than one report in a run. Variable global work fields are commonly used to accumulate totals for an entire CA Culprit run; for example, all records processed for all reports can be counted.

Global Work Field Processing

Logic

Process Statement

Buffer Number

Global Value

7

 

 

0

7

017 GLOBAL + 1 GLOBAL

1

1

 

027 GLOBAL TIMES 3 GLOBAL

1

3

 

017 GLOBAL + 1 GLOBAL

2

4

 

027 GLOBAL TIMES 3 GLOBAL

2

12

8

018 GLOBAL DIVIDE 6 GLOBAL

 

2

 

028 GLOBAL MINUS 2 GLOBAL

 

0

Note: This table illustrates the value of a global work field during type 7 and type 8 procedure logic; the only control break occurs at the end of the output phase. In this example, two input buffers are processed in reports 01 and 02. The global work field is type 0 (GW0) and is initialized to 0.

0

Specifies that the value of the work field is initialized only at the start of the extract phase. The value of the work field at the start of the output phase depends on whether the field is defined as numeric or alphanumeric, and whether the field is referenced on a SORT parameter, a type 5 edit parameter, or both.

Must be coded in column 4.

1

Specifies that the value of the work field is initialized at the start of the extract phase and also at the start of the output phase under the following circumstances:

In all other cases, the value of a type 1 work field at the start of the output phase is the same as the value of a type 0 work field.

Must be coded in column 4.

field-name

A 1- to 32-character name that identifies the work field. It can be coded in any column after 4. The name can consist of letters, numbers, or hyphens. The following rules apply to specifying field-name:

occurrence

The number of occurrences of the work field. It is specified only if the work field occurs more than once. Occurrence can be any number in the range 0 through 32767; if specified, occurrence must be separated from field-name by a period (.).

In the extract phase, the subscript always acts as a pointer to a particular occurrence of a multiply-occurring field. In the output phase, the subscript is considered part of the field name if the work field is specified on a SORT or type 5 edit parameter; otherwise, the subscript is interpreted as a pointer to an occurrence of work field values.

A value of zero for occurrence has a special meaning when it is associated with an alphanumeric work field (see initial-value below). A subscript of zero indicates that the work field redefines the storage area that immediately follows it.

The work field definitions in the redefined area must be coded so they occur immediately after the zero-subscripted work field when CA Culprit completes the parameter sort phase of processing. The work field parameters are sorted first by work field type (0 or 1), then by data type (alphanumeric or numeric), then by field size if the field is numeric (8-byte or 16-byte), and then by field name before processing begins.

The subscript value of a zero-subscripted work field referenced on a SELECT/BYPASS, SORT, edit, or process parameter must be a positive integer, for example, WORK-FIELD.2. The subscript value multiplied by the length of a single occurrence of the zero-subscripted work field should not exceed the length of the redefined area. The subscript value can be tested in procedure logic.

Note: For more information on zero-subscripting, see the CA Culprit for CA IDMS User Guide.

DP = decimal-places

Specifies the number of digits to the right of the decimal point in a numeric work field. This value must be in the range 0 through 31. If DP=decimal-places is not coded and the initial work field value does not specify decimal places (see initial-value below), the work field is treated as an integer in all calculations used in selection logic, procedure logic, or automatic totaling.

When DP= is specified, the number of digits to the right of the decimal point in the initial value of any singly- or multiply-occurring work field must not exceed the number coded for decimal-places. Rules regarding the position of a decimal point when printing a work field appear in Output Definition Parameters.

Note: When the PROFILE parameter option RELEASE=5 is specified and DP= is not specified, the default is 2.

initial-value

This is the value associated with the named work field when the field is established and, in the case of type 1 work field parameters, when the field is reinitialized at the start of the output phase.

If initial-value is not specified, an initial value of 0 is assigned to the work field. If the work field occurs multiple times, an initial value can be specified once for each occurrence. The first value applies to the first occurrence, the second value applies to the second occurrence, and so forth. If fewer values than occurrences are specified, the remaining occurrences are set to the last initial value specified.

Initial-value implicitly describes the field length and data type for alphanumeric, hexadecimal, and numeric values, as follows:

The number of decimal places in a multiply-occurring work field is determined by the DP= specification, if coded, or by the number of decimal positions specified in the first initial value. If the number of decimal positions in subsequent initial values exceeds the number specified for the first value, an E-level error results.

Examples

Sample work field parameters are shown and described below.

Example 1

010  COUNTER 1
0151*000 COUNTER
0161*010 COUNTER

Report 01 contains a numeric work field COUNTER that is initialized to 1 at the start of the extract phase. The parameter type (0) indicates that COUNTER is not reinitialized at the start of the output phase. If COUNTER were a type 1 work field that was not referenced on a SORT parameter or on a type 5 edit parameter, the value of COUNTER would be reset to one at the start of the output phase.

In this example, COUNTER is referenced as a nonprinted output field on a type 5 edit parameter. The total value of COUNTER is output on a total line.

Example 2

351  MESSAGE-AREA  '               '

MESSAGE-AREA is a 15-character alphanumeric work field; the length is determined by counting the number of spaces between the quotation marks.

This work field can be used to display unique messages by moving literals into the work field in procedure logic and referencing the work field on an edit parameter. At the start of the output phase, MESSAGE-AREA is reinitialized to blanks if the field is not a sort-key value; otherwise, MESSAGE-AREA contains the value of the sort key at the control break.

Example 3

240  COUNT LITERAL.3,'A','B','C' FIELDC 'XXX',TRIGGER.2 DP=2 0 1

The following work fields are established in this example:

Example 4

GW0  TABLE.20  DP=4

TABLE contains 20 occurrences, each initialized to 0.0000. Each occurrence of TABLE is a 16-byte packed signed decimal. CA Culprit reserves 320 bytes of storage to accommodate this field. Values for each of these fields can be set and referenced by any report in the CA Culprit run; for example, the seventh occurrence can be referenced as TABLE.7 (or, for example, TABLE.COUNT where COUNT is assigned a value of 7) on SELECT/BYPASS, SORT, edit, and process parameters defined for all reports.

Example 5

150  HEX.16  X'0A'  X'0A'  X'1E'  X'14'  X'14'  X'00'

Report 15 contains 16 hexadecimal literals in the work field HEX. The first six occurrences of HEX are explicitly initialized. The remaining 10 occurrences are initialized to X'00', which is the value of the last occurrence specified.

Hexadecimal fields are treated as though they were alphanumeric, so no arithmetic manipulations can be performed on this work field. The hexadecimal work fields are stored internally as two hexadecimal digits for each byte; therefore, each occurrence of HEX uses one byte of storage.

Example 6

270  ALPHA.10  'ONE    ' 'FIVE' 'TEN' 'ELEVEN' 'THIRT''N' ' '

This report contains ten 7-character alphanumeric work fields; the first initial value establishes the length of all ten occurrences. The first six occurrences are initialized as shown; the last four occurrences are set to spaces, which is the value of the last literal specified. To express an apostrophe in the fifth value, two consecutive single quotation marks are coded; these are stored as a single quotation mark.

Example 7

020  POINT.5   DP=3  3.6  -9.141   5.000

POINT contains five occurrences, each containing three decimal positions. The following initial values are assigned: 3.600, -9.141, 5.000, 5.000, and 5.000. Each occurrence in POINT is a 16-byte packed signed decimal; 80 bytes of storage are required to accommodate this field.

Example 8

010  AMT.5   SUBS
0151*010 AMT.SUBS
0161*010 AMT.SUBS
0161*020 AMT.3

During the extract phase, every occurrence of AMT.SUBS is extracted, as indicated by the current value of SUBS. During the output phase, every extracted value of AMT.SUBS is summed, regardless of the value of SUBS during the extract phase. SUBS is the name of a total field during the output phase and no longer has a unique value as a subscript.

The value of AMT.3 during the output phase is the current value of the third occurrence of the work field, provided AMT.3 is not specified on a SORT parameter or on a type 5 edit parameter.

Example 9

REC START-YEAR  70  2    'START YEAR'
REC START-MONTH 72  2    'START-MONTH'

140 START-DATE-0.0'     '       $START-DATE IS 5 BYTES LONG
140 START-DATE-1  '  '          $MONTH
140 START-DATE-2  '/'
140 START-DATE-3  '  '          $YEAR

147010 MOVE START-YEAR TO START-DATE-3
147010 MOVE START-MONTH TO START-DATE-1
1451*010  START-DATE-0.1        $PRINT MM/YY

START-DATE-0.0 defines a zero-subscripted alphanumeric work field and redefines the storage area that immediately follows with 5-byte occurrences. The work fields in the redefined area are coded in alphabetical order (that is, -1, -2, and -3) so that the fields sort immediately after START-DATE-0 in the parameter sort phase of CA Culprit processing.

CA Culprit reads values for START-YEAR and START-MONTH from the input file and moves the values to the redefined work field storage area. The date in mm/yy format, is output each time the type 5 edit parameter is processed. START-DATE-0.1 specifies the first occurrence of 5 bytes in the redefined work field area; that is, the 5 bytes that start with START-DATE-1.

Example 10

020 DATE-A.0 '  '           $DATE-A IS 2 BYTES LONG
020 DATE-B   'MMYY'
0251  10 DATE-A.2           $PRINT YY
0251  12 '/'                $PRINT /
0251  13 DATE-A.1           $PRINT MM

Work field DATE-A.0 is initialized to 2 blanks. DATE-B is initialized to a 4-byte literal value. The type 5 edit parameters are coded so that the second occurrence of 2 bytes in DATE-B (YY) prints before the first occurrence of 2 bytes (MM). The output field will appear as YY/MM.

More information:

Process Parameters

Introduction

Output Phase Field References

Release 5 and 6 Default Actions