In the CA Easytrieve program, the field passed to COBOL is defined as a type 'U', which is an unsigned packed decimal field. The value 20 is stored as x'00000020'. In the COBOL pgm, you declared it as PIC S9(8) COMP, which is a 4 byte integer. Integer value of x'00000020' is 32.
How can I get the correct value assigned to a BINARY field when passing to a COBOL program?
In the CA Easytrieve Program, you should declare it as type 'I'.
Type 'I' is an integer in new function mode.
In compatibility mode, a 4 byte binary value has type: 4 B
The 4 B type is valid in new function mode as well.