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

Mapping of data passed between programs


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

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Fri May 04, 2007 8:00 pm
Reply with quote

Let me put my query by an example:

Program A
=======

01 VAR-A1 PIC X(30).
01 VAR-A2 PIC X(30).
01 VAR-A3 PIC X(30).
01 VAR-B PIC X(10).
01 VAR-C PIC X(10).

CALL 'PROGRAM B' USING VAR-A1,
VAR-A2,
VAR-A3,
VAR-B,
VAR-C.

Program B
=======

01 VAR-A PIC X(30).
01 VAR-B PIC X(10).
01 VAR-C PIC X(10).

PROCEDURE DIVISION USING VAR-A,
VAR-B,
VAR-C.

In such a situation, Will the VAR-B and VAR-C get the same values passed from Program-A?
And how does this match and works?
I am not getting any error and the program is running fine.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri May 04, 2007 8:18 pm
Reply with quote

Nagendran wrote:
In such a situation, Will the VAR-B and VAR-C get the same values passed from Program-A?
And how does this match and works?
I am not getting any error and the program is running fine.
In progb, var-b is looking at the first 10 bytes of var-a2 and var-c is looking at the first 10 bytes of var-a3. Progb has no (simple) access to proga's var-b or var-c.
Is this what you wanted?
Back to top
View user's profile Send private message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Fri May 04, 2007 8:41 pm
Reply with quote

Are you telling this because it is a CALL BY REFERENCE?

Okie...

In my case, i ran my program and in it VAR-A of Program B takes any one (depending on some logic) VAR-A1 or VAR-A2 or VAR-a3 of Program A, and VAR-B of Program B taking exactly VAR-B of Program A, and VAR-C of Program B is taking exactly VAR-C of Program A.

Could comment on this?

Both of my programs are IMS programs and the VAR-A* are PCB's actually.
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 May 04, 2007 9:01 pm
Reply with quote

Hello,

It is a very good practice to ensure that the calling code and the called code have the same "parameter" definition.

Keep in mind that the field names are not used when the call is issued at execution (the compiler needs field names, but the execution does not), using the same field names in both modules is for programmers to more readily understand not the computer.

Please let us know if you have questions.
Back to top
View user's profile Send private message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Fri May 04, 2007 9:37 pm
Reply with quote

Dick,

You are absolutely right.

During my execution time, i got it like how i explained in the previous posting. I just wanted to reason it out.
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: Sat May 05, 2007 12:05 am
Reply with quote

That's one of the reasons we're here icon_smile.gif

See you another time,
Back to top
View user's profile Send private message
Nagendran

New User


Joined: 24 Jan 2007
Posts: 89
Location: USA

PostPosted: Sat May 05, 2007 12:30 am
Reply with quote

very kind of you.... :D
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top