Hi,
Regarding the control of parameters passed to a subprogram, Enterprise Cobol does not comply with the ISO standard which specifies for description of the CALL statement:
If an OMITTED phrase is specified or a trailing argument is omitted, the omitted-argument condition for that parameter evaluates to true in the called program.
According to the tests I have done, the end parameters that are absents at the time of the CALL do not receive a NULL memory address (OMITTED), but receive an undefined value: the IF ADDRESS OF parm-n = NULL test does not work .
Still according to the ISO standard, the control to perform to test the absence of a parameter is:
IF data-name IS [NOT] OMITTED
I suggest that an RFE be opened for Enterprise Cobol to comply with the ISO standard.
Alternatively, one solution might be to develop an assembler subroutine that would traverse the SAVEAREA chain to trace back to the calling Cobol program, retrieve the value of register 1 in SAVEAREA from the caller to this Cobol program, and explore the list of parameters to count them (stop at parameter having bit 31 to 1).Going up the chain SAVEAREA seems quite simple (as long as the programs are standard LE), but I do not know how to identify the SAVEAREA that corresponds to the program Cobol (it would be necessary to recover the name of the program associated with the SAVEAREA, can be by recovery of the PPA1 structure associated with the program, the entry point of which is determined by the value of the register 15 saved in SAVEAREA.
It should request the provision of an intrinsic function "FUNCTION ARGCOUNT" to retrieve the number of parameters received.
DenisFALLAI