C$DARG returns information about an actual parameter passed in the USING phrase in the CALL statement that called 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$DARG" USING ARGUEMENT-NUMBER, ARGUEMENT-DESCRIPTION
Parameters
- ARGUEMENT-NUMBER
- The one-relative ordinal position of the actual argument in the USING phrase of the CALL statement used to call the subprogram
that calls C$DARG. The value zero obtains the description of the actual argument in the GIVING phrase of that CALL statement.
If the value specified is less than zero or greater than the number of actual arguments passed, an argument-description for
an omitted argument will be returned (ARGUMENT-TYPE = 32). The actual number of arguments passed can be obtained with the
C$NARG subprogram. The actual number of arguments may exceed the number of formal arguments declared in the Procedure Division
header of the program that calls C$DARG. All of the actual arguments can be accessed using C$DARG even though there is no
formal argument name available for accessing the actual arguments beyond the number of formal arguments.
- ARGUEMENT-DESCRIPTION
- A ten-character group data item into which the desired information about the argument specified by argument-NUMBER 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 shown in the table located in the C$CARG topic.
- 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.