|
Mike, Heres what we use to check for existance of objects from within a program. Create it as a module and stick it in a service program. One thing you should note, if you are not authorizied to the object, i still flag the object as existing. CHKOBJ doesnt work this way, but this way seems to work better for what i usualy use the procedure for. If you're not on RPGIV, i think i can find an RPGiii version around somewhere. HTH, Ron Hawkins HNOMAIN * * procedure name: Exists * * procedure function: Return Y/N field based on objects existence. * GetAcro prototype D/copy *libl/prsource,Exists P Exists B export d Exists PI 1 d Object 10 const d ObjectType 10 const d ObjectILib 10 const options(*nopass) d ReceiveVar s 100 d ReceiveLen s 9b 0 inz(100) d ObjdFormat s 8 inz('OBJD0100') d ObjectLib s 20 inz(' *LIBL ') d ObjectTypF s 10 d Valid s 1 D ErrorDs DS 116 INZ D BytesPrv 1 4B 0 inz(116) D BytesAvl 5 8B 0 inz(0) D MessageId 9 15 D ERR### 16 16 D MessageDta 17 116 * c movel Object ObjectLib c eval ObjectTypF = ObjectType c if %parms = 3 c move ObjectILib ObjectLib c endif * Attemp to retrieve object description C CALL 'QUSROBJD' C PARM ReceiveVar C PARM ReceiveLen C PARM ObjdFormat C PARM ObjectLib C PARM ObjectTypF C PARM ErrorDs c select * If not authorized, then object must exist c when MessageId = 'CPF9821' c eval Valid = 'Y' * Otherwise, error trying to get object description, means not valid c when MessageDta <> *blanks c eval Valid = 'N' c other c eval Valid = 'Y' c endsl c return Valid P Exists E +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.