C$CARG returns information about the actual parameter that corresponds to a formal parameter in the USING phrase in the Procedure Division header of a subprogram. This information identifies the type and length of the argument and, when the argument is numeric or numeric edited, the number of digits and scale factor for the argument.
CALL "C$CARG" USING OKAY, ARGUEMENT-NAME, ARGUEMENT-DESCRIPTION
01 ARGUMENT-DESCRIPTION. 02 ARGUMENT-TYPE PIC 9(2) BINARY(2). 02 ARGUMENT-LENGTH PIC 9(8) BINARY(4). 02 ARGUMENT-DIGIT-COUNT PIC 9(2) BINARY(2). 02 ARGUMENT-SCALE PIC S9(2) BINARY(2).
The argument-description group item will have the correct length only if ARGUMENT-TYPE, ARGUMENT-DIGIT-COUNT, and ARGUMENT-SCALE are allocated as two-byte binary and ARGUMENT-LENGTH is allocated as four-byte binary.
The fields in ARGUMENT-DESCRIPTION have the following meanings:
Type Number | Data Type | Type Number | Data Type |
---|---|---|---|
0 | Numeric edited | 16 | Alphanumeric |
1 | Unsigned numeric DISPLAY | 17 | Alphanumeric (justified right) |
2 | Signed numeric DISPLAY separate | 18 | Alphabetic |
3 | Signed numeric DISPLAY | 19 | Alphabetic (justified right) |
4 | Signed numeric DISPLAY separate | 20 | Alphanumeric edited |
5 | Signed numeric DISPLAY | 21 | Alphabetic string edited |
6 | Signed numeric COMP with -Cr compiler option | 22 | Group (fixed length) |
7 | Unsigned numeric COMP with -Cr compiler option | 23 | Group (variable length) |
8 | Unsigned numeric PACKED-DECIMAL | 26 | Signed numeric COMP-5 |
9 | Signed numeric PACKED-DECIMAL | 27 | Unsigned numeric COMP-5 |
10 | Unsigned numeric COMP-6 | 32 | OMITTED |
11 | Signed numeric BINARY | ||
12 | Unsigned numeric BINARY |
If a calling program passes a called program two or more arguments that begin at the same location (either through redefinition, with reference modification, or because one is a group that contains the other), when the called program asks C$CARG for the parameter descriptions, it always receives that of the first actual argument passed that has the same location, regardless of the name specified in argument-name. In such cases, the C$DARG subprogram may be used to obtain the distinct descriptions by using argument-number.