The wrong length is returned when a line sequential file is read back in.
A program is attached that shows the problem. Using 1.1 CE and compiled as cobc -xW slb.cob.
The program opens a line sequential file output, writes variable length records and closes the file. At this point, opening the output file with an editor shows that the records are correct. Here is the file:
----+---10----+---20----+---30----+---40----+---50 ----+---10----+---20----+---30----+ ----+---10----+---20----+
Then, it opens the file input and reads the records, within the same run. All of the records return a length of 25. Here is a screen:
./slb slb * Show Length Bug A = Output records and read back in. B = Read records. Selection: a Write record length: 50 Write record length: 35 Write record length: 25 Read record length: 25 fail. Read record length: 25 fail. Read record length: 25 pass.
If the program does a goback, and is restarted, then the records read correctly. Here is the screen:
./slb slb * Show Length Bug A = Output records and read back in. B = Read records. Selection: b Read record length: 50 pass. Read record length: 35 pass. Read record length: 25 pass.
The error happens on any line sequential file that it reads back in, not just on the file it wrote out. So the path name could be changed in the open input, and it will still get the error.
The workaround is to write out all line sequential files with the maximum record size for all records.
Log in to post a comment.