View previous topic :: View next topic |
Author |
Message |
vijaysridharan Beginner
Joined: 05 Feb 2003 Posts: 2 Topics: 2
|
Posted: Thu Feb 06, 2003 3:46 am Post subject: Pointers in Cobol--- Pl. clarify |
|
|
I have a driver cobol program 'A' which calls cobol program 'B'.
I use pointers in my pgms. I would appreciate if any of you can suggest me as to how I pass values to pgm 'B' ,
after reading the segments of 'B' & 'A' below
_____________________________________________________________
Program 'B'
Linkage section.
01 AF9555M0-PASS-AREA.
++INCLUDE AF9555BP1C
++INCLUDE AF9555BI1C
++INCLUDE AF9555BR1C
01 DRIS-POINTER-AREA.
++INCLUDE GR02038C
01 DRIS-NULL-POINTER-AREA.
++INCLUDE GR02038C
I have set the address of DRIS-POINTER-AREA & DRIS-NULL-POINTER-AREA to the POINTER variables which are part of the copy book AF9555BI1C in the linkage section. This is described below.
PROCEDURE DIVISION
SET ADDRESS OF DRIS-POINTER-AREA TO DRIS-AREA-PTR-AF9555BI1C
SET ADDRESS OF DRIS-NULL-POINTER-AREA TO DRIS-NULL-AREA-PTR-AF9555BI1C.
Next I am doing computation
DISPLAY "VALUE IS ", EL19412-GR02038 OF DRIS-POINTER-AREA
IF EL19412-GR02038 OF DRIS-POINTER-AREA =
EL19412-GR02038 OF DRIS-NULL-POINTER-AREA
COMPUTE EL00172-INT-NET-VAL-AF9555BR1C =
ZERO-IOL-CONST - EL28883-GR02038 OF DRIS-POINTER-
AREA
ELSE
COMPUTE EL00172-INT-NET-VAL-AF9555BR1C =
EL19412-GR02038 OF DRIS-POINTER-AREA -
EL28883-GR02038 OF DRIS-POINTER-AREA.
_____________________________________________________________
Now I have mentioned segment of Program 'A'
*************************************************************
Program 'A'
WORKING-STORAGE SECTION.
01 AF9555M0-COMM-AREA.
++INCLUDE AF9555BP1C
++INCLUDE AF9555BI1C
++INCLUDE AF9555BR1C
01 DRIS-POINTER-AREA.
++INCLUDE GR02038C
01 DRIS-NULL-POINTER-AREA.
++INCLUDE GR02038C
PROCEDURE DIVISION
INITIALIZE GR02038 OF DRIS-POINTER-AREA.
INITIALIZE GR02038 OF DRIS-NULL-POINTER-AREA.
MOVE 599989 TO EL19412-GR02038 OF DRIS-POINTER-AREA
DISPLAY "Value is", EL19412-GR02038 OF DRIS-POINTER-AREA
MOVE 189778 TO
EL19412-GR02038 OF DRIS-NULL-POINTER-AREA
MOVE 289623 TO EL28883-GR02038 OF DRIS-POINTER-AREA
CALL 'B' USING AF9555M0-COMM-AREA
DRIS-POINTER-AREA DRIS-NULL-POINTER-AREA.
*************************************************************
Issue:
1)When I move 599989 to EL19412-GR02038 OF DRIS-POINTER-AREA as mentioned above & then display the values, the display values are properly reflected in the pgm 'A'. After calling pgm 'B' with parameters as mentioned above, when I try to display the value of the same variable in pgm 'B' it shows zero.
I dont know why this happens. I havent used any pointers in pgm 'A' but only in pgm 'B'. Do I need to use pointers in pgm 'A' to set right this problem.
Pl. NOTE that the copy book GR02038C has been included in DRIS-POINTER-AREA as well as DRIS-NULL-POINTER-AREA.
I would appreciate help from anyone in resolving this issue.
Thanks & Cheers.
[/b] |
|
Back to top |
|
|
nudnikit Beginner
Joined: 07 Jan 2003 Posts: 2 Topics: 0
|
Posted: Thu Feb 06, 2003 12:04 pm Post subject: |
|
|
Vijay,
Could you explain why you use pointers in B? The call from A to B passes the addresses of DRIS-POINTER-AREA and DRIS-NULL-POINTER-AREA already. So why fiddle with them?
BTW - Did you include these 3 linkfields in your PROCEDURE DIVISION statement?
nudnikit |
|
Back to top |
|
|
|
|