How do we code a MOVE statement with variable length records in a VSAM file?
search cancel

How do we code a MOVE statement with variable length records in a VSAM file?

book

Article ID: 12339

calendar_today

Updated On:

Products

PanAudit Plus Easytrieve Report Generator PAN/SQL

Issue/Introduction



How do we code a MOVE statement with variable length records in a VSAM file?

Environment

CA Easytrieve Report Generator, release 11.6

Resolution

FILE VSAMFILE VS

  ..other field definitions... 
  DEFINE WS-WHOLE-REC     W   100  A (large enough for the longest record) 
  JOB ... 
  MOVE VSAMFILE  VSAMFILE:RECORD-LENGTH + 
  TO WS-WHOLE-REC 
  ...rest of program... 

The above code will ensure that the record length for that particular record is used for the move to the working storage field used for processing this data. Please add a WS-WHOLE-REC = ' ' before reading the next record.

To pad out the WS-WHOLE-REC field, please code:

  MOVE VSAMFILE  VSAMFILE:RECORD-LENGTH +                 
  TO WS-WHOLE-REC FILL '  '                               
  ...                                      

Additional Information

This will prevent the moving of data that is not part of the current record in a VSAM file.