Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

*omit arguments on cobol ILE procedure call

72 views
Skip to first unread message

Steve Richter

unread,
May 20, 2008, 8:21:28 PM5/20/08
to
in ILE COBOL, can I *OMIT arguments which are passed to a called
service program procedure? ( I want to *omit arguments just as I do
in RPG code. )

here is the COBOL code which calls a procedure:
move 'MSTR-READ' to ws-ch80.
call linkage type is procedure "cp800_PrintLog_cp800mstrp"
using by reference minc, ws-ch80.

thanks,

-Steve

CRPence

unread,
May 20, 2008, 9:52:00 PM5/20/08
to

On the CALL either specify "OMITTED" for each parameter to omit, or
where its omission is obvious as either the latter parameter(s) or the
only parameter, just omit naming a parameter. See "By phrase" portion
of the syntax diagram found later in the "CALL Statement - Format 2" for
the documentation; with "Notes: IBM Extension" indicated:
http://publib.boulder.ibm.com/infocenter/systems/topic/rzasb/sc092539547.htm

FWiW CEEHDLR CEEDATE CEEDAYS examples are likely to show omitted
parameters. For example:
http://publib.boulder.ibm.com/infocenter/systems/topic/apiref/apiexusdata.htm
thread: http://archive.midrange.com/cobol400-l/200110/msg00038.html

In SPECIAL NAMES specifying LINKAGE TYPE of PROCEDURE with "USING ALL
DESCRIBED" establishes Operational Descriptor such that sufficient
information exists to determine the detail of the parameters passed and
omitted on the procedure call. See also CEETSTA API, and "ADDRESS OF"
compares to NULL for testing in a procedure if a parameter was omitted:
http://publib.boulder.ibm.com/infocenter/systems/topic/rzasb/sc092539551.htm
thread: http://archive.midrange.com/cobol400-l/200011/msg00014.html

Regards, Chuck

Barbara Morris

unread,
May 21, 2008, 2:17:55 PM5/21/08
to
CRPence wrote:
>
> On the CALL either specify "OMITTED" for each parameter to omit, or
> where its omission is obvious as either the latter parameter(s) or the
> only parameter, just omit naming a parameter. See "By phrase" portion
> of the syntax diagram found later in the "CALL Statement - Format 2" for
> the documentation; with "Notes: IBM Extension" indicated:
> http://publib.boulder.ibm.com/infocenter/systems/topic/rzasb/sc092539547.htm
>

If I understand correctly, you're saying that Steve could handle an
omitted final parameter by coding either this


call linkage type is procedure "cp800_PrintLog_cp800mstrp"

using by reference minc, OMITTED.
or this


call linkage type is procedure "cp800_PrintLog_cp800mstrp"

using by reference minc.

It's not correct to code the second way. Usually, you can't simply
leave off the omissible parameters. This is always true for APIs with
omissible parameters. (The only time you _can_ leave them off is when
there is another way for the called procedure to know how many
parameters were passed, _and_ the called procedure does actually figure
out how many parameters were passed.)

The APIs with omissible parameters assume that all the parameters are
always passed. If an API has three parameters, and only two are passed,
and a pointer happens to be hanging around on the stack where the API
expects to find the third parameter, the API will assume the parameter
was indeed passed and use or update whatever storage the pointer happens
to point to.

When omissible parameters are just left off, sometimes it happens that
the error goes undetected for years, with the API always getting a null
pointer at the unpassed parameter. And then something changes in the
environment (program called from a different menu, recompile, system
PTF, new release etc) that causes a non-null pointer to be there. This
can lead to subtle and hard-to-find bugs.

CRPence

unread,
May 22, 2008, 10:45:14 AM5/22/08
to
Good point. I was thinking more about optional versus omissible when
I alluded to the latter coding for the CALL. Easy for me to do, since I
would always code for either way; i.e. an omissible parameter was also
always a fully optional parameter [beyond the required minimum number of
parameters], due to the following style of coding:

<code>
Declare Parm3Pos Type(Integer) value(3);
If %parms()>=Parm3Pos & Parm3Addr<>NULL
then do; /* Parm3 was passed */
Parm3LclAddr=Parm3Addr; /* Addr stg of caller */
end;
else do; /* Parm3 was not passed */
Parm3LclAddr=%addr(Parm3Dft); /* Addr stg of Parm3 defaults */
end;
</code>

Regards, Chuck

Steve Richter

unread,
May 23, 2008, 2:52:11 PM5/23/08
to
On May 20, 9:52 pm, CRPence <CRPe...@vnet.ibm.com> wrote:
> Steve Richter wrote:
> > in ILE COBOL, can I *OMIT arguments which are passed to a called
> > service program procedure?   ( I want to *omit arguments just as
> > I do in RPG code. )
>
> > here is the COBOL code which calls a procedure:
> >  move 'MSTR-READ' to ws-ch80.
> >  call linkage type is procedure "cp800_PrintLog_cp800mstrp"
> >       using by reference minc, ws-ch80.
>
> On the CALL either specify "OMITTED" for each parameter to omit,

that worked. thanks.


0 new messages