|
Ok, I got a question about using varying and *varsize with CONST parameters. First, let me make it clear that I do (mostly;-) understand the differences between varying and *VARSIZE. Now as to my question, perhaps an example would make it clear. d Proc1a pr d msgData 32768a const d options(*varsize) d msgLen 10u 0 const d Proc1b pr d msgData 32768a const d varying d Proc2 pr d msgData 32768a const d options(*varsize) d msgLen 10u 0 const Now the code for Proc1a and Proc2a p Proc1a b d Proc1a pi d msgData 32768a const d options(*varsize) d msgLen 10u 0 const /free Proc2(msgData:msgLen); return; /end-free p Proc1a e p Proc1b b d Proc1b pi d msgData 32768a const d varying /free Proc2(msgData:%len(msgData)); return; p Proc1b e Now say you call: Proc1a('This is a Test':14); Proc1b('This is a Test'); I'm trying to understand the interactions between varying and *varsize when the compiler builds the temporary variable due to the CONST. Is the temporary for the call to Proc1a 32,768 bytes long or only 14? How about Proc1b? Any difference when dealing with a string expression using fixed-length or varying strings? Proc1a('Fld1 is:' + fld1 : %len('Fld1 is:' + fld1)); Proc1b('Fld1 is:' + fld1); What about just a varying field by itself? Proc1a(varyingFld1:%len(varyingFld1)); Proc1b(varyingFld1); I don't think the call to Proc1b would need a temporary variable or would it? Perhaps I should have Proc1b defined like so: d Proc1b pr d msgData 32768a const d varying options(*varsize) That would give me a procedure that would accept any size varying field, which is what I believe I want. The question is, do I need varying and *varsize to do what I want; which is minimize the size of any temporary fields built. Lastly, it is obvious that no temporary variables are needed when Proc1a calls Proc2. How about when Proc1b calls Proc2? Am I going to get a 32768 byte temporary for that call or not? Thanks, Charles Wilt -- iSeries Systems Administrator / Developer Mitsubishi Electric Automotive America ph: 513-573-4343 fax: 513-398-1121
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.