|
Mel, Remember OPDESC don't work properly prior to V5R1 when you have a parm in the list of parms that is CONST. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mel Rothman Sent: Monday, February 23, 2004 5:33 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: FW: Have you seen this? An improved way. I found a better way to write your own subprocedure, one that doesn't require calling the subprocedure then assigning the value. Here is the revised code: The subprocedure's prototype: D MyGetVar pr opdesc D varname 50 const varying options(*varsize) D varvalue 32767 options(*varsize) D occurrence 10i 0 const options(*nopass) The subprocedure's implementation P MyGetVar b D MyGetVar pi opdesc D varname 50 const varying options(*varsize) D varvalue 32767 options(*varsize) D occurrence 10i 0 const options(*nopass) * Work fields D wk s 32767 varying D i s 10i 0 * Parameters for CEEDOD, get operational descriptors (CEEDOD is prototyped * in QRPGLESRC member PROTOTYPEB) D Parmnum s 10i 0 D DescType s 10i 0 D DataType s 10i 0 D DescInfo1 s 10i 0 D DescInfo2 s 10i 0 D InDataSize s 10i 0 * Set i to occurrence C if %parms < 3 C eval i = 1 C else C eval i = occurrence C endif * Get information about second parameter. Will use InDataSize C callp ceedod(2:DescType:DataType:DescInfo1: C DescInfo2:InDataSize:*omit) * Get value and assign to varvalue, but only for varvalue's actual length C eval wk = ZhbGetVar(varname:i) C eval %subst(varvalue:1:InDataSize) = wk P MyGetVar e Sample uses: C callp mygetvar('custname':custname) C callp mygetvar('somevar':somevar:someoccur) Mel Rothman, CGIDEV2 Author Mel Rothman, Inc. _______________________________________________ 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.