Search

Friday, September 25, 2015

Trigger CICS transaction Batch programs

There are many situations where user has to trigger CICS transaction via batch jobs. This becomes handy when any CICS program is being coded and situation occurs to allocate/de-allocate files.

However, there is one installation required up hand for CICS to accept the commands from batch; the console definition must be defined in the terminal table. Sample console definitions are provided by IBM supplied resource group DFH$CNSL. You would require your CICS administrator to set up if not done. 

Use the MODIFY command to trigger the transaction from a batch job. MODIFY command is abbreviated to F.
Example:  Following JCL launches the transaction TXN1 in the CICS region CICRGN1
//CICSBTCH JOB …
//STEP001 EXEC ...
// ………..
//STEP002 EXEC PGM=IEFBR14
// COMMAND 'F CICRGN11,TRA1'
//*
Note
i) The MVS command is directly executed without waiting for the completion of the STEP001.
ii) The above command triggers the transaction TRA1 in the region CICRGN11.
iii) The command must be placed between quotes.

To avoid the execution of the command before the completion of STEP001, launch the MVS command in separate job.
Example:
//BTCHSUB JOB ......
//STEP001 EXEC ......
// --------
//STEP002  EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1     DD DATA,DLM=@@
//CICSBTCH JOB ……
//STEPR  EXEC PGM=IEFBR14
// COMMAND 'F CICRGN11,TRA1'
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY
//*
In the above job, STEP002 submits the batch interface job (CICSBTCH) to internal reader upon the completion of the step STEP001. Thus the transaction TRA1 is triggered only after the completion of STEP001.

Trigger JCL via SPOOL option in CICS

CODE SNIPPET

 
IDENTIFICATION DIVISION.  
PROGRAM-ID. SAMPLE.  
AUTHOR.
DATE-WRITTEN. 04/01/XXXX.
DATE-COMPILED. 04/01/XXXX.
*******************************************************************
* CODE SNIPPET TO FORM JCL VIA CICS.                              *
* ONLINE PROGRAM CALLED THROUGH TRANSACTION                       *

*******************************************************************


ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.

01 WS-T PIC X (8).
01 JCL-CARDS.
05 FILLER PIC X (80) VALUE '//SAMPLE JOB (XYZ),"BATCH RUN"','.00
05 FILLER PIC X(80) VALUE '// CLASS=E,MSGLEVEL=(1,1),REGION=0M,MSGCLASS=X'.
05 FILLER PIC X(80) VALUE '//THREAD EXEC PGM=IKJEFT01,DYNAMNBR=20'.
05 FILLER PIC X(80) VALUE '//STEPLIB DD DSN=CEE.SCEERUN,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=CEE.SCEECICS,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=CEE.SCEELKED,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=SYS1.DSNXXX.SDSNLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=DSNXXX.DBXX.RUNLIB.LOAD,DISP=SHR'.


05 FILLER PIC X(80) VALUE '// DD DSN=ABCD.XXX.COBLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '// DD DSN=ABCD.XXX.ASMLOAD,DISP=SHR'.
05 FILLER PIC X(80) VALUE '//SYSTSPRT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSPRINT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSABOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSDBOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSUDUMP DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSOUT DD SYSOUT=*'.
05 FILLER PIC X(80) VALUE '//SYSIN DD *'.  
05 WS-THREAD-DTLS.
  10 FILLER PIC X(12) VALUE 'CTRANSAC 0001'.  
  10 FILLER PIC X(68) VALUE ' '.
05 FILLER PIC X(80) VALUE ' '.
05 FILLER PIC X(80) VALUE '/*'.
05 FILLER PIC X(80) VALUE '//SYSTSIN DD *'.
05 FILLER PIC X(80) VALUE ' DSN SYSTEM(DBXX)'.
05 FILLER PIC X(80) VALUE ' RUN PROGRAM(PXXXXXX)-'.
05 FILLER PIC X(80) VALUE ' PLAN(PXXXX)'.
05 FILLER PIC X(80) VALUE 'END'.
05 FILLER PIC X(80) VALUE '//*'.
05 FILLER PIC X(80) VALUE '/*EOF'.

01 FILLER REDEFINES JCL-CARDS.
  05 CARD OCCURS 27 TIMES INDEXED BY CARD-INDEX PIC X(80).
 
01 WS-JCL-LINES PIC 9(3) VALUE 27.

PROCEDURE DIVISION.

A-MAIN-PARA.

PERFORM B-MAIN-PROCESS THRU B-MAIN-PROCESS-EXIT
 
