Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to pass data from batch pgm to online pgm?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: How to pass data from batch pgm to online pgm?
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: 8201
Location: Dubuque, Iowa, USA

PostPosted: Mon May 16, 2011 6:00 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: How to pass data from batch pgm to online pgm?
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: 1002
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue May 17, 2011 1:35 pm    Post subject:
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    Post subject:
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: 8201
Location: Dubuque, Iowa, USA

PostPosted: Tue May 17, 2011 4:27 pm    Post subject:
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: 1002
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue May 17, 2011 4:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CA Intertest Batch 555shanth CA Products 0 Tue Nov 28, 2017 11:10 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us