Example; Figure 5.5. Example Of Processing Files With A Sequential Organization - IBM 5280 Programmer's Manual

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

Advertisement

Example
SeQUENTIAL Organization
ensure that the first volume is mounted and will prompt the operator to
mount the first volume if it is not.
If end-of-volume is recognized during execution of a READ statement,
and logical end-of-file has not been reached, the following actions are
taken:
1. The next volume is requested.
2. After the volume is mounted, the first data record on it is made
available.
If sequence checking is being performed, as indicated by a nonblank
sequence number field in the first volume, then COBOL will ensure that
all subsequent volumes are mounted in their proper order. The operator
will be prompted to mount the correct volume if one is mounted out of
order.
The program example in figure 5.5 updates
I-O-FILE.
It reads
INPUT-FILE
and the
I-O-FILE
until a match is found between
INPUT-EMPLOYEE-NUMBER
and
I-O-EMPLOYEE-NUMBER.
It then
replaces the original record in
I-O-FILE
with
INPUT-RECORD.
IDENTIFICATION DIVISION.
PROGRAM-ID.
UPDATE-SEQUENTIAL.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER.
IBM-370.
OBJECT-COMPUTER.
IBM-5280.
SPECIAL-NAMES.
CONSOLE IS SCREEN.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE
ASSIGN TO DISK.
SELECT I-O-FILE
ASSIGN TO DISK
FILE STATUS IS SK.
DATA DIVISION.
FILE SECTION.
FD
INPUT-FILE LABEL RECORD STANDARD.
01
INPUT-RECORD.
FD
01
05
INPUT-EMPLOYEE-NUMBER
05
INPUT-EMPLOYEE-NAME
05
INPUT-EMPLOYEE-CODE
05
INPUT-EMPLOYEE-SALARY
05
FILLER
I-O-FILE
LABEL RECORDS
I-O-RECORD.
PICTURE
PICTURE
PICTURE
PICTURE
PICTURE
STANDARD.
9 (6) .
X(28) .
9.
9(6)V99.
X.
05
I-O-EMPLOYEE-NUMBER
05
I-O-EMPLOYEE-NAME
05
I-O-EMPLOYEE-CODE
05
I-O-EMPLOYEE-SALARY
05
FILLER
PICTURE 9(6).
PICTURE X(28).
WORKING-STORAGE SECTION.
01
DISP-RECORD.
05
OP-NAME
PICTURE
05
FILLER
PICTURE
05
SK
PICTURE
PICTURE
9.
PICTURE 9(6)V99.
PICTURE X.
X( 5).
XX VALUE SPACE.
XX VALUE
"zz".
Figure 5.5. Example of processing files with a sequential organization (Part 1 of 2)
Chapter 5. Diskette Input/Output
5~
13

Advertisement

Table of Contents
loading

Table of Contents