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

Passing values from called pgm and through parm


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

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Fri Feb 06, 2009 2:14 pm
Reply with quote

Hi,

i have one doubt..I have one called pgm A which some pgm is calling say B. can i pass the values from Parm to pgm A as well as pass other values from a to B.

Basically i want to know if we can simultaniously pass value from parm to pgm A which is a called one and pass value from A to B(calling Pgm)

regards,
rupesh gupta
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Feb 06, 2009 2:17 pm
Reply with quote

Yes.
Back to top
View user's profile Send private message
rupesh gullu

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Fri Feb 06, 2009 3:26 pm
Reply with quote

hi Gnanas,

when we quote procedure division using ws-parm,
var1,
var2.

ws-parm is linkage area for JCL passed from parm and var1,var2 are to be passed to pgm B.

Is ordering of variables not an issue. In main pgm B you have only var1 and var 2 so how data will pass to B. I am getting little confused. can you please explain.

regards,
rupesh gupta
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Feb 06, 2009 3:43 pm
Reply with quote

Hi,

At the top of this page, there is link to Manuals, browse through COBOL manual on CALL Statement...
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: Fri Feb 06, 2009 4:19 pm
Reply with quote

PROCEDURE DIVISION USING variables are only those variables being passed to the program. They are NOT the variables you are passing to another program. So in your example, you would NOT put var1, var2 in the program A PROCEDURE DIVISION USING statement. You would say in program A
Code:
CALL PGMB USING WS-PARM,
                VAR1,
                VAR2.
and program B will have
Code:
PROCEDURE DIVISION USING A, B, C
where A, B, C are names in the LINKAGE SECTION of program B. There is no name congruence between the names of the parameters being passed in program A and the argument names used in program B -- you can call them anything you want.
Back to top
View user's profile Send private message
rupesh gullu

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Fri Feb 06, 2009 5:00 pm
Reply with quote

i got it robert ..thanks,

regards,
rupesh gupta
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Fri Feb 06, 2009 10:18 pm
Reply with quote

Thats a very good explanation Robert.

You made it very simple.
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: Fri Feb 06, 2009 10:32 pm
Reply with quote

Thanks Diwakar ... guess those years of teaching university classes taught me something, after all!
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL EXEC PARM data in C Java & MQSeries 2
No new posts Need to specify PARM='POSIX(ON) Java & MQSeries 4
No new posts How to pass the PARM value to my targ... COBOL Programming 8
Search our Forums:

Back to Top