View previous topic :: View next topic
|
Author |
Message |
Nagendran
New User
Joined: 24 Jan 2007 Posts: 89 Location: USA
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Nagendran
New User
Joined: 24 Jan 2007 Posts: 89 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Nagendran
New User
Joined: 24 Jan 2007 Posts: 89 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
That's one of the reasons we're here
See you another time, |
|
Back to top |
|
|
Nagendran
New User
Joined: 24 Jan 2007 Posts: 89 Location: USA
|
|
|
|
very kind of you.... :D |
|
Back to top |
|
|
|