Update / RE WRITE VSAM file in Easytrieve

Updating/ REWRITING a VSAM record:
VSAM declaration should look like,

 FILE FILE2 VS UPDATE

FILE2 is the DD name – must have DISP=OLD

Reading VSAM file by Key and updating the record

----+----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 UPDATE
   F2-REC 1 18 A
   F2-KEY 1 8 A
   F2-VALUE 9 10 N
 JOB INPUT NULL
 GET FILE1
 DO WHILE NOT EOF FILE1
   READ FILE2 KEY IN-KEY STATUS
   IF FILE2 : FILE-STATUS EQ 0
      F2-VALUE = F2-VALUE + 5
      WRITE FILE2 UPDATE
   ELSE
      DISPLAY IN-KEY ' NOT PRESENT IN VSAM FILE'
   END-IF
   GET INFILE
 END-DO
 STOP
Advertisement

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 )

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.