|
Here's one from my RPG TNT book... D qusec_T DS QUALIFIED D dsLen 10I 0 Inz(%size(qusec_t)) D bytesAvail 10I 0 Inz D cpfmsgID 7A D reserved 1A Inz(X'00') D exceptionData 64A Inz(*ALLX'00') D OBJD0100_T DS QUALIFIED D bytesRtn 10I 0 D bytesAvail 10I 0 D name 10A D library 10A D type 10A D objtype 10A Overlay(type) D rtnLibrary 10A D rtnLib 10A Overlay(rtnLibrary) D ASP 10I 0 D domain 2A D crtDate 13A D chgDate 13A P ChkObj B Export D ChkObj PI 1N D object 20A Const D ObjType 10A Const D bNotFound S 1N Inz(*OFF) D bFound S 1N Inz(*ON) D myObj DS LikeDS(OBJD0100_T) INZ D apiError DS LikeDS(QUSEC_T) INZ(*LIKEDS) C callp(e) QusRtvObjd(myOBJ:%size(myOBJ):'OBJD0100': C object : objType : apiError) C if apiError.cpfmsgid<>*BLANKS C Select C When apiError.cpfmsgID='CPF9801' or C apiError.cpfmsgID='CPF9810' or C apiError.cpfmsgID='CPF9811' or C apiError.cpfmsgID='CPF9812' or C apiError.cpfmsgID='CPF9814' C return bNotFound C other // QUSROBJD failed for another reason C endSL C endif C return bFound P ChkObj B -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 Rory Hewitt Sent: Friday, September 08, 2006 11:06 AM To: RPG programming on the AS400 / iSeries Subject: Re: Object exists was ->RE: Costly PSDS Bob, Yeah, it's a lot of code, but most of it's definitions, so it doesn't really 'count'. I have a procedure that is remarkably similar... :-) Although, unless Aaron's missed off something from the code (or I've just missed something), the call to QUSROBJD will fail anyway because the error structure hasn't been allocated. And the error.bytesProvided should be set to %size(error) before the call... Rory p.s. I've also used rslvsp(), but it's not 'significantly' quicker, especially since you're typically not doing this (checking if an object exists) very often.
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.