EXEC CICS SPOOL
 Submit JCL to INTRDR from CICS
http://www.simotime.com
When technology complements business    Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.07.20 
  Introduction
  The CICS Transaction
  The Batch Job
 
  Batch Job, JCL Member for Reference Sample
  Batch Job, CICS Program to INTRDR
  The COBOL Program
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Glossary of Terms
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This example uses a COBOL program running under CICS to submit a job (i.e. JCL) to the Internal Reader (or INTRDR). The program uses command level CICS statements (EXEC CICS SPOOL) to access the internal reader. The program will run on an IBM Mainframe System with CICS or a Microsoft Windows System with Micro Focus Server and the Mainframe Sub-System option.

The CICS Transaction
(Next) (Previous) (Table-of-Contents)

Start a 3270 Session and execute the JRDR Transaction. The following is an overview of the Batch Job submission process.

               
     
JRDR
transaction
      1. The CICS transaction to submit a job to batch
     
     
       
     
CSSJCLC1
cbl
      2. A COBOL CICS Program
     
     
       
 
Working
Storage
EXEC CICS
SPOOLWRITE
INTRDR
JES Batch
  3. Write JCL for the CSSRDRJ9 job to Internal Reader
     
     
       
     
CSSRDRJ9
jcl
RDRTEST1
text/csv
  4.Execute batch job and create a file
     
     
       
     
EXEC CICS
RETURN
CICS
screen
  5. Return to CICS
     
     
       
     
End-of-Job
      6. End of Job
               
 Submit a Job to Batch using INTRDR from a CICS Program

The Batch Jobs
(Next) (Previous) (Table-of-Contents)

This example includes two batch jobs. The first job CCSRDRJ8.JCL is provided as a reference point. It is a standard JCL member that is submitted and executed in the traditional batch environment. The second batch job is submitted to the internal reader (INTRDR) from within a COBOL program running in a CICS environment. A JCL member does not exist. The jcl statements are created from data defined in the WORKING-STORAGE section of the COBOL program and written to the INTRDR. When all the JCL statements has been written to the job is executed..

Batch Job, JCL Member for Reference Sample
(Next) (Previous) (Table-of-Contents)

This JCL Member (CCSRDRJ8.JCL) is provided as a sample job that is submited and executed in the JES Batch environment.

