The START statement provides a method of setting the file position indicator for a relative or indexed file and provides a means of determining whether a record exists.
Note:The required relational characters >, < and = are not underlined to avoid confusion with other symbols.
file-name-1 must be the name of a relative or indexed file.
file-name-1 must be the name of a file with sequential or dynamic access.
data-name-1 or split-key-name-1 may be qualified.
split-key-name-1 and the SIZE phrase may be specified only for indexed files.
identifier-1 must refer to an elementary integer data item.
The INVALID KEY phrase must be specified if no applicable USE procedure is specified for file-name-1.
If file-name-1 is the name of a relative file, then data-name-1, if specified, must be the data item specified in the RELATIVE KEY phrase of the associated file control entry.
If file-name-1 is the name of an indexed file then data-name-1 , if specified, may reference any one of the data items specified as the record keys associated with file- name-1 or it may reference any data item of category alphanumeric whose leftmost character position corresponds to the leftmost character position of a record key data item and whose length is not greater than the length of that record key.
If ile-name-1 is the name of an indexed file, split-key-name-1, if specified, may refer to any one of the split keys specified as the record keys associated with file-name-1. file-name-1 must be open in the INPUT or I-O mode at the time the START statement is executed.
If the KEY phrase is not specified, the relational operator IS EQUAL TO is implied and, for an indexed file, the key of reference is the prime record key of the file.
The type of comparison specified by the relational operator in the KEY phrase of a START statement occurs between a key associated with a record in the file to which file-name-1 refers and a data item.
When FIRST or LAST are specified in the KEY phrase instead of a relational operator, no comparison takes place and the value of the relative key data item for a relative file or the value of the key of reference data item for an indexed file is not used in setting the file position indicator.
For a relative file the file position indicator is modified as follows:
For an indexed file, the file position indicator is modified as follows:
If there are no records currently existing in the file or if the comparison is not satisfied by any record currently existing in the file, an invalid key condition exists. The invalid key condition also exists if file-name-1 refers to an optional input file that is not present. When the invalid key condition exists, the execution of the START statement is unsuccessful, the file position indicator is set to indicate that no valid next record has been established, and, for indexed files, the key of reference becomes undefined.
The execution of the START statement causes the value of the file status data item associated with file-name-1, if there is one, to be updated. It does not alter either the contents of the record area or the contents of the data item referenced by the data-name specified in the DEPENDING ON phrase of the RECORD clause associated with file-name-1.
For indexed files, a key of reference is established as follows:
For indexed files, the key of reference is used to select the data item that participates in the key comparison described above, and it is used for subsequent sequential (Format 1) READ statements.
In single record locking modes, any record lock held by the run unit for file-name-1 is released upon execution of the START statement. The START statement does not obtain a record lock and does not indicate the lock status of the record that satisfies the comparison.
In multiple record locking modes, any record locks held by the run unit for file-name-1 are not released upon execution of the START statement.
The SIZE phrase modifies the length of the data item used in the comparison to a key associated with a record in the indexed file to which file-name-1 refers. Since there is no comparison to a data item for the FIRST and LAST options, the SIZE phrase has no effect when specified with those options. The SIZE phrase is not allowed if file-name-1 refers to a relative file.
When the SIZE phrase is omitted, the size of the data item specified in the KEY phrase, or the size of the prime record key for file-name-1 when the KEY phrase is omitted, is used as the size in the comparison described above.
When the SIZE phrase is present, integer-1 or the value of the data item to which identifier-1 refers is used as the size in the comparison described above.
integer-1 or the value of the data item to which identifier-1 refers must be greater than or equal to one and less than or equal to the length of the record key specified by the KEY phrase, if present, or the length of the prime record key for file-name-1, if the KEY phrase is omitted.
Note:Specification of the SIZE phrase overrides the size of a data item specified by data-name-1 when that data item is not a record key of the file.
INVALID KEY and NOT INVALID KEY Phrases
INVALID KEY imperative -statement-1
NOTINVALID KEY imperative -statement-2
The causes of the invalid key condition for the START statement are indicated in the preceding text. Transfer of control following the execution of the START operation depends on the presence or absence of the INVALID KEY and NOT INVALID KEY phrases. See the discussions of relative organization input-output and indexed organization input-output for additional information regarding the invalid key condition and the effect of the INVALID KEY phrases.
START Statement (Relative and Indexed I-O) Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.