Reading VSAM file in Easytrieve

Declaring VSAM:

 FILE FILE2 VS

Reading VSAM file by Key

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 LIST ON
 FILE FILE1 FB(80 200)
   IN-REC 1 80 A
   IN-KEY 1 8 A
 FILE FILE2 VS
   F2-REC 1 80 A
   F2-KEY 1 8 A
   F2-VALUE 15 30 A
 FILE OUTFILE FB(80 200)
   OUT-REC 1 80 A
   OUT-KEY 1 8 A
   OUT-VALUE 10 30 A
 JOB INPUT NULL
 GET FILE1
 DO WHILE NOT EOF FILE1
   READ FILE2 KEY IN-KEY STATUS
   IF FILE2 : FILE-STATUS EQ 0
      MOVE IN-KEY TO OUT-KEY
      MOVE F2-VALUE TO OUT-VALUE
      PUT OUTFILE
   ELSE
      DISPLAY IN-KEY ' NOT PRESENT IN VSAM FILE'
   END-IF
   GET INFILE
 END-DO
 STOP

2 thoughts on “Reading VSAM file in Easytrieve”

  1. How to read VSAM KSDS file using alternate key? What all the things we need to define and use in easytrieve program.

  2. Hi Karthik,

    Can you please answer the above query…evn I am also facing the same challenge…I need to read a VSAM file with its alternate key…..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.