View previous topic :: View next topic
|
Author |
Message |
rocksolid
New User
Joined: 29 Aug 2006 Posts: 21 Location: India
|
|
|
|
Hi,
I have got a below problem and looking for help.
One online transaction (Cobol-CICS) is intiated and series of batch modules are executing in that flow.
Now I have to introduce a On-line module call from one of the batch modules in that flow.
I am using 'CALL' statement but unfortunately I am not getting the 'passing data' (CPY-B) into called module.
I am giving the imprtant code from the calling and called modules here:
Pgm-A (Calling)
.....
.....
Linkage Section.
01 ABCD-POINTER-RECORD.
COPY CPY-A.
01 CPYB-REC.
COPY CPY-B.
PROCEDURE DIVISION USING ABCD-POINTER-RECORD CPYB-REC.
....
....
MOVE 'PGM-B' TO CALL-MOD
CALL CALL-MOD USING CPYB-REC .....
.....
=======================================
Pgm-B (Called Online Module)
.....
.....
LINKAGE SECTION.
01 DFHCOMMAREA.
COPY CPY-B.
PROCEDURE DIVISION.
.....
.....
========================================
I guess, I am not dealing with DFHCOMMAREA in correct way. Please suggest.
Many Thanks in advance for your help. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Are you using EXCI or FEPI or what for the interface? |
|
Back to top |
|
|
rocksolid
New User
Joined: 29 Aug 2006 Posts: 21 Location: India
|
|
|
|
Hi Robert,
I am not sure about which option I am using. Could you please let me know, how & where can I check this option? (EXCI or FEPI).
Thank you. |
|
Back to top |
|
|
rocksolid
New User
Joined: 29 Aug 2006 Posts: 21 Location: India
|
|
|
|
Hi Robert,
I have verified in "Translator Listing Output" and it is 'NOFEPI' for both batch and online programs.
Thank you. |
|
Back to top |
|
|
Stefan
Active User
Joined: 12 Jan 2006 Posts: 110 Location: Germany
|
|
|
|
Check if PGM-B is really a CICS program and compiled with the correct JCL including a CICS precompiler. Otherwise your PROCEDURE DIVISION statement needs a USING clause as in your PGM-A, for example:
Code: |
LINKAGE SECTION.
01 DFHCOMMAREA.
COPY CPY-B.
PROCEDURE DIVISION USING DFHCOMMAREA. |
But when the second program is really a CICS program, you should know that CICS always invokes those programs by passing two paramaters, normally named DFHEIBLK and DFHCOMMAREA. To simulate this invocation within your PGM-A you have to pass also two level-01 group items to PGM-B to make CPY-B address available to it. Just use a dummy definition for the first argument, but keep in mind that the defined length has to be correct. You could get this length from the compile listing of any other CICS program in your shop. So change PGM-A to something similar as:
Code: |
Pgm-A (Calling)
Working Storareg Section.
01 WS-DUMMY-DFHEIBLK PIC X(???)
01 WS-CPYB-REC.
COPY CPY-B.
.....
Linkage Section.
01 ABCD-POINTER-RECORD.
COPY CPY-A.
01 CPYB-REC.
COPY CPY-B.
PROCEDURE DIVISION USING ABCD-POINTER-RECORD CPYB-REC.
....
....
MOVE 'PGM-B' TO CALL-MOD
MOVE CPYB-REC TO WS_CPYB-REC
CALL CALL-MOD USING WS_DUMMY_DFHEIBLK WS_CPYB-REC |
In addition I recommend to copy the received data from Linkage Section to corresponding group items in Working Storage Section. This is always good coding practice.
Hope this helps |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
Code: |
MOVE 'PGM-B' TO CALL-MOD
CALL CALL-MOD USING CPYB-REC .....
.....
=======================================
Pgm-B (Called Online Module)
.....
.....
LINKAGE SECTION.
01 DFHCOMMAREA.
COPY CPY-B.
PROCEDURE DIVISION.
|
|
I imagine that the called module (PGM-B) is expecting a parameter with the first pointer addressing a DFHCOMMAREA ? Your call is not providing one.
Garry. |
|
Back to top |
|
|
rocksolid
New User
Joined: 29 Aug 2006 Posts: 21 Location: India
|
|
|
|
Hi Stefan,
Thank you very much. I have got it.
As my online pgm is from different application, I cannot change it. So I have written a small online pgm to implement your concept and it is working fine.
In batch program no changes.
New On-line pgm: ......
LINKAGE SECTION.
01 CPYB-REC.
COPY CPY-B.
PROCEDURE DIVISION USING DFHEIBLK DFHCOMMAREA.
SET ADDRESS OF CPYB-REC TO ADDRESS OF DFHEIBLK
EXEC CICS LINK
PROGRAM ('Pgm-B')
COMMAREA (CPYB-REC)
LENGTH (LENGTH OF CPYB-REC)
END-EXEC
GOBACK
Thank you all. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Be aware that you MUST use an interface such as FEPI or EXCI to have batch programs and CICS programs interact. You cannot just set up the batch program to use DFHCOMMAREA, call the online program, and expect anything to happen. The interfaces -- FEPI or EXCI among them -- handle the many details of connecting a batch program running in its own address space with the CICS program running in the CICS region address space..
It may look easy, but in actuality it is a very difficult and challenging task to connect a batch program to a CICS program. Most interactions between batch and CICS are done via files, and even then there can be issues with buffer flushing and record locking. The reason for using files is that it is much easier than having the two program directly communicate. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
I suspect that the OP is combining programs separately compiled as CICS and Batch into a single online module. Perhaps another case where we are divided by a common language?
Garry. |
|
Back to top |
|
|
|