|
This is a multi-part message in MIME format. -- [ Picked text/plain from multipart/alternative ] I have a general-purpose pop-up window used to display and select values from a reference file. Parameter 1 is the reference name and it's passed in as a literal ('TERMS', 'STATE'). Parameter 2 is the field I want the value selected by the user returned into (back to the caller). Both parameters are 10A. Currently, the program is called with a prototype using EXTPGM(‘LOOKUP’). A typical implementation looks like this: C callp lookup('TERMS':q_alpha_10) C eval terms_code = %subst(q_alpha_10:1:%size(terms_code)) C callp lookup('STATE':q_alpha_10) C eval sh_state = %subst(q_alpha_10:1:%size(sh_state)) Now, the complication: the size of the second parameter varies (based on what I’m looking up): "terms_code" is 3A, but "sh_state" is 2A. Improper management of the parameters (size) has caused problems (decimal data errors because the improperly-sized parameter 2 overflows into adjacent fields in memory); the second line solved the problem. Because LOOKUP is called with EXTPGM, OPDESC doesn’t work. Yes, it should be in a service program but circumstances of time and customer politics don't allow it. I’ve done this too: C callp lookup('TERMS':q_alpha_10) C eval terms_code = q_alpha_10 C callp lookup('STATE':q_alpha_10) C eval sh_state = q_alpha_10 This is the ideal solution: C callp lookup('TERMS':terms_code) C callp lookup('STATE':sh_state) I've tinkered with VARYING, setting the length, etc. but am unable to come up with a way to implement the ideal solution. Perhaps it’s too much Halloween candy, but I'm sure there's a better way to juggle OPTIONS(*VARSIZE) and VARYING to make this work...or is there? Thanks, rf --
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.