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

How to pass data from batch pgm to online pgm?


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rocksolid

New User


Joined: 29 Aug 2006
Posts: 21
Location: India

PostPosted: Mon May 16, 2011 5:36 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon May 16, 2011 6:00 pm
Reply with quote

Are you using EXCI or FEPI or what for the interface?
Back to top
View user's profile Send private message
rocksolid

New User


Joined: 29 Aug 2006
Posts: 21
Location: India

PostPosted: Tue May 17, 2011 8:53 am
Reply with quote

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
View user's profile Send private message
rocksolid

New User


Joined: 29 Aug 2006
Posts: 21
Location: India

PostPosted: Tue May 17, 2011 12:14 pm
Reply with quote

Hi Robert,

I have verified in "Translator Listing Output" and it is 'NOFEPI' for both batch and online programs.

Thank you.
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Tue May 17, 2011 1:32 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue May 17, 2011 1:35 pm
Reply with quote

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
View user's profile Send private message
rocksolid

New User


Joined: 29 Aug 2006
Posts: 21
Location: India

PostPosted: Tue May 17, 2011 2:13 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 17, 2011 4:27 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue May 17, 2011 4:40 pm
Reply with quote

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
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts SCOPE PENDING option -check data DB2 2
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top