Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Number of parameters in CALLING PROGRAM & CALLED PROGRAM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Thu Dec 09, 2010 10:36 am    Post subject: Number of parameters in CALLING PROGRAM & CALLED PROGRAM
Reply with quote

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
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Dec 09, 2010 10:43 am    Post subject:
Reply with quote

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
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Thu Dec 09, 2010 10:53 am    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Thu Dec 09, 2010 3:47 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Dec 09, 2010 8:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Mariraj

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Fri Dec 10, 2010 8:31 pm    Post subject:
Reply with quote

Thanks for your explanation.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Dec 10, 2010 8:50 pm    Post subject: Reply to: Number of parameters in CALLING PROGRAM & CALL
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us