Manish Agrawal
Manish Agrawal

Reputation: 147

Reading a variable length record mainframe file

I have a mainframe data file in binary format, with variable records. No copybook works in this case, nor do I know end of line. How do I read such a file?

Upvotes: 0

Views: 1958

Answers (1)

dstaudacher
dstaudacher

Reputation: 556

Assuming you're reading this file in a COBOL program running on the Mainframe, this is really no problem. COBOL doesn't write null-delimited output. It writes variable length records with the length embedded in the first two bytes of 4-byte prefix area called a (R)ecord (D)escriptor (W)ord, which is NOT included in the record layout copybook. To read such a record back into another COBOL, you just need a properly coded copybook.

Upvotes: 1

Related Questions