//CCSRDRJ8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                      SimoTime Enterprises                         *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (QSAMDELT) will delete any previously created
//* file. The second job step (QCRTDIN1) will create a new file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//SYSUT2   DD  DSN=SIMOTIME.CICSNOK.RDRTEST1,
//             DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new QSAM file...
//*
//QCRTDIN1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6
//SYSUT1   DD  *
CCSRDRC1 Job Submission
/*
//SYSUT2   DD  DSN=SIMOTIME.CICSNOK.RDRTEST1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//

Batch Job, CICS Program to INTRDR
(Next) (Previous) (Table-of-Contents)

The CCSRDRJ9 does not exist as a JCL Member. Each JCL statement is a data item in the WORKING-STORAGE section of the COBOL program. The following is a list of the JCL statements created and submitted by the COBOL program running in the CICS environment.

   1 //CCSRDRJ9 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 
   2 //QSAMDELT EXEC PGM=IEFBR14 
   3 //SYSUT2   DD  DSN=SIMOTIME.CICSAOK.RDRTEST1, 
   4 //             DISP=(MOD,DELETE,DELETE), 
   5 //             STORCLAS=MFI, 
   6 //             SPACE=(TRK,5), 
   7 //             DCB=(RECFM=FB,LRECL=80,DSORG=PS) 
   8 //* 
   9 //QCRTDIN1 EXEC PGM=IEBGENER 
  10 //SYSPRINT DD  SYSOUT=* 
  11 //SYSIN    DD  DUMMY 
  12 //* :....1....:....2....:....3....:....4....:....5....:....6 
  13 //SYSUT1   DD  * 
  16 //SYSUT2   DD  DSN=SIMOTIME.CICSAOK.RDRTEST1, 
  17 //             DISP=(NEW,CATLG,DELETE), 
  18 //             STORCLAS=MFI, 
  19 //             SPACE=(TRK,5), 
  20 //             DCB=(RECFM=FB,LRECL=80,DSORG=PS) 
  21 // 

The COBOL Program
(Next) (Previous) (Table-of-Contents)

The COBOL program (CCSJCLC1.CBL) uses the EXEC CICS SPOOL capabilities to submit a batch job to the internal reader (INTRDR) from within a CICS Program. The following is an example of the source code.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.  CCSJCLC1.
       AUTHOR.      SIMOTIME ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1987-2010 SimoTime Enterprises.                 *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Enterprises.                                                  *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Enterprises. Once the fee is received by SimoTime    *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Enterprises.                                                  *
      *                                                               *
      * SimoTime Enterprises makes no warranty or representations     *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any express or implied warranty,     *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Enterprises shall not be liable for any direct, indirect,     *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Enterprises                                          *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Enterprises,  *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1992/11/27 Simmons, Created program.
      * 1997/03/17 Simmons, Updated JCL being submitted.
      *
      *****************************************************************
      * DESCRIPTION
      * -----------
      * This program will submit a job to the internal reader (INTRDR)
      * using the EXEC CICS SPOOL commands.
      *****************************************************************
       ENVIRONMENT DIVISION.
      *---------------------------------------------------------------*
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.     ES-MSS.
       OBJECT-COMPUTER.     ES-MSS.

      *****************************************************************
       DATA DIVISION.
      *---------------------------------------------------------------*
       WORKING-STORAGE SECTION.
       01  WS-PROGRAM-LOCATION         PIC X(04).

       01  WS-MSG-TEXT                 PIC X(60).
       01  WS-MSG-LEN                  PIC S9(04) COMP VALUE +60.

       01  WS-BEGIN-MSG                PIC X(40)  VALUE
           'CCSJCLC1 - TRANSACTION STARTED          '.
       01  WS-END-MSG                  PIC X(50)  VALUE
           'CCSJCLC1 - Submit JCL to INTRDR from CICS         '.
       01  WS-ERR-LOAD-PROGRAM         PIC X(50)  VALUE
           'CCSJCLC1 - TRAN FAILED - JCL to INTRDR FAILED     '.

       01  MEMBER-NAME         PIC X(8)    VALUE 'CSSJCLC1'.

       01  SPOOL-FIELDS.
           03  SPOOL-TOKEN     PIC X(8)  VALUE LOW-VALUES.
           03  SPOOL-NODE      PIC X(8)  VALUE 'SIMOCICS'.
           03  SPOOL-USERID    PIC X(8)  VALUE 'INTRDR  '.
           03  SPOOL-CLASS     PIC X     VALUE 'A'.

       01  CICS-RESP           PIC X(04).
       01  WS-RESP2            PIC X(04).
       01  CICS-80             PIC X(80).

       01  JOB-ONE.
           05  filler  pic X(60) value
       '//CCSRDRJ9 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1     '.
           05  filler  pic X(60) value
       '//QSAMDELT EXEC PGM=IEFBR14                                 '.
           05  filler  pic X(60) value
       '//SYSUT2   DD  DSN=SIMOTIME.CICSAOK.RDRTEST1,               '.
           05  filler  pic X(60) value
       '//             DISP=(MOD,DELETE,DELETE),                    '.
           05  filler  pic X(60) value
       '//             STORCLAS=MFI,                                '.
           05  filler  pic X(60) value
       '//             SPACE=(TRK,5),                               '.
           05  filler  pic X(60) value
       '//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)             '.
           05  filler  pic X(60) value
       '//*                                                         '.
           05  filler  pic X(60) value
       '//QCRTDIN1 EXEC PGM=IEBGENER                                '.
           05  filler  pic X(60) value
       '//SYSPRINT DD  SYSOUT=*                                     '.
           05  filler  pic X(60) value
       '//SYSIN    DD  DUMMY                                        '.
           05  filler  pic X(60) value
       '//* :....1....:....2....:....3....:....4....:....5....:....6'.
           05  filler  pic X(60) value
       '//SYSUT1   DD  *                                            '.
           05  filler  pic X(60) value
       'CCSRDRC1 Job Submission from CICS...                        '.
           05  filler  pic X(60) value
       '/*                                                          '.
           05  filler  pic X(60) value
       '//SYSUT2   DD  DSN=SIMOTIME.CICSAOK.RDRTEST1,               '.
           05  filler  pic X(60) value
       '//             DISP=(NEW,CATLG,DELETE),                     '.
           05  filler  pic X(60) value
       '//             STORCLAS=MFI,                                '.
           05  filler  pic X(60) value
       '//             SPACE=(TRK,5),                               '.
           05  filler  pic X(60) value
       '//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)             '.
           05  filler  pic X(60) value
       '//                                                          '.

       01  WX-1            pic 9(5)    value 0.

      *****************************************************************
       LINKAGE SECTION.
       01  DFHCOMMAREA                     PIC X(316).

       01  TBLECL-GROUP.
           05  filler          PIC X(300).

      *****************************************************************
       PROCEDURE DIVISION.
      *    Display console message - start processing
           move WS-BEGIN-MSG   to WS-MSG-TEXT.
           perform Z-SEND-MSG-TEXT.

      *    Submit JCL to INTRDR
           if  EIBRESP NOT = DFHRESP (NORMAL)
               move WS-ERR-LOAD-PROGRAM to WS-MSG-TEXT
               perform Z-SEND-MSG-TEXT
               go to Z-RETURN-TO-CICS.

               perform INTRDR-SPOOL-OPEN
               add 1 to ZERO giving WX-1
               perform 21 times
                   move JOB-ONE(WX-1:60) to CICS-80
                   perform INTRDR-SPOOL-WRITE
                   add 60 to WX-1
               end-perform
               perform INTRDR-SPOOL-CLOSE

           move WS-END-MSG to WS-MSG-TEXT.
           perform Z-SEND-MSG-TEXT.

           go to Z-RETURN-TO-CICS.

      *****************************************************************
       INTRDR-SPOOL-OPEN.
           EXEC CICS SPOOLOPEN OUTPUT
                     TOKEN  (SPOOL-TOKEN)
                     USERID (SPOOL-USERID)
                     NODE   (SPOOL-NODE)
                     CLASS  (SPOOL-CLASS)
                     PUNCH
                     RESP   (CICS-RESP)
                     RESP2  (WS-RESP2)
           END-EXEC
           exit.

      *****************************************************************
       INTRDR-SPOOL-WRITE.
           EXEC CICS SPOOLWRITE
                     TOKEN (SPOOL-TOKEN)
                     FROM  (CICS-80)
                     RESP  (CICS-RESP)
                     RESP2 (WS-RESP2)
           END-EXEC.
           exit.

      *****************************************************************
       INTRDR-SPOOL-CLOSE.
           EXEC CICS SPOOLCLOSE
                     TOKEN (SPOOL-TOKEN)
                     RESP  (CICS-RESP)
                     RESP2 (WS-RESP2)
           END-EXEC
           exit.

      *****************************************************************
       Z-SEND-MSG-TEXT.
      *    Send console message
           EXEC CICS SEND TEXT
                     FROM ( WS-MSG-TEXT )
                     LENGTH( WS-MSG-LEN )
                     ERASE
                     FREEKB
                     END-EXEC.
           exit.

      *****************************************************************
       Z-RETURN-TO-CICS.
      *    Program return to cics
           EXEC CICS RETURN END-EXEC.

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this suite of program is to provide examples that use command level CICS in COBOL programs to submit a batch job to the internal reader (INTRDR).

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

Permission to use, copy, modify and distribute this software for a non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#zPACKccsrdr01 or view the complete list of SimoTime Examples at http://www.simotime.com/sim4dzip.htm.

To review all the information available on this site start at  The SimoTime Home Page .

Note: You must be attached to the Internet to download a Z-Pack or view the list.

Check out  The CICS Connection  for more examples of mainframe CICS coding techniques and sample code.

Check out  The VSAM - QSAM Connection  for more examples of mainframe VSAM and QSAM accessing techniques and sample code. This link will describe how to create the Customer Master File and the Item Master File that are used by other sample programs.

This document provides a quick summary of the  File Status Key  for VSAM data sets and QSAM files.

Glossary of Terms
(Next) (Previous) (Table-of-Contents)

Check out  The SimoTime Glossary  for a list of terms and definitions used in the documents provided by SimoTime.

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

We appreciate your comments and feedback.

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complimentary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Copyright © 1987-2010 SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com
Version 07.10.01