PERFORM C-TERMINATION THRU C-TERMINATION-EXIT

A-MAIN-PARA-EXIT.
EXIT.
 
B-MAIN-PROCESS.

EXEC CICS
SPOOLOPEN OUTPUT
USERID('INTRDR')
NODE('XXXX')
TOKEN(WS-T) 
NOHANDLE
END-EXEC

Advanced Cursors in DB2

                             CURSORS IN DB2

Use of DB2 Cursors in Application Program

  • Mechanism that allows the SELECT statement to find a set of rows from table
  • It return rows one at a time
  • Used as similar to a File which can be Opened, Read and Closed
  • ‘Fetch’ terminology is used instead of ‘Read’
  • Can be declared in both ‘Working Storage’ and ‘Procedure Division’
  • Should always be declared before the ‘Open’ Cursor statement

Types of Cursors

- Row Positioned Cursor
- RowSet Positioned Cursor
- Scrollable
- Non Scrollable
- Held
- Non-Held
- Returnable
- Non-Returnable
 

Brief Description for cursors 

Sunday, September 13, 2015

What is MRO - Multi Region Operation! Why is it useful! How is TOR, AOR and FOR linked?

               Using Intercommunication Features in CICS

MRO - Multi Region Operation is used connect CICS region running on the same processor. 
Each System has its own address space independently, hence if any region goes down others are not affected.

Typical MRO includes

  • TOR - Terminal Owning Region which owns all the Terminal
  • AOR - An Application Owning Region that owns all the Applications
  • FOR - File Owning Region that owns all the Files

How transaction routes from TOR to AOR?

The PCT entry in the Terminal Owning Region is defined as below:

Terminal Owing Region (PRVT)

Transaction: ABC1
Type:       Remote
Sysid:          PRVA

Application Owing Region(PRVA)

Transaction: ABC1
Type:           Local
Program: XYZ123P

- Any transaction is triggered in the TOR terminal. It checks PCT entry for type and sysid for AOR
- Transactions then routes to the AOR where its defined local in PCT and hits program defined in it.
- Any I/O transaction to be done is routed back to TOR 

How transaction is shipped from AOR to FOR?

In Application Owing Region(PRVA)

XYZ123P
Reads Customer1

File Control Table Definition in AOR
Type: Remote
File : Customer1
SYSID: PRVF
Reclen: 258
Key: 25

In File Owing Region(PRVF)

File Control Table Definition in FOR
Type: Local
File : Customer1
Access: VSAM KSDS


  • Function shipping allows to access resource defined in the other region.
  • If Program defined in AOR, needs to access file which is defined local in other region, FCT entry is defined with sysid of the FOR region and file type is defined as remote
  • Once the program needs to read this file, the control is transferred to the FOR region where file is residing as local. 
  • Program accesses required information and passes control back to AOR region.





Separate CICS Business Application Transactions and CICS Default Communication Transactions

Separate Default and Application Level Transaction

This is kind of good practice to always separate Default CICS Transaction from the application level of Transaction.

Once the TCPIP connections are established between Web Services and CICS; 
 - All the CICS services runs under CIEP transaction as its defined and linked to the TCP IP service and port/host of the Web Services

- All the services running under default is copied to the mirror transaction as its defined as communication parameter for Web Services

- Also when messages are serviced from the Web Services, generally CICS receives program which needs to be invoked and that application level program runs under default transaction 

- In these cases, if any application level service is invoked it runs under default transaction CIEP which creates problem if any user needs to debug

The Flow is 

What is ECI?

External Call Interface 

ECI calls are the way of communication between CICS and Web Services which uses TCP IP connections.

Client Side or Web Service need not use BMI setups to connect to CICS online transactions.

ECI calls are set up and linked the CICS default transaction. And on the client side or Web Service side can be set up in a way where it can run on mirror transactions

Read Blog for more reference  : TCPIP CONNECTION BETWEEN CICS AND WEB SERVICES

Establishing TCP IP service between Web Services and CICS via CIEP Default transactions

                    TCPIP Connection between CICS and Web Services

If you have any Java front end connected to CICS via Web Services following parameters needs to be taken care of:

Currently, I have tested with the Web Services using WSDL objects. There are Web services use the standard web protocols HTTP, XML, SOAP, WSDL, and UDDI. WSDL (Web Services Description Language) is an XML-based language used to define web services and to describe how to access them. 

- Connection between CICS and Web Method Serivces via TCP IP protocols
- Define TCP IP Service and link it to the port number

Command in CICS