0% found this document useful (0 votes)
41 views6 pages

VSAM Unit5

This document discusses variable length records in COBOL and provides two examples of how to code for variable length files. It explains that the objective is for students to understand how to code for and work with variable length records as opposed to fixed length records. The first example shows defining three different record descriptions with varying lengths. The second example uses an OCCURS clause to define a repeating group for a bank record with variable size.

Uploaded by

Murali Mohan N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views6 pages

VSAM Unit5

This document discusses variable length records in COBOL and provides two examples of how to code for variable length files. It explains that the objective is for students to understand how to code for and work with variable length records as opposed to fixed length records. The first example shows defining three different record descriptions with varying lengths. The second example uses an OCCURS clause to define a repeating group for a bank record with variable size.

Uploaded by

Murali Mohan N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like