Joel:

Few, if any, of the Command Processing Programs (CPPs) of IBM-supplied commands are intended or allowed to be CALLed directly.

Instead, I find it convenient to write a small CL "wrapper" (or "jacket") *PGM, in CLP or CLLE, to encapsulate any command I may need to invoke from any higher level language (e.g. from RPG/400, RPG IV, or COBOL, or even C).

For example you might code something like this:

PGM PARM(&LIB &OBJ &TYP &ERR)
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJ) TYPE(*CHAR) LEN(10)
DCL VAR(&TYP) TYPE(*CHAR) LEN(10)
DCL VAR(&ERR) TYPE(*LGL) LEN(1)
CHGVAR VAR(&ERR) VALUE('0')
CHKOBJ OBJ(&LIB/&OBJ) OBJTYPE(&TYP)
MONMSG MSGID(CPF0000) EXEC(CHGVAR VAR(&ERR) VALUE('1'))
RETURN
ENDPGM

In this manner, you can easily create an environment in which any CL commands can run, taking full advantage of all the parameter substitution capabilities that CL offers, while making any command(s) "callable" from any high-level language(s), with a return error indicator to indicate if any errors were detected.

I find this is much simpler and easier to manage, versus messing with QCMDEXC and its ilk (e.g. the system() API) from the various HLLs.

Hope that helps,

Mark S. Waterbury

> On 4/25/2012 12:04 PM, Stone, Joel wrote:
Is it safe to CALL QLICKOBJ as described in the CHKOBJ command info below?

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


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

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?

Is there a better method for checking if object exists?


Display Object Authority

Object . . . . . . . : QLICKOBJ Owner . . . . . . . : QSYS
Library . . . . . : QSYS Primary group . . . : *NONE
Object type . . . . : *PGM ASP device . . . . . : *SYSBAS

Object secured by authorization list . . . . . . . . . . . . : *NONE

Object
User Group Authority
*PUBLIC *EXCLUDE

Thanks







Display Command Information

Command . . . . . . . : CHKOBJ Library . . . . . . . : QSYS

Program to process command . . . . . . : QLICKOBJ
Library . . . . . . . . . . . . . . : QSYS
State used to call program . . . . . : *SYSTEM
Source file . . . . . . . . . . . . . : S000043355
Library . . . . . . . . . . . . . . : QTEMP
Source file member . . . . . . . . . . : CHKOBJ
Validity checking program . . . . . . : *NONE
Mode(s) in which valid . . . . . . . . : *PROD
*DEBUG
*SERVICE
Where allowed to run . . . . . . . . . : *IMOD *BMOD *IREXX
*BREXX *BPGM *IPGM
*EXEC *INTERACT *BATCH

______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

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].