I have created a COBOL copybook file. When i tried to execute the job, i’m getting below error:
Record number <3> in COBOL data file contains unknown value in the Record ID field
After analyzing the data file, found unknown values in the input file. Is it a way to handle any unknown values in the COBOL copybook like Oracle Case statement? Example: REC_TYPE=‘A’ then insert into table A, if REC_TYPE=‘B’ then insert into table B, else NO_ACTION.
In my experience, this message actually means that there is something wrong with the record prior to the one mentioned i.e. in this example, record 2.
Can you give us a bit more information about your data? What record type are you expecting in record 2 and what are you actually getting?
That’s my point. I don’t think you’ve got an unknown record type. I think you’ve got a previous record that’s either too long or too short for your copybook definition.
If you can’t put the actual data into the post can you anonymise it (keeping the same lengths) and put it here?
Data File:
Record Size: 0
Record Trailer Length: 1
Has Record Mark: [Unchecked]
Integer Format: Big endian
Code page: cp1252
Skip First: {none}
Read Total: {no limit}
Low Value: 0x40
Action: No conversion
High Value: 0xFF
Action: No conversion
No problem. I’ve had enough trouble with copybooks in my time so I like to try and help others who are also suffering.
I think your trailer length is incorrect. All the files that I’ve processed with copybooks needed a trailer length of 2. This is because the end of a line has a line feed and a carriage return control character.
best is to open the source file in a hex editor. Then you can see the file byte by byte and will see if there is a \n char or a \r\n sequence or nothing.