|
That's a lot of code, but short of using RSLVSP, QUSROBJD is the "best" solution. -Bob Cozzi www.iSeriesTV.com Ask your Manager to watch iSeriesTV.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael Ryan Sent: Friday, September 08, 2006 10:16 AM To: RPG programming on the AS400 / iSeries Subject: Re: Object exists was ->RE: Costly PSDS I wonder if this is any faster than calling a CL program that does a CHKOBJ and passes back a parm? On 9/8/06, albartell <albartell@xxxxxxxxx> wrote:
Checking for a data queue, creating it if needed, and granting objectauthority seem to fly. On the note of checking for an objects existence. Here is how I have traditionally done it, but am open to faster ways. Comments anyone? //-------------------------------------------------------------------------- ------------------ // @Author: Aaron Bartell // @Desc: Check to see if an OS400 object exists at the specified location. //-------------------------------------------------------------------------- ------------------ P Object_exists B EXPORT D Object_exists PI N D pObjLib 10A Value D pObj 10A Value D pObjType 10A Value D pError 50a D rtvObjDesc Pr ExtPgm('QUSROBJD') D pObjData LikeDS(objData) D pObjDataLen 9B 0 D pFormat 8A D pQualObj 20A D pObjType 10A D pError LikeDS(error) D objDataLen S 9B 0 Inz(%size(objData)) D qualObj S 20A D useFormat S 8A D error DS based(template) qualified D bytesProvided 1 4B 0 D bytesAvail 5 8B 0 D msgId 9 15 D reserved 16 16 D data 17 56 D objData DS qualified Inz * ODJD0100 D BRet 9B 0 D BAvail 9B 0 D ObjName 10 D ObjLib 10 D ObjType 10 D RtnLib 10 D AuxStgPl 9B 0 D ObjOwn 10 D ObjDom 2 D CrtDate 13 D ChgDate 13 * ODJD0200 D XObjAtt 10 D Text 50 D SrcF 10 D SrcL 10 D SrcM 10 * ODJD0300 D SrcUpd 13 D ObjSavD 13 D ObjRstD 13 D CrtPrf 10 D SysCrt 8 D ResetD 7 D SaveS 9B 0 D SaveSeq 9B 0 D Storage 10 D SaveCmd 10 D SaveVol 71 D SaveDev 10 D SaveFNm 10 D SaveFLb 10 D SaveLbl 17 D SysLvl 9 D Complr 16 D ObjLev 8 D UsrChg 1 D LicPgm 16 D PTF 10 D APARpt 10 * ODJD0400 D LUDate 7 D UImfUpd 1 D DaysUsed 9B 0 D ObjSize 9B 0 D ObjSzM 9B 0 D CmpSts 1 D APgmChg 1 D ChgByPgm 1 D UsrDefA 10 D ObjOFA 1 D SvADate 13 D ObjAudV 10 D PrmGrp 10 /Free Monitor; useFormat = 'OBJD0100'; qualObj = pObj + pObjLib; rtvObjDesc(objData: objDataLen: useFormat: qualObj: pObjType: error); If error.msgId <> ' '; pError = error.msgId + error.data; EndIf; If objData.objName = ' '; Return *Off; Else; Return *On; EndIf; On-Error; pError = 'Unknown error occured. Check job log.'; EndMon; return *off; /End-Free P Object_exists E Aaron Bartell http://mowyourlawn.com -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.