The reason for your S0C7 is that your source field does not contain valid packed-decimal data.
The three most likely causes are:
- You have multiple record-types on the file, and the current record is not the one for the layout you are using
- You are accessing an OCCURS which is not used on that record (you have a count, what is the value of that?)
- The data on the file is plain incorrect
I've listed those in order of likeliness, given that you get the abend with entry ( 1 ).
A packed-decimal field does not need to be an odd-number of digits. When it is an even-number of digits, the compiler generates code to ensure that the left-most half-byte is always zero.
Often you will find packed-decimal fields which logically should contain an even-number of digits having an odd-number of digits, to avoid the generation of that extra code.