Another simple way to check for the existence of an IFS object --without having to dig into IFS APIs -- is to use the DSPLNK command with the printer output option. The command will generate CPFA0A9 if the object(s) do not exist.
The only drawback to this method is that it will create a spool file listing the object(s) -- if they actually exist. But you could encapsulate it in a CL where you could override and hold the spool file before issuing the DSPLNK command, then delete it when done.
OVRPRTF FILE(QSYSPRT) HOLD(*YES)
DSPLNK OBJ('/path/objectname') OUTPUT(*PRINT) OBJTYPE(*ALL)
DLTSPLF FILE(QSYSPRT) SPLNBR(*LAST)
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.