Yes. They must be in the same order and same type. Though if it is truly not needed you can send blanks for alpha and zeros for numeric.
May I inquire as to why you are asking?
Any parameter accessed in the called program must be passed.
So if PgmA calles PgmB and passes 5 parameters/
PgmB can access anywhere from 0 to 5 parameters but if it tries to access a 6th parameter it will encounter a pointer error.
You are passing pointers to data, they don’t have to be used.
Type/length wise .. it’s good to keep the types length the same. Espcially if a receiving parameter is numeric.
The %PARMS function can be used in the called program to determine how many parameters were passed. Don’t try to access any more than were passed.
Yes and No . If you are calling an OPM program then you must pass the number of parameters defined in the called program. If you are calling an ILE program then you can pass from 0 to N.
I think the ILE calling program must pass at least the number of parameters that are exercised in the called program. It’s rather that the called program can use from 0 to N (number passed). The %Parms function in the called program can be used to avoid exercising parameters that aren’t passed.
In the called program:
If %parms() > 6;
MyFld7 = Parm7;
MyFld7 = *blanks;
– – – – – – – – – – – – – – – – – – – – –
All is true !
but, it depends…..
Regardless of language or syntax, you must have consideration of what, precisely, needs to be accomplished, and what informatio needs to be provided to the called function. Plainly, there are situations where, if data is not given to it, there is no option but to fail / abend.
If there are three parameters, and you provide the first and third, without signifying the missing one, then again the program will behave erratically. If you provide the first two, and the third may be optional, then, as others have mentioned, you need only concern yourself with the content of the uninitialised field.
The techniques for coding for ‘optional’ parameters are well documented, and repeated here.
Remember the maxim . .
First, design your interfaces, then fill in the boxes.
Exercised yes, but the question was related to defined. An ILE called program can define any number of parameters, but the caller does not have to pass any. DSPPGM of an ILE program will show that the parameters can be in the range of 0 to 255. DSPPGM of an OPM program on the other hand shows the explicit number of parameters that must be passed.
The original question, what a novel idea! Actually the question looks twisted! Parameters aren’t passed from the called program! Parameters are passed from the calling program and returned from the called program. But here is the kicker — why did we assume that the question was about RPG? How many languages run on the AS/400 that can pass parameters?
Interesting discussion however.