I want to read a variable length record file and write into another variable length record file.But before going to write into a target variable length record file i want to find the lengh of record which i am going to write is there any way to find it if so suggest me.(I know that the length of record will be stored in some register PSW but i am not sure about that)
where, x = the length of the smallest record possible in the file
y = the length of the largest record possible in the file
Remember that the LRECLs you use in your JCL must be 4 bytes greater than the "y" specified in the "RECORD VARYING" clauses of your COBOL pgm.
In WS code:
Code:
05 REC-LEN PIC 9(008) COMP.
When you read the I/P rec in your pgm the length of the rec you just read is put into REC-LEN: when you write the rec to your O/P file REC-LEN is used to determine how many bytes to write to O/P.
If you wanted to change the length of a rec just read you'd make the changes and recalculate the value of REC-LEN and repopulate it before you write the O/P rec.