Hi Alan,
Whoa. Barbara, so this means I can add
> all the parameters I want to my heart's
> content to the already previously existing
> procedures in a service program without
> messing things up at the signature level?
> (In my case I name the signatures myself).
Absolutely. I've been doing this for years. The trick, as Barbara
mentioned is to use *NOPASS, and then in the body of your subprocedure,
check to see if the caller passed the parm or not. If not, you probably
need a default value.
Be careful NOT to use a *NOPASS parameter directly in your subprocedure
though, because if the caller didn't pass it, you _might_ have an
address in the stack at that position, and you _might_ not get an error
message, but you'd be inspecting and perhaps changing memory that you
shouldn't!
*=========================================
* create user space
p crtUsrSpc b export
d crtUsrSpc pi n
d i_spcNam 10 const
d i_spcLib 10 const
d o_error like(api_err)
d i_text 50 const options(*nopass)
d i_atr 10 const options(*nopass)
d i_siz 10i 0 const options(*nopass)
d i_aut 10 const options(*nopass)
d i_rpl 10 const options(*nopass)
d w_text s like(i_text)
d w_atr s like(i_atr)
d w_siz s like(i_siz)
d w_aut s like(i_aut)
d w_rpl s like(i_rpl)
// load working variables from input
if %parms < 4;
w_text = *blanks;
else;
w_text = i_text;
endif;
...
Also, one still needs to create a new signature
> for the new program(s) that actually use the new
> parameter, don't they?
Not following this. The signature belongs to the service program. I
have signatures like this
strpgmexp pgmlvl(*current) signature('01.00 20070404')
and when I make a change, I keep signature('01.00 20070404') as *PRV and
increment the version number. Existing programs have '01.00 20070404'
as their signature comparison, and so run just fine. Newly changed
program that use the new functionality in the *NOPASS parameter will get
the new signature to compare against. It's probably unnecessary, but
it's easy for me to see what program is consuming what version of the
service program.
--buck
As an Amazon Associate we earn from qualifying purchases.