TechTalk: On CALLing and PARMing

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

From: Tim Phinney To: All

I have a program I'd like to be able to CALL but also run from a menu. When I run it from the menu I receive an error which says that I didn't pass the parameter. Is there a way to override this message?

From: Ernie Malaga To: Tim Phinney

You can do two things:

1. Change your menu so that the program is CALLed passing dummy parameters such as blanks or zeros. The called program will have to be modified, of course, to recognize this situation as valid.

2. If the CALLed program is an RPG program, you can use the program-status data structure to retrieve the number of parameters that were received by the program. I don't have the manuals with me here, so I can't tell you where in the data structure you'll find this information. As long as your program doesn't attempt to use the parameters it didn't receive, it should run OK. CL doesn't have this capability-you must always supply all parameters when you CALL the program.

From: Tibor Reich To: Tim Phinney

You can call the program without passing any parameters to it, provided you never use the parm field in the called program if it was not passed. To find out if any parameters were passed to the called program, you can check the *PARMS subfield in the program status data structure.

From: Greg Leister To: Tim Phinney

The program status data structure contains predefined subfields that provide information about the program and the exception/error conditions that occur. It is defined by using an S in position 18 of the data structure statement. Look in the RPG/400 Reference Guide for more information and subfield sizes and contents.