| Using CALLP with a Variable Program Name |
|
|
|
Q. I understand how to prototype a program call, using EXTPGM and naming the program. But I want to allow the user to select an item from a subfile, then have the program use that selection to choose one from among several different possible programs to run. Is there a way to do this? A. Yes. The EXTPGM value can be a character variable, as well as a literal or constant: D Mypgm PR Extpgm(Pgmname) The parameter list must be consistent for any of the possible programs to be called; that is, AR101 and PR457 must accept the same parameters. But you can include the OPTIONS(*NOPASS) and/or OPTIONS(*OMIT) keywords to make some parameters optional or omissible. The called programs (AR101 and PR457) need not be coded with prototypes, even though the calling program will use prototyping and CALLP. |
Special pricing for the Ontario area. Book a 5-day onsite class for as little as USD $900/day. Get a price quote today. Ask for offer CA900.
5-day minimum, special terms apply.