|
>> Second, you could simply remove the options(*varsize) from your prototype/interface. What good is it really doing you? The benefit of Varsize is that a generic routine such as the "Center" one here can accept any length of parameter from 1 to 256 characters. Get rid of Varsize and the parm always has to be 256 long. >> Third, if you do want to use options(*varsize) you could use an operational descriptor to get the string length, and then make sure that you only reference that length of data... While you could use descriptors they are a pain in the backside to implement and (since the implementation is far from complete - e.g. numerics aren't supported) have very limited utility. Personally I'd pass the length of the output field to the procedure using %Size. Also this is a good use for varying length fields together with the keyword CONST or VALUE - this would avoid having to pass the length of the input parm. C* test the center sub-proc c eval dsshpnm = 'CENTER ME' c eval output = Center(%TrimR(dsshpnm):%Size(Output)) c dsply output 35 c eval *inlr = *on P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P* routine to center text P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P Center B D Center PI 256A D InString 256A Const Varying D OutLen 3P 0 Const One other comment to the original writer. Why are the Overlay keywords being used in the ShipToDS ? They serve no purpose and can be completely omitted with no resulting change in layout as far as I can see. I would also recommend the use of the LIKE keyword to define the subfields (or for that matter have the ShipTo stuff as an externally described ds) this avoids any chance of the thing being screwed up by differing lengths in the subproc and the mainline that invokes it. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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-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.