Processing Files With Sequential File Organization; Ascii File Processing; Creating A Sequential File; Reading From A Sequential File - IBM 5280 Programmer's Manual

Distributed data system, cobol
Hide thumbs Also See for 5280:
Table of Contents

Advertisement

SEQUENTIAL Organization
Processing Files with Sequential File Organization
ASCII File Processing
Creating a Sequential File
The table in figure 5.4 summarizes the COBOL statements used for reading,
writing and updating a sequential file.
Division
Reading
Writing
Updating
SELECT
SELECT
SELECT
ASSIGN
ASSIGN
ASSIGN
Environment
FILE STATUS
FILE STATUS
FILE STATUS
Division
ACCESS IS
ACCESS IS
ACCESS IS
SEQUENTIAL
SEQUENTIAL
SEQUENTIAL
OPEN INPUT
OPEN OUTPUT
OPEN 1-0
Procedure
OPEN 1-0
OPEN EXTEND
READ
Division
READ
WRITE
REWRITE
CLOSE
CLOSE
CLOSE
Figure 5.4. Statements used with sequential file organizations
You can process ASCII-encoded files with a sequential organization by
specifying the CODE-SET clause in the file description entry (FD entry).
The rules for coding the CODE-SET clause are given in in the 5280 COBOL
Language Reference.
If ASCII files are to be processed, your 5280 system must have included
ASCII support when it was installed.
The following guidelines apply in creating a file with a sequential
organiza tion:
1. Use WRITEs to create a sequential file.
2. Specify OUTPUT mode in the corresponding OPEN. Otherwise, a logic
error will occur, setting the Status Key to 92.
After the OPEN OUTPUT, any data formerly present in the file is no
longer accessible.
3. If the end of the extent is reached on a diskette file, a boundary error
occurs, setting the Status Key to 34.
See "COBOL Requirements for Data Sets" in Chapter 8 for the rules that
apply when allocating data sets for your program.
Reading from a Sequential File
The following guidelines apply in reading records from a file with a sequential
organiza tion:
1. Use the READ verb to access the records.
2. INPUT or 1-0 mode must be specified in the corresponding OPEN.
Otherwise, a logic error will occur, setting the Status Key to 92.
3. The records are read in the order in which they appear on the file. When
the end of file is reached, the Status Key is set to 10. If the file does not
Chapter 5. Diskette Input/Output
5- II

Advertisement

Table of Contents
loading

Table of Contents