In addition to errors that occur using the Call Program (CALL) command, other types of data type errors can occur.
When passing a value, the data type (TYPE parameter) must be the same (*CHAR, *DEC, or *LGL) in the calling procedure or program and in the called procedure or program. Errors frequently occur in this area when you attempt to pass a numeric constant. If the numeric constant is enclosed in single quotation marks, it is passed as a character string. However, if the constant is not enclosed in single quotation marks, it is passed as a packed numeric field with LEN(15 5).
CALL PGMA PARM('123') /* CALLING PROGRAM */
PGM PARM(&A) /* PGMA */
DCL &A *DEC LEN(15 5) /* DEFAULT LENGTH */
.
.
.
IF (&A *GT 0) THEN(...) /* MCH1202 OCCURS HERE */
In the following example, a decimal value is passed to a program defining a character variable. Generally, this error does not cause runtime failures, but incorrect results are common:
CALL PGMB PARM(12345678) /* CALLING PROG */ PGM PARM(&A) /* PGMB */ DCL &A *CHAR 8 . . . ENDPGM
Variable &A in PGMB has a value of hex 001234567800000F.
Generally, data can be passed from a logical (*LGL) variable to a character (*CHAR) variable, and vice versa, without error, so long as the value is expressed as '0' or '1'.