Previous Topic Next topic Print topic


C$DARG

Returns information about a parameter passed in the USING or GIVING phrases of the CALL statement that called a subprogram.
Restriction: This routine is supported in native COBOL only.

When calling this routine, ensure you are using the 1024 calling convention.

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.

Syntax:

CALL "C$DARG" USING argument-number, argument-description

Parameters:

argument-number
pic 9(n)
argument-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).
	02 ARGUMENT-POINTER POINTER.
	02 ARGUMENT-PICTURE POINTER.

On Entry:

argument-number
The ordinal position of the argument in the USING phrase of the CALL statement. The value zero returns the description of the GIVING phrase of the CALL statement.

On Exit:

argument-description
Details of the passed parameter. Those details include:
argument-type
The type of data item; see the table in the Comments section.
argument-length
The number of character positions of the data item.
argument-digit-count
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.
argument-scale
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 ARGUMENTSCALE 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
argument-pointer
This parameter is not returned in this COBOL system.
argument-picture
This parameter is not returned in this COBOL system.

Comments:

Use the C$NARG library routine to obtain the number of arguments passed in the CALL statement.

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.

The following table is used to indicate the data type specified in the ARGUMENT TYPE field:

Type Number RM/COBOL Data Type Type Number RM/COBOL Data Type
0 NSE 16 ANS
1 NSU 17 ANS (justified right)
2 NTS 18 ABS
3 NTC 19 ABS (justified right)
4 NLS 20 ANSE
5 NLC 21 ABSE
6 NCS 22 GRP (fixed length)
7 NCU 23 GRPV (variable length)
8 NPP 25 PTR
9 NPS 26 NBSN
10 NPU 27 NBUN
11 NBS 32 OMITTED
12 NBU
Restriction: Data type OMITTED (type number 32) is not supported in this COBOL system.
Previous Topic Next topic Print topic