© 2012 Mainframestechhelp.com
Mainframes Tech Help
Help for all Mainframe technical needs
Its our planet.. Go Green
For any Queries/Suggestions/Issues, Send a mail to Support@mainframestechhelp.com
Next
COBOL Tutorial Conti...
In the previous syntax, OPEN-MODE is very important. Based on the usage of files, below four modes are defined on files. 1. INPUT : Files can be used for READ only. 2. OUTPUT : Files can be used for WRITE only. 3. I-O : Files can be used for READ/WRITE/RE-WRITE. 4. EXTEND : Files can be used for adding the records to the file which has some data already in WRITE mode. This mode is used only in sequential files to append the records. ( add more records to the existing records without deletion of previous records) Note: EXTEND mode cannot be used when input file is empty. 3.Processing a File:  Processing of a file is nothing but performing any operations like READ/WRITE/REWRITE etc other than OPEN and CLOSE. Lets discuss the processing statements one by one. READ: The main purpose of the READ statement is that to read the records from the file. Syntax: READ File-name [INTO File-rec] [KEY IS File-key] [AT END Statements] [INVALID KEY Statements] [NOT AT END Statements] [NOT INVALID KEY Statements] END-READ. INTO Clause is used to store the retrieved record into the File-rec which is provided in the READ. INTO Clause is used for Fixed length record mostly and it is not preferred to use it for variable length records because of the length not known. KEY Clause is used to access the records randomly by passing the key before READ. KEY Clause used for only Indexed files concept. AT END and NOT AT END is used for Sequential files reading to verify the END OF the FILE reached or not. INVALID KEY and NOT INVALID KEY is used to validate the passed key is valid or not when the file is reading randomly. This option is available for other than indexed files. READ syntax will differ for sequential, Indexed/Relative files.
If any questions on the above, post your queries on Cobol Discussion forum
Previous Home Forums Tutorials Tools About Us Contact us Login Interview questions