Joined: 06 Jun 2008 Posts: 8231 Location: Dubuque, Iowa, USA
Have you tried this? If you do, you'll find no S0C7 abend occurs so there's nothing to resolve. The S0C7 will occur when B is converted to packed decimal or binary (for use in computations, for example).
Find the COBOL Language Reference manual (link at the top of the page) and read up on using the IF NUMERIC test to resolve it.
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
Move A TO B
Move A (1:) TO B (1:)
This will cause the MOVE to be Alphanumeric to Alphanumeric, without any type of conversion and is applicable to COBOL2 and greater.
However, in the unaltered MOVE, field B will equal 'ABCD5' after the MOVE is complete. The compiler ensures that the last byte of B contains an 'F' zone-nibble, but the numeric-nibble remains. An 'E' is X'C5' and this is where the '5' comes from.
Neither one of these moves will cause a S0C7 on COBOL2 and greater compilers. However, this may not be true on OS/VS COBOL compilers as field A might be packed and then unpacked into B, with a result of 12345.
The reason for B resulting in 12345 is Assembler related and I'll leave that for you to research....