Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Same CICS Module for Batch and Online

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Same CICS Module for Batch and Online
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Thu Jan 10, 2008 9:28 pm    Post subject:
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    Post subject: Reply to: Same CICS Module for Batch and Online
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    Post subject: Reply to: Same CICS Module for Batch and Online
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 24, 2008 10:01 pm    Post subject: Same CICS Module for Batch and Online
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    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 CICS transaction slow response time vasanthz All Other Mainframe Topics 1 Thu Jan 19, 2017 1:31 am
No new posts INDEPENDENT CICS TS 4.1 MRO REGION UP... Kyle Carroll CICS 0 Wed Dec 14, 2016 6:55 pm
No new posts CICS START AND CANCEL blayek CICS 1 Wed Dec 07, 2016 3:27 am
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us