Loading

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

Related Posts




blog comments powered by Disqus

There's 0 Comment So Far

Share your thoughts, leave a comment!