E$CHKOBJ - Check if object exists
Start Command
- call e$chkobj [F4]
Call Parameters
- library (a10)
- Name of the library where the object is expected. Use *LIBL if you want to check the existance of a library itself.
- object (a10)
- Name of the object.
- object type (a10)
- Same values as used with the OS/400 Commandobject CHKOBJ. Most used values:
- Value: *FILE
- This value instructs the program to check if the object of type FILE exists in library.
- Value: *PGM
- This value instructs the program to check if the object of type PROGRAM exists in library.
- yesno (a1)
- Same values as used with the OS/400 Commandobject CHKOBJ. Most used values:
- Value: *FILE
- This value instructs the program to check if the object of type FILE exists in library.
- Value: *PGM
- This value instructs the program to check if the object of type PROGRAM exists in library.
Return Parameters
- yesno (a1)
- Returns wheter if the object was found or not:
- Value: Y
- The object of type object type exists in library.
- Value: N
- The object of type object type does not exist in library.
What it does
Provides an easy means to check for the existance of objects from within other programs. No need for trapping CPF-messages, the program returns a simple Y(es) or N(o).
Examples
Here's an example in RPG III:
C | CALL | 'E$CHKOBJ' | |||
C | PARM | '*LIBL' | LIB | ||
C | PARM | 'QPRINT' | OBJ | ||
C | PARM | '*OUTQ' | TYPE | ||
C | PARM | YN |
Go to download page