Sie sind auf Seite 1von 6

VSAM

TRANSPARENCIES
(Unit 5)

VSAM_Tr Ver. 1.0.0 04/12/1998

Page 172 of 177

Variable Length Records


Objective - Student will
Be able to code for using variable length
records in a COBOL program
Understand how variable length is
different from fixed length

VSAM_Tr Ver. 1.0.0 04/12/1998

Page 173 of 177

Variable Length Records (Contd..)


Variable vs. Fixed

VSAM_Tr Ver. 1.0.0 04/12/1998

Page 174 of 177

Variable Length Records (Contd..)


The 1st of Two Ways to Code for
Variable Length files in Cobol

FD VAR-FILE.
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 80 TO 320 CHARACTERS
DATA RECORDS ARE VAR-RECORD-1
VAR-RECORD-2
VAR-RECORD-3.
01 VAR-RECORD-1

PIC X(80).

01 VAR-RECORD-2

PIC X(150).

01 VAR-RECORD-3

PIC X(320).

VSAM_Tr Ver. 1.0.0 04/12/1998

Page 175 of 177

Variable Length Records (Contd..)


The 2nd of Two Ways to Code for
Variable Length files in Cobol

FD VAR-FILE.
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS0 RECORDS
RECORD CONTAINS 4 TO 504 CHARACTERS
DATA RECORD IS VAR-RECORD.
01

VAR-RECORD.
05 BANK-REGION

PIC 9(02)

05 NUM-BANKS

PIC 9(02).

05 BANK OCCURS 0 TO 10 TIMES DEPENDING ON NUMBANKS.


10 BANK-INFO

VSAM_Tr Ver. 1.0.0 04/12/1998

PIC X(50).

Page 176 of 177

Exercise 4
Use VSAM file and process
maintenance transactions for inserts,
updates and deletes

VSAM_Tr Ver. 1.0.0 04/12/1998

Page 177 of 177

Das könnte Ihnen auch gefallen