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

Same CICS Module for Batch and Online


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

New User


Joined: 09 May 2005
Posts: 37
Location: bangalore

PostPosted: Thu Jan 10, 2008 3:35 pm
Reply with quote

Hi all,

Recently in an interview i was asked this question that what changes you will make to a CICS Module (Program) if you want it to use both in Batch and online.

Please provide me an answer for this.

Regards
MKP
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Jan 10, 2008 6:31 pm
Reply with quote

We have a program that has no changes between the CICS and batch module. I wrote it an got it into the loadlib and it works for both CICS and batch without any "changes".

But you would have to get rid of all the EXEC CICS commands if it was a CICS program initially.
Back to top
View user's profile Send private message
manikant pathak

New User


Joined: 09 May 2005
Posts: 37
Location: bangalore

PostPosted: Thu Jan 10, 2008 7:05 pm
Reply with quote

Steve,

If we are removing EXEC CICS Commands from the program how we will code CICS commands that can be used during onlines?

If security concerns are not there can you please post few lines of your code here?

~MKP
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Jan 10, 2008 7:24 pm
Reply with quote

The code won't make any sense. It is a called program that both a batch and CICS program can call. The CICS transaction is all background and requires no user interaction.
Back to top
View user's profile Send private message
manikant pathak

New User


Joined: 09 May 2005
Posts: 37
Location: bangalore

PostPosted: Thu Jan 10, 2008 7:27 pm
Reply with quote

Thanks Steve!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Jan 10, 2008 9:28 pm
Reply with quote

We have routines that are used both in Batch and CICS.
The rules are:
- routines must be CALLed (no XCTL or LINK).
- it must be a dynamic call (CALL WS-ROUTINE-NAME not CALL 'routine')
- in Endevor we have a special Processor Group for these routines.
- A batch program calling a "dual" routine must provide a dummy DFHEIBLK containing all low-values (1st parameter is the DFHEIBLK).
- the routine must check the received DFHEIBLK to detect if it is running under CICS or in Batch.
Back to top
View user's profile Send private message
harikiran2001

New User


Joined: 02 Jan 2008
Posts: 4
Location: bang

PostPosted: Thu Jan 24, 2008 7:47 pm
Reply with quote

I guess if the program which is called statically , then we can have entry LINKONL member so that it could be called from an online progam and LINKBAT member so that it can be called from a Batch program.

Please correct me if i am wrong.
Back to top
View user's profile Send private message
rag swain

New User


Joined: 17 Dec 2007
Posts: 33
Location: pune,INDIA

PostPosted: Thu Jan 24, 2008 8:58 pm
Reply with quote

Also you can use

#IFDEF BATCH
Blah. Blah.
#END-IF

#IFDEF CICS
Blah..blah..
#END-IF
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 24, 2008 10:01 pm
Reply with quote

A shared program for both Batch and CICS is entirely possible and you can add programmatic intelligence.

The program would be compiled as a normal "Batch" program, without running it through the translator.

But, you can copy "DFHEIBLK" into LINKAGE as well as define (hard-code) a DFHCOMMAREA with a length of 32763, which is the maximum.

LINKAGE items do NOT take up any space as they are akin to Assembler DSECTS.

At the very start of the program, call the following ASSEMBLER sub-program, without a parameter. When you Assemble this, you must concatenate the CICS SDFHMAC library for SYSLIB, because the DFHAFCD and DFHREGS Macros are in this library.

Code:

RUNENV   CSECT                                                           
         USING *,R12               INFORM ASSEMBLER                       
         SAVE (14,12)              SAVE REGISTERS                         
         LA    R12,0(,R15)         R12 IS BASE                           
         DFHAFCD TYPE=LOCATE       AFCB-ADDRESSABILITY (DEFAULT=R15)     
         LTR   R15,R15             BATCH ENVIRONMENT?                     
         BZ    RTN2CLLR            YES, RETURN TO CALLER                 
         CLC   =C'AFC',0(R15)      CICS ENVIRONMENT?                     
         LA    R15,16              LOAD NON-ZERO VALUE FOR CICS           
         BE    RTN2CLLR            YES, RETURN TO CALLER                 
         SLR   R15,R15             RESET TO ZERO FOR BATCH               
RTN2CLLR EQU   *                                                         
         RETURN (14,12),RC=(15)    RESTORE AND RETURN TO CALLER           
         LTORG ,                   BEGIN LITERAL POOL                     
         DFHREGS                   CICS REGISTER-EQUATE MACRO             
         END   ,                   END 'RUNENV'                           


Upon return, check the RETURN-CODE Special-Register value. For Batch, it will equal ZERO. Otherwise, the environment is CICS. Define and set a field in WS for subsequent checking of the run-environment later in the program logic based upon this value.

Now that you know the environment and if you need EIB addressability, write a simple COBOL/CICS sub-program which you CALL and it issues an ADDRESS EIB and COMMAREA command followed by a GOBACK. To "fake out" this sub-program, define a single field in WS, such as "WS-DUMMY" PIC X(01) VALUE LOW-VALUE and use this field as the first and second parameter, followed by a third and fourth parameter, which are WS "POINTER's". All you're doing is satisfying the addressability of DFHEIBLK and DFHCOMMAREA in the sub-program with WS-DUMMY as a placeholder.

The sub-program will issue an ADDRESS EIB and COMMAREA, using the POINTER values which you passed as the third and fourth parameters.

After returning to the caller, set the ADDRESS OF DFHEIBLK to the POINTER and you now have EIB addressability.

If EIBCALEN is less than 1, then set the ADDRESS OF DFHCOMMAREA TO NULL in the calling program. Otherwise, set this address to the POINTER value which was set in the sub-program. Then, move EIBCALEN to a WS field and use this as your length portion for REFERENCE MODIFICATION of DFHCOMMAREA.

HTH....

Regards,

Bill
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 Using API Gateway from CICS program CICS 0
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
Search our Forums:

Back to Top