View previous topic :: View next topic
|
Author |
Message |
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
What happens when the number of parameters in the CALL statement of the CALLING program is greater than the number of parameters specified in the PROCEDURE DIVISION USING statement of the CALLED program. What happens when it is lesser than?
Also as per the manual, the datatypes of the parameters need not match between the calling and called program but the number of bytes should match. If the number of bytes do not match what will be the abend.
I tried searching the forum, but I was not able to locate the answers for these questions. If it has already been answered, please let me know the post link. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Keep in mind that when one module calls another the parameters are not data that is transferred - the address to the data is what is used by the called module.
To avoid surprises, the calling module and the called module should use the same number of parameters with the same definition. Many systems use a COPY member so that the continuity is maintained between a called module and the modules that call it. |
|
Back to top |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
Thanks for the info. I agree that the address to the data is transferred. I too have seen copybooks being used in my shop. But I would like to know what will be the kind of surprises that we will see incase there is a mismatch in the number of parameters. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
S0C4 (storage) abends are most common. If the calling program passes more parameters than the called program uses, the additional parameters aren't available to the called program (although if it is assembler, the program can access the extra parameters). There will not be an abend, though. When a calling program passes fewer parameters than the called program expects, however, if the called program attempts to access the unavailable parameter value then the address being used is not predictable and hence the results are unpredictable -- although abends are quite possible. |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
It is possible to test for a valid adress for each parameter in the called program to check if it has been set, in case you have to handle such a situation in your application.
If the address have no value, don't execute any code that references variables in that parameter area. |
|
Back to top |
|
|
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
Thanks for your explanation. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In the CALL USING statement, to omit parms from being passed to the called program, replace the given parm-name with OMITTED.
I believe then the called program can test the address of a given parm for NULL or NOT NULL.
However, the parm-list of parms must be kept in the same order.
Give it a try....
Bill |
|
Back to top |
|
|
|