C$CARG

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.

Note: The -Cr compiler option is required for COMPUTATION/COMP usage data items to have the exected type (otherwise they are binary) and also to have a noninteger GIVING/RETURNING item.

Usage

CALL "C$CARG" USING OKAY, ARGUEMENT-NAME, 
ARGUEMENT-DESCRIPTION

Parameters

OKAY (PIC X)
A one-character alphanumeric data item into which the ASCII character Y is stored if C$CARG successfully identifies the argument named by argument-name; otherwise, the ASCII character N is stored in the data item.
ARGUEMENT-NAME (PIC X(N))
The name of a Linkage Section data item named in the Procedure Division header USING list.
ARGUEMENT-DESCRIPTION
A ten-character group data item into which the desired information about the argument specified by argument-name is stored. A typical data description for argument-description is as follows:
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:

ARGUEMENT-TYPE
returns a number indicating the type of the argument data item. The values and meanings for data type numbers returned in this field are as follows:
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    
ARGUEMENT-LENGTH
Returns the number of character positions occupied by the argument data item.
ARGUEMENT-DIGIT-COUNT
Returns the number of digits defined in the PICTURE character-string for an argument that is a numeric or numeric edited data item as indicated by the ARGUMENT-TYPE field value; otherwise, the value zero is returned for nonnumeric data items. The digit count for a numeric or numeric edited data item does not include any positions defined by the PICTURE symbol P, which represents a scaling position.
ARGUEMENT-SCALE
Returns the power of 10 scale factor (that is, the position of the implied or actual decimal point) for an argument that is a numeric or numeric edited data item as indicated by the ARGUMENT-TYPE field value; otherwise, the value zero is returned for nonnumeric data items. If the PICTURE symbol P was used in the description of the data item, the absolute value of the ARGUMENT-SCALE value will exceed the ARGUMENT-DIGIT-COUNT value; in this case, a positive scale value indicates an integer with P scaling positions on the right of the PICTURE character-string and a negative scale value indicates a fraction with P scaling positions on the left of the PICTURE character-string.

Comments

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.