Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Passing values from called pgm and through parm

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Passing values from called pgm and through parm
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: 785
Location: Chennai, India

PostPosted: Fri Feb 06, 2009 2:17 pm    Post subject:
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    Post subject: Reply to: Passing values from called pgm and through parm
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

Senior Member


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

PostPosted: Fri Feb 06, 2009 3:43 pm    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Fri Feb 06, 2009 4:19 pm    Post subject:
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    Post subject: Reply to: Passing values from called pgm and through parm
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    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Fri Feb 06, 2009 10:32 pm    Post subject:
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    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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us