IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Number of parameters in CALLING PROGRAM & CALLED PROGRAM


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Dec 09, 2010 10:43 am
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
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Dec 09, 2010 3:47 pm
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
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Dec 10, 2010 8:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top