Thursday, 30 May 2013

Look ahead

Lookahead field(not an indicator).

                    Lookahead can be used only with a primary or secondary file.
The indicators specified in these positions are used in conjunction with the record identification codes (positions 21 through 41).

Positions 19 and 20 associate an indicator with the record type defined on this line. The normal entry is one of the indicators 01 to 99; however, the control level indicators L1 through L9 and LR can be used to cause certain total steps to be processed. If a control level indicator is specified, lower control level indicators are not set on. The halt indicators H1 through H9 can be used to stop processing. The return indicator (RT) is used to return to the calling program.
When a record is selected for processing and satisfies the conditions indicated by the record identification codes, the appropriate record identifying indicator is set on. This indicator can be used to condition calculation and output operations. Record identifying indicators can be set on or set off by the programmer. However, at the end of the cycle, all record identifying indicators are set off before another record is selected.

The entry of ** is used for the lookahead function. This function lets you look at information in the next record in a file. You can look not only at the file currently selected for processing but also at other files present but not selected during this cycle.
Field description lines must contain From and To entries in the record, a field name, and decimal positions if the field is numeric. Note that a lookahead field may not be specified as a field name or as a data structure name on Input Specifications or as a Result Field on Calculation Specifications.
Positions 15 and 16 must contain an alphabetic entry. The lookahead fields are defined in positions 53 through 58 of the lines following the line containing ** in positions 19 and 20. Positions 59 through 74 must be blank.
Any or all of the fields in a record can be defined as lookahead fields. This definition applies to all records in the file, regardless of their type. If a field is used both as a lookahead field and as a normal input field, it must be defined twice with different names.
The lookahead function can be specified only for primary and secondary files and can be specified only once for a file. It cannot be used for full procedural files (identified by an F in position 16 of the file description specifications), or with AND or OR lines.
When a record is being processed from a combined file or an update file, the data in the lookahead field is the same as the data in the record being processed, not the data in the next record.
The lookahead function causes information in the file information data structure to be updated with data pertaining to the lookahead record, not to the current primary record.
If an array element is specified as a lookahead field, the entire array is classified as a lookahead field.
Lookahead fields are filled with nines when all records in the file have been processed so that the end of the file can be recognized.

No comments:

Post a Comment