COBOL Copybook Record Length

Hello,

I’m currently trying to import a COBOL Copybook, and am having some issues with record length.

In my copybook, I have several schemas defined, each with their own length. In my flat file, each record is padded with spaces to have a length of 6000, regardless of whether or not the record’s schema specifies this as the record’s total length. When I specify “Record Size” as 6000 in the COBOL Copybook “Data File” tab, the first record is read, but I am given the following error:

Record number <2> in COBOL data file contains unknown value in the Record ID field

I’m assuming that this is happening because Data Integrator is unable to find the beginning of my next record or is running into characters that it should be skipping.

I have varied “Record Trailer Length” to try and potentially accommodate for new line characters, but I continue to get this error. Any ideas? Am I assuming that “Record Size” does something that it doesn’t? Thanks!


ampp33 (BOB member since 2010-11-03)

The Record Size parameter make sure that each row is treated as exactly 6000 chars. Imagine you have a record with 5000 chars, the remaining 1000 chars should have been defined as filler. Instead you can use the rescord size setting.
For multi-record files it does not make sense obviously.

https://wiki.sdn.sap.com/wiki/display/BOBJ/Multirecord+Files

If you need help, post an example of the file and the copy book used, I’ll try to find the time.


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

The ‘Record Trailer Length’ value should usually be 2 for a line feed and a carriage return character. So in your example, ‘Record Size’ should be 6000 and ‘Record Trailer Length’ should usually be 2.
Do you know if your input file has additional control characters? I have recently come across a file that had an extra carriage return which caused the file to be interpreted as containing blank rows. Viewing the file in Notepad failed to show the additional carriage return so I used a tool called Textpad which displayed the file as it would be ‘seen’ by DataServices.


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

Thank you for your responses!

@wdaehn
My flat file is multi-record, and each record is padded such that each record has a length of 6000 characters.

In the event that I had a record with 5000 chars, and the remaining 1000 chars should be defined as filler (defined as filler in the copybook, but aren’t in my case), I would set the Record Size to 6000, correct? Would this be the same if the file was a multi-record file?

@Nemesis
Having a ‘Record Size’ of 6000 and a ‘Record Trailer Length’ of 2 was my first attempt, but to no avail. I have been given two versions of the flat file, one with each record being less than or equal to the length specified by its copybook, and one where each record was padded to 6000 characters. I can correctly parse the non-padded flat file using a ‘Record Trailer Length’ of 0, so I don’t think that trailing characters will be the case in the padded file…

I too use Textpad, and was able to see the carriage return, but no additional characters. I’ll keep playing with this and see what I can figure out.

Attached is a situation very similar to mine. I’ve supplied a copybook, a flat file, and a flat file where each record is padded to 60 characters.

Thank you for all your help!
PADDED_FLAT_FILE.TXT (0.0 KB)
FLAT_FILE.TXT (0.0 KB)
COPYBOOK.txt (1.0 KB)


ampp33 (BOB member since 2010-11-03)

Now I get it. You have a fixed width file where the trailing blanks are missing. Not sure if Cobol Copybooks support that at all.
In theory it could be, just look at the , if they are arriving early it means the rest of it is empty. But that’s not the concept of Cobol Copybooks, there you do not have row delimiters per definition. It all is one large stream of chars and you know define at what position the stream has to be split. You can have dynamic lengths, but then there is one field defining the length like “The next varchar shall be 100chars long” followed by 100 chars of text. But that’s about it.

A regular FileFormat (type fixed-width) does however, so you would have three file formats, each with ignore-row-markers for the other record types.


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