Prepare, Compile, Define, Install, Execute a CICS (COBOL) program

Here I’m trying to cover the necessary steps to Prepare, Compile, Define and Execute a CICS COBOL program, Technically there no difference in Link edit, Define, Install and Execute a COBOL program and the programs prepared in any other languages such as Assembler, C/C++, PL\1. But yes there is difference in compiling object codes.

 

                    cics-lifecycle

Step 1. Compile/Link edit a CICS COBOL Program.

IBM has supplied a standard procedure for Compile and link edit CICS-COBOL code. The pre-compile ( Translating ) will comment all the CICS commands from the source code and then replace them with specific COBOL call statements. This translated source code then passed to Compile step, which will compile the source code and create the object code. The Cobol compilation is done with IGYCRCTL compiler program. The object code then given as input to the IBM linkedit program. you can use HEWL or IEWL for this purpose, you can find this program in CEE.SCEELKED or CEE.SCEECICS this may be different in your system. The IBM supplied standard procedure name is DFHEITVL. You can find this proc in SDFHPROC,of the CICS base location. for me it was CICSTS42.CICS.SDFHPROC.  And of course you can see a lot of other procs in the CICS proclib, some of them can be used for CICS-DB2-COBOL, CICS-Assempler, CICS-C/C++, CICS-PL\1 or compile and link edit BMS Maps etc. you can then use the below jcl for precompile, Compile and Link edit your program.

//DDS1764J   JOB ‘SHIBU THANNIKKUNNATH’,NOTIFY=&SYSUID  
//IBMLIB     JCLLIB ORDER=CICSTS42.CICS.SDFHPROC               
//CPLSTP     EXEC DFHEITVL                               
//TRN.SYSIN  DD DSN=TSHRCI.PGMG.CICOB(PGM1),DISP=SHR    
//LKED.SYSIN DD *                                       
   NAME PGM1(R)                                         
//

make sure that the PROGLIB in the DFHEITVL is pointed to your CICS loadlib. If you are not sure about this you can go to The JESJCL of the job for your CICS region in Spool and check for DFHRPL dd statement.

Step 2. DEFINE and INSTALL PROGRAM and TRANSACTION Entries.

You should have Administration privileges to do the below steps.

Define Program Entries.

To define a CICS prog entry, you can issue CEDA  DEF  PROG( Program ID) GROUP(group ID). If the group doesn’t exist in the system them CICS will create a new group for you. If your program lies in the same CICS region itself then the mandatory values are Program Id and Group name. If your program is a Remote program , lies in a different CICS region then you need to have the destination CICS region ID and remote Program ID in addition to the program Id and group ID.

image

Install the Program ID

You can issue a CEDA INS PROG(Program id) GROUP(Group ID). the group and program are must be defined in the system.

image

Define Transaction ID

You can Issue a CEDA DEF TRANS(transaction id) group(group id) for this. If the group is not existing in the system then group will be created by CICS. You must Give Program ID (associated with the trans-id) while defining Transaction. Again if your transaction is for a remote program then you must provide the destination CICS region ID and destination transaction name.

image

Then Issue CEDA INS TRANS(Transaction ID) GROUP( Group ID) to install the transaction id.

image

Step 3. Run The Program

You can just enter the transaction Id associated with the program to execute it. You can also use CEDF for debugging mode, in CEDF you can see the step by step execution of CICS commands in your program, you can also see the working storage section, EIB Fields values and lot mode when you use CEDF.

Executing with CEDF

image

image

 

Execution without CEDF

image

here is my CICS-COBOL Source code.. This is a Link program, but I’m not giving my second program’s source code, please comment in this post if you guys want me to post my second program.

 Identification division.                       &nbsp
;             
Program-id.    pgm1.                                         
author.        shibu.t.                                      
data division.                                               
working-storage section.                                     
77  msg-len                     pic s9(4) comp.              
77  msg-out                     pic x(30).                   
01  ws-commarea.                                             
     05  ws-pgm1                 pic x(8).                    
     05  ws-pgm2                 pic x(8).                    
77  temp-data                   pic x(10).                   
linkage section.                                             
01  dfhcommarea.                                             
     02  ls-commarea.                                         
         05  ls-pgm1             pic x(8).                    
         05  ls-pgm2             pic x(8).                    
Procedure division.                                          
     Move ‘PGM1:YES’ to ws-pgm1.                              
     Move ‘PGM2:NO ‘ to ws-pgm2.                              
     Move 16 to msg-len.                                      
     exec cics send                                           
       from(ws-commarea)                                      
       length(msg-len)                                        
       erase                                                  
     end-exec.                                                
     exec cics LINK                                           
       program(‘PGM2’)                                        
       commarea(ws-commarea)                                  
     end-exec.                                                
*    move ls-commarea            to ws-commarea.        &
nbsp;     
*    move ls-commarea            to temp-data.                
*    move 10                     to msg-len.                  
     exec cics send                                           
       from(ws-commarea)                                      
       length(msg-len)                                        

       erase                                                   
     end-exec.                                                 
     Exec cics return                                          
     end-exec.                                                 
     goback.
                                                   

7 thoughts on “Prepare, Compile, Define, Install, Execute a CICS (COBOL) program

  1. I’m just commenting to make you understand of the cool encounter my cousin’s princess found reading through your site. She came to understand too many pieces, with the inclusion of what it is like to have an amazing helping character to let most people just understand chosen problematic topics. You undoubtedly did more than readers’ desires. I appreciate you for distributing these important, trustworthy, edifying and cool tips about this topic to Evelyn

  2. Thank you Mr.Shibu Thannikkunnath for posting wonderful explanation of The CICS-COBOL Application program preparation & execution.This post helped me a lot to understand CICS-COBOL application program execution process. please post continuation for this and Can you please explain ” How CICS-Db2 ” inter related while execution?” .

    Thank you very much!

    1. I’ll prepare a COBOL-cics-DB2 document in near future. Glad my blog helped, can you please share this web page with your friends, also please join the blog follower list/ Facebook page so that you will get notifications when we publish posts in future. Thanks

  3. well explained :). could you please provide any sample source program to create MAP,MAPSET for new transaction and correspoding new cobol program. For example if i want to add new transaction to existing CICS region, how to proceed for that ?, what are the steps to follow ?..

  4. Hi,

    can you please post all the screen shots for each step of execute using CEDF,

    and also post the second program. Please ……

  5. I have cobol DB2 CICS module. This module exists already in production. Now I am doing changes in response and sending thru a web service module.
    If any one knows the steps compile and debug and bind process. Please reply me with the process.

  6. Hi Shibu,

    How the trans id will be mapped to the program,how it will identify which program has to be executed if there are multiple trans id with the same name.

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × 2 =