%parms and ILE/COBOL

195 pts.
Tags:
i5
iSeries Cobol programming
Is there a way in COBOL to determine how many parms have been passed in? (like the %parms bif in rpgiv)
ASKED: October 9, 2007  3:18 PM
UPDATED: January 30, 2010  10:07 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

This was in the ILE Cobol Programmer’s Reference manual on the iSeries Information Center.

<i>If you do not want the called program to receive a corresponding argument or if you want the called program to use the default value for the argument, specify the OMITTED phrase in place of the data item on the CALL…BY REFERENCE or CALL…BY CONTENT statement. For example: CALL…BY REFERENCE OMITTED CALL…BY CONTENT OMITTED

In the called program, you can use the CEETSTA API to determine if a specified parameter is OMITTED or not. </i>

The following is a link to the manual for V5R3:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/sc092540.pdf

================================================================

However, some care must be taken. The term “program” in COBOL also refers to ‘subprograms’. In the case of OMITTED parameters, note the specific rules in the <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092539.pdf”>COBOL Reference manual</a> for the BY REFERENCE clause of the CALL statement:

—————————————————————————–
<b>OMITTED</b>

For standard parameters when a parameter is passed BY REFERENCE, a pointer to the original data item is passed to the called program. When OMITTED is specified, a NULL pointer is passed to the called program. In this case, the called program will use its default value.

<i>OMITTED can only be specified on calls to programs with a LINKAGE TYPE of procedure.</i>
—————————————————————————–

The closing sentence is where care is needed. There are cases where ‘omitted’ parameters may be specified for calls to *PGMs. But the rules can require research and practice before being always predictable.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following