|
Optional Parameters and CL Procedures
Hey, Ted:
In "Adding New Parameters to RPG Programs," you stated that CL programs require that the exact number of expected parameters be passed to them. That's not entirely true.
If you use ILE CL (source type CLLE), you do not have to pass in the same number of parameters as expected. You can use the same technique you described in the RPG example. You would assign the parameter to the work field with CHGVAR, but monitor the assignment for message MCH3601 ("pointer not set for location referenced"). If that message is sent, you assign the default value to the work field.
PGM PARM(&OPTION_P &COPIES_P)
DCL VAR(&OPTION_P) TYPE(*CHAR) LEN(1)
DCL VAR(&COPIES_P) TYPE(*DEC) LEN(1)
DCL VAR(&OPTION) TYPE(*CHAR) LEN(1)
DCL VAR(&COPIES) TYPE(*DEC) LEN(1)
CHGVAR VAR(&OPTION) VALUE(&OPTION_P)
MONMSG MSGID(MCH3601) +
EXEC(CHGVAR VAR(&OPTION) VALUE(A))
CHGVAR VAR(&COPIES) VALUE(&COPIES_P)
MONMSG MSGID(MCH3601) +
EXEC(CHGVAR VAR(&COPIES) VALUE(1))
Thanks for listening.
--Doug
Thanks for writing, Doug. And thanks to the other readers who corrected me as well. My comment applied only to OPM CL, which I am currently using. I haven't done a formal study, but it seems that many iSeries shops use RPG IV along with OPM CL. One comment I've heard several times is that OPM supports the Retrieve CL Source (RTVCLSRC) command but ILE CL doesn't. All I can say is that I have probably retrieved CL source code from a program object less than half a dozen times since 1988, when I first touched a System/38. Given a choice between being able to retrieve source code from the program object and being able to pass fewer than the number of defined parameters, I'd much rather have the latter ability. This seems to me an excellent reason to dump OPM CL, as many have dumped RPG III (A.K.A. RPG/400).
Monitoring for MCH3601 has another purpose. You will need to monitor for MCH3601 if you write your own RTV-type commands. IBM's RTV commands, such as Retrieve Job Attributes (RTVJOBA) and Retrieve User Profile (RTVUSRPRF), can return a lot of different data, but require you to code only the parameters that interest you. If you write a CL program that processes an RTV-type command, you'll need to monitor for MCH3601 for optional parameters.
PGM PARM(&OPTION &TEXT)
DCL VAR(&OPTION) TYPE(*CHAR) LEN(1)
DCL VAR(&TEXT) TYPE(*CHAR) LEN(50)
CHGVAR VAR(&OPTION) VALUE(whatever...)
MONMSG MSGID(MCH3601)
CHGVAR VAR(&TEXT) VALUE(whatever...)
MONMSG MSGID(MCH3601)
--Ted
|
|
Sponsored By
WORKSRIGHT SOFTWARE
|
|
Do you need area code information?
Do you need ZIP Code information?
Do you need ZIP+4 information?
Do you need city name information?
Do you need county information?
Do you need a nearest dealer locator system?
We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!
The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.
PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.
Just call us and we'll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.
WorksRight Software, Inc.
Phone: 601-856-8337
Fax: 601-856-9432
E-mail: software@worksright.com
Web site: www.worksright.com
|
|
|
Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
|
|
|
|
|