Module 10: File processing
START statement
- START statement is used to position the file pointer at a specific record location within indexed or relative file for subsequent sequential record retrieval
- This statement can be used only for Indexed and Relative files which are opned either in INPUT or I-O mode.
- Access mode of file must be sequential or dynamic. It cannot be coded for Random access
- It establish the current location in the cluster for a READ NEXT statement.
- It does not retrieve record; It only sets the current record pointer
- Basic Syntax:-
START file-name [KEY IS {IS EQUL TO/ IS = / IS GREATER THAN / IS > / IS NOT LESS THAN / IS NOT < / IS GREATER THAN OR EQUAL TO / IS >= } key-data-name] [INVALID KEY imperative-statement-1] [NOT INVALID KEY imperative-statement-2] [END-START].
- Where,
- file-name is logical file name
- KEY IS used to position file pointer at logical record in file whose key field satisfy the comparison
- INVALID KEY imperative-statement-1 : This becomes true when record is not found for specified key and thus causes execution of imperative-statement-1
- NOT INVALID KEY imperative-statement-2: This is used to specify statements to be executed when START operation succeeds