View previous topic :: View next topic
|
Author |
Message |
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi All,
The online program (PROG A) gets initiated when transaction is entered in CICS screen.
Then from this online program, it calls another online COBOL program PROG B to process the data and populate the data in variables. The PROG B will write the processed data to VSAM file using third online program PROG C and then comes back to PROG B. Then the values populated in variables is transferred back from PROG B to PROG A. The concern here is that, data is not passed from PROG B to PROG A. While the control comes back from PROG B to PROG A, all the populated data in the variables is lost.
Code: |
PROG A
CALL WS-PROG-B USING DFHEIBLK
WS-DUMMY-DFHCOMMAREA
WS-TEST-DATA.
------------------------------------------------------------------------------
PROG B
Linkage Section.
01 WS-TEST-DATA PIC X(100).
Procedure Division Using DFHEIBLK
DFHCOMMAREA
WS-TEST-DATA
<Populates data in variables in WS-TEST-DATA and then to WS-WRITE-REC and then calls Program C to write the populated data to VSAM file>
CALL WS-PROG-C USING DFHEIBLK
DFHCOMMAREA
WS-WRITE-REC.
GOBACK <== Data gets lost from WS-TEST-DATA at this statement |
All the 3 programs are declared as Online programs and calls are dynamic.
Could you please let me know if I am missing something here. WS-TEST-DATA becomes spaces once it is passed back from PROG B to PROG A
Thanks
Vinu |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Why is there GOBACK in a CICS program ? Shouldnt you be using EXEC CICS RETURN ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Binop, GOBACK is supported in CICS COBOL programs, in particular when a COBOL CALL is used instead of EXEC CICS LINK. There's no problem with the GOBACK. |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi Binoop,
PROG A is initiated from online transaction and it has EXECS CICS RETURN.
PROG B just gets the value from PROG A, processes it and has no CICS calls in it and so has GOBACK. Then it calls PROG C that will write to online VSAM file.
PROG C has CICS call i.,e it writes data to online VSAM file and it has GOBACK.
I am still wondering whether PROG B should be saved as Batch sub program but since it calls PROG C and has DFH commands, I have declared it as online program. Please advice whether that may be the problem
Currently all programs are declared as online programs.
Thanks
Vinu |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Robert Sample wrote: |
Binop, GOBACK is supported in CICS COBOL programs, in particular when a COBOL CALL is used instead of EXEC CICS LINK. There's no problem with the GOBACK. |
My bad... Apologies to Robert and Vinu... Not sure what I was thinking... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
vinu78, where is WS-WRITE-REC defined in your Program B? I suspect part of your problem is the lack of consistency between the various CALL statements. |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi Robert,
Data is not lost when PROG C is called (I am able to write the data to VSAM file) and also when the control comes back from PROG C to PROG B. Only when it goes back from PROG B to PROG A (when it hits GOBACK), whatever data that gets created in PROG B is lost. But interesting thing is whatever data that was initially in WS-TEST-DATA remains intact eventhough it comes back to PROG A.
Code: |
PROGRAM B
WORKING-STORAGE SECTION.
01 WS-WRITE-REC PIC X(30).
LINKAGE SECTION.
01 WS-TEST-DATA PIC X(100).
Procedure Division Using DFHEIBLK
DFHCOMMAREA
WS-TEST-DATA
<Populates data to some of variables in WS-TEST-DATA and moves some of the values from WS-TEST-DATA to WS-WRITE-REC>
CALL WS-PROG-C USING DFHEIBLK
DFHCOMMAREA
WS-WRITE-REC.
GOBACK |
Thanks
Vinu |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
When PROG C returns to PROG B, are you moving WS-WRITE-REC to WS-TEST-DATA? Is WS-WRITE-REC defined to LINKAGE or WS in PROG C? Just a suggestion, but to programmatically separate LINKAGE and WS fields, LINKAGE fields should have a distinguishing prefix, such as LS. It will make things easier for the next person. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
What data is being "lost" in program B -- LINKAGE SECTION, WORKING-STORAGE SECTION, or common data?
How do you know the data in program B is "lost" when you return to program A?
Why is it important for the data in program B to not be "lost" to program A?
Is there an INITIAL clause in program B or a CANCEL statement in program A?
Since you are talking dynamic calls and CICS programs, it is usual, normal, and expected behavior for the WORKING-STORAGE SECTION of program B to not be available when the GOBACK in program B is executed. Any data you want program A to be able to access must be in the argument list of the CALL and be allocated storage in program A, not in program B. |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Bob,
Initially I have declared as LS- in linkage section as you have mentioned. But it also was not working. Hence I have placed the same variables as in PROG A.
In prog B, I am populating WS-WRITE-REC from WS-TEST-DATA and then calls PROG -C using WS-WRITE-REC (that is declared in working storage section.
In PROG C, WS-WRITE -REC is declared in Working storage section and another variable similar to that named as LS-WRITE-REC is declared in Linkage section.
Code: |
PROGRAM C
WS section
10 WS-WRITE-REC PIC X(30).
Linkage Section.
01 LS-WRITE-REC PIC X(30).
Procedure Division USing DFHEIBLK
DFHCOMMAREA
LS-WRITE-REC
Move LS-WRITE-REC to WS-WRITE-REC\
EXEC CICS WRITE to VSAM from WS-WRITE-REC
Move WS-WRITE-REC to LS-WRITE-REC
GOBACK |
|
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Robert,
From Program A, I am getting the data to be written to VSAM file. So the raw data reaches Program B, then it is formatted as per VSAM file layout , splits a single record to 2 or 3 records and we will assign the Seq number to each record. So when I come back to Program A to read the next record, I should not lose the Sequence number that was calculated before.
When the control comes back from PROG B to A, I am losing the linkage section data that was calculated in PROG B.
LINKAGE SECTION
01 WS-TEST-DATA
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3
05 FILLER PIC X(18).
I am populating the value 0002 to WS-SEQ-NO in PROG B but when it comes back to PROG A, it is coming as ????. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Prog A:
Code: |
01 WS-TEST-DATA.
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(18).
PROCEDURE DIVISION.
0000-START.
MOVE SPACES TO WS-TEST-DATA.
MOVE ZERO TO WS-SEQ-NO.
DISPLAY 'PROG A WS-ACCT >' WS-ACCT '<'.
DISPLAY 'PROG A WS-SEQ-NO>' WS-SEQ-NO '<'.
CALL WS-PROG-B
USING DFHEIBLK
DFHCOMMAREA
WS-TEST-DATA.
DISPLAY 'PROG A WS-ACCT >' WS-ACCT '<'.
DISPLAY 'PROG A WS-SEQ-NO>' WS-SEQ-NO '<'.
STOP RUN. |
Prog B:
Code: |
01 WS-TEST-DATA.
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(18).
LINKAGE SECTION.
01 DFHEIBLK PIC X(01).
01 DFHCOMMAREA PIC X(01).
01 LS-TEST-DATA.
05 LS-ACCT PIC X(9).
05 LS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(18).
PROCEDURE DIVISION USING DFHEIBLK
DFHCOMMAREA
LS-TEST-DATA.
0000-START.
MOVE 'AAAAAAAAA' TO LS-ACCT.
MOVE +54321 TO LS-SEQ-NO.
DISPLAY 'PROG B WS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG B WS-SEQ-NO>' LS-SEQ-NO '<'.
CALL WS-PROG-C
USING DFHEIBLK
DFHCOMMAREA
LS-TEST-DATA.
MOVE '123456789' TO LS-ACCT.
MOVE +2 TO LS-SEQ-NO.
DISPLAY 'PROG B WS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG B WS-SEQ-NO>' LS-SEQ-NO '<'.
GOBACK. |
Prog C:
Code: |
01 WS-TEST-DATA.
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(18).
LINKAGE SECTION.
01 DFHEIBLK PIC X(01).
01 DFHCOMMAREA PIC X(01).
01 LS-TEST-DATA.
05 LS-ACCT PIC X(9).
05 LS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(18).
PROCEDURE DIVISION USING DFHEIBLK
DFHCOMMAREA
LS-TEST-DATA.
0000-START.
MOVE '987654321' TO LS-ACCT.
MOVE -99 TO LS-SEQ-NO.
DISPLAY 'PROG C WS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG C WS-SEQ-NO>' LS-SEQ-NO '<'.
GOBACK. |
produces normal and expected results of
Code: |
PROG A WS-ACCT > <
PROG A WS-SEQ-NO>00000<
PROG B WS-ACCT >AAAAAAAAA<
PROG B WS-SEQ-NO>54321<
PROG C WS-ACCT >987654321<
PROG C WS-SEQ-NO>0009R<
PROG B WS-ACCT >123456789<
PROG B WS-SEQ-NO>00002<
PROG A WS-ACCT >123456789<
PROG A WS-SEQ-NO>00002< |
I suspect you've messed up your LINKAGE SECTION and WORKING-STORAGE SECTION variables somewhere along the way. |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Thanks Robert for the detailed code.
I made use of your appoach but still missing somthing. Please see the Program A and B code as mentioned below
Prog A
Code: |
WORKING STORAGE
01 WS-TEST-DATA.
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(88).
PROCEDURE DIVISION.
0000-START.
MOVE SPACES TO WS-TEST-DATA.
MOVE 123456789 TO WS-ACCT
MOVE ZERO TO WS-SEQ-NO.
DISPLAY 'PROG A WS-ACCT >' WS-ACCT '<'.
DISPLAY 'PROG A WS-SEQ-NO>' WS-SEQ-NO '<'.
CALL WS-PROG-B
USING DFHEIBLK
DFHCOMMAREA
WS-TEST-DATA.
DISPLAY 'PROG A WS-ACCT >' WS-ACCT '<'.
DISPLAY 'PROG A WS-SEQ-NO>' WS-SEQ-NO '<'.
STOP RUN. |
Prog B
Code: |
Working Storage.
01 WS-TEST-DATA.
05 WS-ACCT PIC X(9).
05 WS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(88).
01 WS-WRITE-REC PIC X(30).
LINKAGE SECTION.
01 DFHEIBLK PIC X(01).
01 DFHCOMMAREA PIC X(01).
01 LS-TEST-DATA.
05 LS-ACCT PIC X(9).
05 LS-SEQ-NO PIC S9(5) COMP-3.
05 FILLER PIC X(88).
PROCEDURE DIVISION USING DFHEIBLK
DFHCOMMAREA
LS-TEST-DATA.
0000-START.
MOVE LS-TEST-DATA TO WS-TEST-DATA
ADD 1 TO WS-SEQ-NO.
Some processes to MQ-WORK variables
DISPLAY 'PROG B WS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG B WS-SEQ-NO>' LS-SEQ-NO '<'.
CALL WS-PROG-C
USING DFHEIBLK
DFHCOMMAREA
WS-WRITE-REC
DISPLAY 'PROG B WS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG B WS-SEQ-NO >' WS-SEQ-NO '<'.
DISPLAY 'PROG B LS-SEQ-NO >' LS-SEQ-NO '<'.
MOVE WS-TEST-DATA TO LS-TEST-DATA.
DISPLAY 'PROG B LS-ACCT >' LS-ACCT '<'.
DISPLAY 'PROG B LS-SEQ-NO >' LS-SEQ-NO '<'.
GOBACK. |
Display
Code: |
Prog A WS-ACCT - 123456789
Prog A WS-SEQ-NO - 0000
Prog B WS-ACCT - 123456789
Prog B WS-SEQ-NO - 0001
Prog B WS-ACCT - 123456789
Prog B WS-SEQ-NO - 0001
Prog B LS-SEQ-NO - 0000
Prog B LS-ACCT - 123456789
Prog B LS-SEQ-NO - 0001
At the GOBACK statement in Prog B, I can see following values as below
LS-ACCT became SPACES
LS-SEQ-NO became ?????
WS-ACCT has 123456789
WS-SEQ-NO has 0001
Once the control reaches PROGRAM A,
Prog A WS-ACCT -
Prog A WS-SEQ-NO - ???? |
I am wondering why the data is not passed. I have declared all these 3 programs as online.
Thanks
Vinu |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Vinu,
I dont think what you posted last is exactly what you have tested...
How is it that value of LS-SEQ-NO in ProgB displayed as 0001 when LS-SEQ-NO is never changed.
Your actual output and DISPLAY statements formats also doesn't match... |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Hi Binop,
Initially while entering PROG B, the variable LS-SEQ-NO has value 0000. Then we have moved its values to WS-SEQ-NO and then incremented +1 and so WS-SEQ-NO value becomes 0001. Then the below statement moves the values WS-SEQ-NO to LS-SEQ-NO and so LS-SEQ-NO got the value 0001.
MOVE WS-TEST-DATA TO LS-TEST-DATA
Thanks
Vinu |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
vinu78 wrote: |
Hi Binop,
Initially while entering PROG B, the variable LS-SEQ-NO has value 0000. Then we have moved its values to WS-SEQ-NO and then incremented +1 and so WS-SEQ-NO value becomes 0001. Then the below statement moves the values WS-SEQ-NO to LS-SEQ-NO and so LS-SEQ-NO got the value 0001.
MOVE WS-TEST-DATA TO LS-TEST-DATA
Thanks
Vinu |
I meant with respect to your first display of LS-SEQ-NO - your fifth statement in the 0000-START paragraph of Prog B --- before the MOVE is actually done --- before Prog C is called ... |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Sorry Binop. You are right. It was a typo error from my side.
The value of WS-SEQ-NO (second display of Program B) is 0000
Thanks
Vinu |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
vinu78 wrote: |
Sorry Binop. You are right. It was a typo error from my side.
The value of WS-SEQ-NO (second display of Program B) is 0000
Thanks
Vinu |
You are missing the point... Looking at your code - it looks like you have posted some statements from Roberts code but provided your output...
It would be really helpful, for you and the experts here, if you can just provide your test program (not any proprietary code) and the actual output... |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Sorry again. I got your point. Since it is a big module, I am just putting the impacted area alone.
My only concern is that when value is passed back from PROG B to PROG A, it is getting lost. I am wondering whether it is because PROG B is declared as online eventhough it doesn't contain any CICS statements.(I am not sure).
Thanks
Chidam |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Vinu,
vinu98 wrote: |
My only concern is that when value is passed back from PROG B to PROG A, it is getting lost. |
As Robert has already illustrated - if coded properly no data will be lost.
vinu98 wrote: |
I am wondering whether it is because PROG B is declared as online eventhough it doesn't contain any CICS statements.(I am not sure). |
From my experience, I dont think there is any issue like that... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
I am wondering whether it is because PROG B is declared as online eventhough it doesn't contain any CICS statements.(I am not sure). |
I've not heard of this being an issue before. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Are you showing the PROCEDURE DIVISION USING ... from the source programs or the compile listings? Can you check the listings please? |
|
Back to top |
|
|
vinu78
Active User
Joined: 02 Oct 2008 Posts: 179 Location: India
|
|
|
|
Bill,
Please see the PROCEDURE DIVISION USING that is used in the modules
PROGRAM A
Code: |
WORKING STORAGE SECTION.
05 WS-DUMMY-DFHCOMMAREA PIC X VALUE SPACES.
05 WS-TEST-DATA PIC X(100).
PROCEDURE DIVISION.
CALL PROGRAM-B USING DFHEIBLK
WS-DUMMY-DFHCOMMAREA
WS-TEST-DATA
|
PROGRAM B
Code: |
WORKING STORAGE SECTION
01 WS-TEST-DATA PIC X(100).
LINKAGE SECTION.
01 DFHCOMMAREA PIC X(01).
01 LS-TEST-DATA PIC X(100).
PROCEDURE DIVISION USING DFHEIBLK
DFHCOMMAREA
LS-TEST-DATA
<processes data and calls Program C and control comes back here>
GOBACK
|
|
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Good day to all!
Vinu78, make your WS-TEST-DATA a LINKAGE SECTION variable in PROG A. Remember that WORKING-STORAGE variable could be pass to PROG B but if PROG B manipulate those variable it is done in B and not in A. I am confuse why are you using WS-DUMMY-DFHCOMMAREA I some cases then DFHCOMMAREA in others. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Jose,
If the PROGA field is in Linkage, where does the storage for it come from?
What do you mean if the manipulations are done in PROGB it only affects PROGB, not PROGA?
The "name" of something does not matter. It is that USINGS "line up" with the data that is being expected.
Vinu78,
How do you get ????? for the DISPLAY of the packed-decimal? Is this output from a DISPLAY, or from a debugger or something? |
|
Back to top |
|
|
|