|
Hi Mike, first how your prototype looks like? A temporary variable gets only declared if the parameter is passed by constant reference (Keyword CONST in the prototype) and the passed parameter is not an exact match of the parameter definition in the prototype. This is independent from specifying the keyword OPTIONS(*VARSIZE). Specifying OPTIONS(*VARSIZE) will accept any length up to the maximum length. Keep in mind, not the duplicate is passed to the called procedure but only the address of either the original field or the duplicate. For input only parameters, a shorter length may not be a problem, because you cannot change it. But for input/output parameters you have to check the incomming number of bytes (with API CEEDOD) and only this number of bytes can be changed in your program. Otherwise you'll change bytes that belong to other variables in your global storage. For CL-Procedures it's also possible to define prototypes that can be embedded in RPG. >From RPGIV reference: "EXTPROC(*CL: 'MYPROC') specifies an external procedure that is written in ILE CL, or an RPG procedure to be called by ILE CL. Use *CL if your program uses return values with data types that CL handles differently from RPG. For example, use *CL when prototyping an RPG procedure that is to be called by a CL procedure when the return value is 1A." When using a prototype for CL-Procedures, the parameter passing works as if it would be a RPG procedure. In case of OPTIONS(*VARSIZE) you have to check the incomming number of parameters in your CL procedure as you have to do it in your RPG procedure. When calling RPG-Procedures from CL, no parameter conversion can happen, because there is no way to specify a prototype. Mit freundlichen Gru?en / Best regards Birgitta "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown) -----Ursprungliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Mike Pantzopoulos - (H/O) Gesendet: Sonntag, 5. Marz 2006 10:20 An: RPG programming on the AS400 / iSeries Betreff: RE: CALLPRC parameter usage Ok. Last question (I hope). I understood from the manual that the system converts the parameter passed from the calling RPG into a temporary vatiable length field if the prototype is declared as *varsize. In the calling RPG, the parameter can be declared as any length up to the prototype declaration. It's declared as a noraml variable, and If that's the case, then why can't they convert the CL variable in the same fashion and avoid this low-level explicitness? -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Simon Coulter Sent: Friday, 3 March 2006 4:49 PM To: RPG programming on the AS400 / iSeries Subject: Re: CALLPRC parameter usage On 03/03/2006, at 3:20 PM, Mike Pantzopoulos - (H/O) wrote: > I found the problem with the &RETURN parameter in midrange and got > that to work as well by extracting only the first byte. Is this some > issue with the way the compiler returns a value through the procedure > name that can't be mapped directly to how CL works internally? It has nothing to do with how CL works internally. It has everything to do with really dumb design. When ILE CL was created the only other ILE language was C. C has the rather stupid habit of widening parameters and return values. Thus whoever implemented the CL CALLPRC tried to be compatible with C and gave little or no thought to the possibility that other ILE languages might be callable from CL in some future release. This problem also exists when calling CL procedures from RPG. RPG has a (relatively recently) provided options on the EXTPROC keyword to control this behaviour. CL should have provided the same set of options. Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 \ / X ASCII Ribbon campaign against HTML E-Mail / \ -------------------------------------------------------------------- -- 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. **************************************************************************** ***************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, any use, disclosure or copying of this message is unauthorised. If you have received this message in error, please reply using the sender's email address. This footnote confirms that this email message has been scanned for computer viruses. EIG-Ansvar Limited does not accept liability for any loss or damage, whether caused by our own negligence or not, that results from a computer virus or defect in the transmission of this email or any attached file. EIG-Ansvar Limited - Australia (A.B.N. 21 007 216 506) Email : insure@xxxxxxxxxxxxxxxx Eig-Ansvar Limited - New Zealand Email : insure@xxxxxxxxxxxxxxxx **************************************************************************** ***************************** -- 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.