Translate

Saturday, 16 April 2016

Definition of subscript

To define an item defined by an occurs clause, we use a subscript along with Array identifier to indicate which of the twenty-four fields we wish to access. For examples, the 24 fields with the Array defines behind are collectively called TEMP. Which is the identifier that can be used to access them in the PROCEDURE DIVISION. We would use the identifier temp along with subscripts that indicates which of the 24 fields we wish to access. The subscripts indicates the subscripts temp desired. Thus, to print the TWO-AM temp:
000000 PROCEDURE DIVISION,
___Move TEMP(2) to TEM-OUT.
WRITE PRINT-REC-OUT FROM OUT-REC.
*****************
THE USEs OF SUBSCRIPT:
1. There must be at least one space the identifier and the left parenthisis that precedes the subscript.
2. The subscript must be enclosed in parenthesis with no space within the parenthesis. e.g
ADD TEMP(20) TO TOTAL
ADD TEMP4(20) TO TOTAL
3. A subscript may be an integer or an identifier, which contains an integer value.
e.g
00000 WORK STORAGE
Post a Comment

Click for favourable contents