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

No of Variables in Calling and Called Programs


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Wed Aug 08, 2007 8:57 pm
Reply with quote

Hi,

Is that mandatory that no of variables passed from Calling to Called Program should be equal.

Is this criteria apply to both Static as well as Dynamic Calls.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 08, 2007 9:04 pm
Reply with quote

not only the number, but their position in the USING phrase is also important. It seems that you have not bothered to read the documentation. Links to appropriate language manuals are at the top of this page.
Back to top
View user's profile Send private message
rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Wed Aug 08, 2007 9:31 pm
Reply with quote

I think position is not important...... only the no matters.

Say

Pgm A:

Call B using 1,2,3

Pgm B:

Procedure division using 2,1,3

This will work....

Here we are refrencing the allocated memory locations
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Aug 08, 2007 10:00 pm
Reply with quote

rajaherein wrote:
I think position is not important...... only the no matters.
Say
Pgm A:
Call B using 1,2,3
Pgm B:
Procedure division using 2,1,3

This will work....
Here we are refrencing the allocated memory locations
Wrong answer, if Pgm B is expecting the data area that Pgm A refers to as 1 to be in the second location, it will fail.
Besides, the number of items is not as critical, only the reference to items that do not exist.
Back to top
View user's profile Send private message
rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Thu Aug 09, 2007 11:02 am
Reply with quote

Hi William,

Per your suggestions, the length of data area is important rather than numbers.

Please advice.
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: Fri Aug 10, 2007 12:05 am
Reply with quote

Hello,

Position in the parameter sequence is critical as well as the definition of the parameter at each position. What may not be critical is if a called module is set up to handle 5 parameters and only the first 3 are used in a particular call. If the called module does not refer to parameter4 and parameter5, there should be no problem. This is sometimes seen when some sort of "service" module is called that can support a variety of functions and they do not all require all of the parameters. Typically, the first parameter has info that tells the callee what is being requested.

My preference is that the caller and the callee have the same definitions.
Back to top
View user's profile Send private message
rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Fri Aug 10, 2007 10:40 am
Reply with quote

Hi Dick,

Thanks for your advice.

According to my observations, when the Called module has 5 parameters and Calling module has 3 parameters, then S0C4 occurs.

Correct me if i am wrong.
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: Fri Aug 10, 2007 6:27 pm
Reply with quote

Hello Raj,

Yes. Typically, that happens when the called module tries to use the 2 parameters that were not passed. As i mentioned
Quote:
If the called module does not refer to parameter4 and parameter5, there should be no problem.

if the called module has 5 parameters and the caller only sends 3, the called module must have a way to know which parameters were used and ensure that parameters 4&5 are not used in that invocation.
Quote:
Typically, the first parameter has info that tells the callee what is being requested


Please let me know if i've not been clear.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Aug 10, 2007 6:45 pm
Reply with quote

Does standard linkage in the current COBOL still set the high bit to 1 on the last passed address?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 10, 2007 7:06 pm
Reply with quote

icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif have you checked? icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif icon_lol.gif
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: Fri Aug 10, 2007 8:43 pm
Reply with quote

Ouch icon_lol.gif

Or as kids in my old neighborhood would chant, "Nyah Nyah Nyah, Ny Nyahh Nyahh". . . .
Back to top
View user's profile Send private message
rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Thu Aug 16, 2007 1:16 pm
Reply with quote

Hello Dick,

Many Thanks, i got my doubts cleared by your comments.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 16, 2007 8:49 pm
Reply with quote

Quote:

Does standard linkage in the current COBOL still set the high bit to 1 on the last passed address?


It may, but all the object code that I have seen only generates setregs based on the USING list in the invoked modules PROCEDURE DIVISION statement. Since you can call with three and by called using only 2 - which will work and call with 3 and be called using 4 and receive a SOC4, I assume that the high-bit (if set) is never checked.
Back to top
View user's profile Send private message
ramfrom84

New User


Joined: 23 Aug 2006
Posts: 93
Location: chennai

PostPosted: Tue Aug 21, 2007 7:44 pm
Reply with quote

Say

Pgm A:

Call B using 1,2,3

Pgm B:

Procedure division using 1,2

This will work....
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 Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Calling an Open C library function in... CICS 1
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Passing Parameters to Programs Invoke... PL/I & Assembler 5
Search our Forums:

Back to Top