P. 1
Cobol Tutorials-Mainframe230.Blogspot.com Full

Cobol Tutorials-Mainframe230.Blogspot.com Full

|Views: 7|Likes:
Published by Jaideep Dhiman

More info:

Published by: Jaideep Dhiman on Apr 20, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

04/28/2013

pdf

text

original

To handle a file the following operations are to done.
Step 1.

All files handled in a program should be assigned a logical name chosen by the programmer as per
the syntax similar to Cobol identifier. The organization of the file ,DDNAME assigned for the dataset
and its primary and alternate key, if any, have to be specified in the File-Control para of
Environment Division. This is specified using SELECT statement of File-Control para.

www.mainframe230.blogspot.com

Page 43

date:16.05.2010

COBOL Training

Step2.

Describe the File with detail like record name ,record structure in the File Section of DATA
DIVISION .Also specify as how many records are grouped as a BLOCK for Input Output Operation.

Step3.

All files described as explained above should be first opened to do read/write operations. Open
statement is used to connect dataset to the Cobol program. These statements are coded in
procedure division. Files can be opened for reading, writing, appending.

Step4.

If we have to read a file READ statement is used in procedure Division.
SYNTAX : Read File -name.
If we have to write in to a file WRITE command is used in procedure Division. The record attached to
the concerned file alone can be used to write into the file.
SYNTAX : WRITE Record -name.

Step5.

After read / write operations are over the file must be closed to disconnect the file from the Cobol

program.
SYNTAX : CLOSE File-name.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->