|
>> My procedure has a parameter with options(*varsize). This parameter receives the value passed in plus some extra characters like procedure name. I think you perhaps misunderstand the nature of passing parameters by reference, which is the normal mode for the AS/400. When you pass a parameter, no data is passed - rather the called program receives a pointer which effectively says "the data you want is here". All that specifying *Varsize does is allow a parameter smaller than the size specified to be passed. When you define a parm as 20 long and only pass a 10 char field, the called routine will see whatever 10 characters happen to follow the parm in memory. There is an implicit understanding here that the _programmer_ is responsible for determining the actual length passed. Think of QCMDEXC where the parameter string _and_ the length of the string are passed. While you could use operational descriptors and APIs, this is probably overkill. So a number of possible solutions: 1) Use VALUE for the parameter if passing it to a subprocedure and remove the *VARSIZE option 2) Use CONST without *VARSIZE - the compiler will move a small field to a larger one - padding with blanks as it goes. 3) If on release V4R4 then use Varying length fields for the parameters assuming that you can use the same definition in the called routine 4) Do like QCMDEXC does and pass the actual length of the parm as well as the parm itself and then deal with the length in the called program. Hope this helps. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.