Relaxed Type-checking

By default, the Compiler performs relaxed type-checking on BY VALUE binary data items. That is, even if binary data items have been defined with different sizes in the calling and called programs, the programs will compile with errors. If you specified a CALL statement that had a data item defined as PIC X(2) COMP in its USING list, that data item can correspond to a PIC X(n) COMP data item in a call prototype, where n on a 32-bit system can be from 1 through 4, and on a 64-bit system can be 1 through 8.

For example, the following program will compile successfully:

program-id. MYROUTINE is EXTERNAL.
 linkage section.
 01  callee-value             pic x(2) comp-5.
 procedure division using by value callee-value.
 end program MYROUTINE.

 program-id. MYMAIN.
 working-storage section.
 01  .
     05 caller-value          pic x(4) value 123.
 procedure division.
     call 'MYROUTINE' using by value caller-value
 end program MYMAIN.

In this example, if the actual value of caller-value was too big to fit a data item defined as PIC X(2) COMP-5, binary truncation would occur. Such truncations might cause problems with the logic of your program, so you might want to specify that type-checking is more strict so that you can identify such potential problems. You can do this by setting the Compiler directive PROTOTYPE"STRICT". If you were to set PROTOTYPE"STRICT" when you compiled the above program, the Compiler would produce a message warning you of the type mismatch.