If COBOL is like C (and I thought it was) then the words of the vector pointed 
to by R1 on a CALL are all addresses, not values, and so the high-order bit is 
available as a VL end-of-list flag. Does "BY VALUE" in COBOL mean the value is 
in the parm vector? (What about 64-bit values, or long character strings?) Or 
does it mean -- as with C -- that the value passed is a copy of the calling 
program's variable? IOW, the calling linkage is the same -- BY VALUE just means 
that if the called program changes the value the caller never sees the change.

It's interesting -- there is no doc -- at least in the V6.3 P/G -- for "calling 
an assembly language program." I had to go back to COBOL V2 to find any 
reference to calling assembly language programs. The doc there says that 
assembler calling COBOL "should" set the VL bit but does not discuss going the 
other direction. For something that shops do all the time the lack of doc is 
pretty amazing.

I stand by my original reply:
- I strongly suspect you can find the R1 from the entry into the called program 
by chaining back some specific number (perhaps 1) of calls in the save area 
chain, from an assembler routine written for this purpose.
- I strongly suspect COBOL uses the VL bit, so that assembler routine can count 
the passed parameters.
- You can find the EXEC PGM= program name from the JSCB. (And others have 
pointed out you can find the last loaded program name from the CDE chain.)

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Farley, Peter x23353
Sent: Tuesday, September 22, 2020 2:52 PM
To: [email protected]
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Current Enterprise COBOL compilers (and back as far as I know, even COBOL 
F-level from MVT) always mark the last parameter address in the address list 
with the bit 0 turned on, though I have not researched what current ones do if 
the last parameter is "BY VALUE".

Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
available in KC has the PPA1 format and in general how to locate it.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to