Great ideas, but I don't think it will work in this case! Please prove me wrong.

I am printing signatures (*pagseg) on a document. The pgm writing the *pagseg object couldn't care less if the signature exists or not - it will happily write the external printer file record with the JOHNDOE signature and keep on going.

However when the OS starts printing the spool file, and the *pagseg named JOHNDOE isn't found, it crashes with error "*pagseg" not found.

How can I avoid the pre-checking for the *pagseg object? Can I OVRSPLF and somehow tell the writer to ignore *afpds elements that are not available at print time?






-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Wednesday, April 25, 2012 12:20 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: want to CHKOBJ from cobol pgm

On 25 Apr 2012 09:04, Stone, Joel wrote:
Is it safe to CALL QLICKOBJ as described in the CHKOBJ command info
below?

Note that the "State used to call program" is *SYSTEM. Presumable
even if you were granted authority, e.g. *PUBLIC having *USE, then the
CALL should fail anyway, with MCH6801 "Object domain or storage
protection error" because your user program does not run in System
State. That is, DSPPGM YourPgm would show in "Program Statistics" that
the program has "Program state: *USER" and "Program domain: *USER",
but DSPPGM QSYS/QLICKOBJ would show both of those same attributes as
*SYSTEM.

Or could IBM change the pgm name or parms called by CHKOBJ command
in future releases?

Any program not documented as an API could change to no longer be
available to the user domain or change parameters; definition and\or
number, in any release or even a PTF.

If I try "CALL QLICKOBJ", I find that I don't have authority to call
it.

And unless the system QSECURITY level is less than 40, the CALL will
fail with the lic exception 4401.

How can I use CHKOBJ to call QLICKOBJ, but don't have authority to
call it directly? What allows me to run QLICKOBJ only when going
thru CHKOBJ command?

Because the *CMD processing is implemented by the OS. The Command
Prompter (PT) or Command Analyzer (CA) component knows how to invoke the
QLICKOBJ either via the System Entry Point Table (SEPT) by an address
with the stored authority [or improbably more explicitly via its adopted
authority from QSYS].

Is there a better method for checking if object exists?

Normally the attempt to use a missing object is the best way. If any
proactive attempt is made, then concurrency means the presumed-failure
style of proactive checking could make an improper decision; i.e. had
the programming style been presumed-success and just attempted to use
the object and found the object to have been created by then, the code
could have continued without error or ever knowing the object may have
been missing even just a microsecond before.

If one must insist on using the very less desirable pre-check, then
like someone already stated in the previous thread, why not just use the
Retrieve Object Description (QUSROBJD) API for which one possible
outcome is "CPF9801 E Object &2 in library &3 not found." just like
CHKOBJ and RTVOBJD:
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/apis/qusrobjd.htm?
"The Retrieve Object Description (QUSROBJD) API lets you retrieve object
information about a specific object. This information is similar to the
information returned using the Display Object Description (DSPOBJD)
command or Retrieve Object Description (RTVOBJD) command. ..."

There are also options for invocations of the CL command CHKOBJ from
a program; e.g. QCAPCMD, QCMDEXC, or invoking a CLP\CLLE which codes the
"CHKOBJ &parm1/&parm2...", etc.

<ed:> DSPOBJAUTQSYS/QLICKOBJ *PGM shows public aut *EXCLUDE

<ed:> DSPCMD QSYS/CHKOBJ shows CCP=QSYS/QLICKOBJ
called with *SYSTEM state; allowed in all modes\environments

Regards, Chuck

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].