COBOL Copybook and linefeed characters

I’m extracting data from a file with variable width records (i.e. Header, detail and Trailer records). I’ve done this may times previously using the COBOL copybook format.
The new challenge is that I have a new data file which contains an embedded linefeed character along with the normal carriage return at the end of each line. The copybook is having trouble handling this and results in twice as many rows as expected - every second line is completely blank.
I’ve tried modifying the copybook definition of ‘Record Trailer Length’ which hasn’t helped. I’ve also tried defining the copybook to ignore the last column in the file which also hasn’t helped.

Has anyone else managed to get round this issue?

I’m trying to get the upstream system to stop including the linefeed, but I’d like to see if copybooks can cope with ‘unhelpful’ input data.


Nemesis :australia: (BOB member since 2004-06-09)

Copybook should work, it is a fixed width format. It does not care about delimiters. Are there some settings in DS to define the row delimiter? Can you disable it there?


Werner Daehn :de: (BOB member since 2004-12-17)

Well, I seem to have got round the problem by using the ‘Record Size’ parameter on the ‘Data File’ tab to specify the exact record width and set the ‘Record Trailer Length’ to 0. This stops Data Services from adding the blank lines.
Thanks for your thoughts Werner as they encouraged me to have another go at solving the issue.


Nemesis :australia: (BOB member since 2004-06-09)

Of course! Excellent you found it!


Werner Daehn :de: (BOB member since 2004-12-17)