|
HEllo Buck, You wrote: >Ordinarily you would add the VALUE keyword to the parameter. CONST is generally a better choice because it makes it obvious that the parameter should not be changed. Also, ALL AS/400 HLLs support passing by reference and CONST is a pass-by-reference mechanism. VALUE has some advantages when passing numeric values by reducing the amount of space used in the stack but in most cases should be used only when interfacing to C functions. >Unfortunately, CL can only accept calls by reference. Which is one reason why CONST is better because it allows 'constant by reference' parameters which CL supports. This will allow RPG to pass a literal to CL and have it padded to the correct size by the compiler. Note, however that the reverse situation (i.e., CL calling an RPG or COBOL procedure) is not quite so easy. CL does not suport prototyping so it doesn't know that a short literal should be padded to say 50 bytes. In this case you should use OPDESC and OPTIONS(*VARSIZE) in the called procedure and determine how much data was passed by the caller. (Or you could add an extra parameter for the length but that's just ugly -- especially in CL.) 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 mailto: shc@flybynight.com.au \ / X ASCII Ribbon campaign against HTML E-Mail / \ --------------------------------------------------------------------
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.