EXEC CICS SPOOL
 Submit JCL to INTRDR from CICS
When technology complements business    Copyright © 1987-2012  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.11.01 
  Introduction
  The CICS Transaction (JRDR)
  The Batch Jobs
  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
  Downloads and Links, Internet Access Required
  Downloads and Links, Local Access
  Glossary of Terms
  Comments, Suggestions or Feedback
  Company Overview
The SimoTime Home Page

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

This example uses a COBOL program running under CICS to submit a batch 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 (JRDR)
(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
CICS Transaction
The CICS transaction to submit a job to batch
   
CCSJCLC1
This is a COBOL CICS Prpgram, refer to Note-1
   
EXEC CICS
SPOOLOPEN
Open access to the SPOOL functions
   
Working Storage
 
 
EXEC CICS
SPOOLWRITE
 
 
INTRDR
JES Batch
Write JCL Statements to Internal Reader
   
EXEC CICS
SPOOLCLOSE
Close access to the SPOOL functions
   
EXEC CICS
RETURN
Normal Return to CICS sub-system
 
Note-1: This step will take JCL Statements from a table in Working Storage and submit the statements to the JES Internal Reader.
Overview of the Process for submitting a Job to the JES Internal Reader using EXEC CICS SPOOL

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 have been written to the INTRDR 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 submitted and executed in the JES Batch environment.

//CCSRDRJ8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       This JCL Member is provided by: SimoTime Enterprises        *
//*           (C) Copyright 1987-2012 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.JCL does not exist as a JCL Member. Each JCL statement is a data item in the WORKING-STORAGE section of the COBOL program (CCSJCLC1.CBL. 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  *
  14 CCSRDRC1 2010/12/06 12:03:00:09 Job Submitted from CICS
  15 /*
  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-2012 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 expressed 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  WORK-DATE.
           05  WORK-DATE-CC    pic X(02).
           05  WORK-DATE-YY    pic 9(02).
           05  WORK-DATE-MM    pic X(02).
           05  WORK-DATE-DD    pic 9(02).
       01  WORK-TIME.
           05  WORK-TIME-HH    pic X(02).
           05  WORK-TIME-MM    pic X(02).
           05  WORK-TIME-SS    pic X(02).
           05  WORK-TIME-TT    pic X(02).

       01  EDIT-DATE.
           05  EDIT-DATE-CC    pic X(02).
           05  EDIT-DATE-YY    pic 9(02).
           05  filler          pic X       value '/'.
           05  EDIT-DATE-MM    pic X(02).
           05  filler          pic X       value '/'.
           05  EDIT-DATE-DD    pic 9(02).
       01  EDIT-TIME.
           05  EDIT-TIME-HH    pic X(02).
           05  filler          pic X       value ':'.
           05  EDIT-TIME-MM    pic X(02).
           05  filler          pic X       value ':'.
           05  EDIT-TIME-SS    pic X(02).
           05  filler          pic X       value ':'.
           05  EDIT-TIME-TT    pic X(02).

       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  DATA-RECORD.
               10  filler  pic X(8)    value 'CCSRDRC1'.
               10  filler  pic X       value SPACE.
               10  D-DATE  pic X(10)   value SPACES.
               10  filler  pic X       value SPACE.
               10  D-TIME  pic X(11)   value SPACES.
               10  filler  pic X       value SPACE.
               10  filler  pic X(23)   value 'Job Submitted from CICS'.
               10  filler  pic X(5)    value SPACES.
           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 Z-GET-DATE-AND-TIME
               perform INTRDR-SPOOL-OPEN
               move EDIT-DATE to D-DATE
               move EDIT-TIME to D-TIME
               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.

      *****************************************************************
       Z-GET-DATE-AND-TIME.
           accept WORK-DATE from DATE YYYYMMDD
           accept WORK-TIME from TIME

           move 'ccyy/mm/dd' to EDIT-DATE
           move WORK-DATE-CC to EDIT-DATE-CC
           move WORK-DATE-YY to EDIT-DATE-YY
           move WORK-DATE-MM to EDIT-DATE-MM
           move WORK-DATE-DD to EDIT-DATE-DD

           move 'hh:mm:ss:dd' to EDIT-TIME
           move WORK-TIME-HH  to EDIT-TIME-HH
           move WORK-TIME-MM  to EDIT-TIME-MM
           move WORK-TIME-SS  to EDIT-TIME-SS
           move WORK-TIME-TT  to EDIT-TIME-TT

           exit.

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

The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This documents and the links to other documents are intended to provide a choice of alternatives.

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

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material 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, documentation or learning material for any purpose. It is provided "AS IS" without any expressed 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, documentation or training material.

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

This section includes links to documents with additional information that is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.

Note:  A SimoTime License is required for the items to be made available on a local server.

Downloads and Links, Internet Access Required
(Next) (Previous) (Table-of-Contents)

The following links will require an internet connect.

Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information.

You may download this example from the library of software packages that are available for review and evaluation.

Explore The ASCII and EBCDIC translation tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.

Downloads and Links, Local Access
(Next) (Previous) (Table-of-Contents)

The following links may be accessible without an internet connection.

This document describes how to use a batch COBOL program to submit jobs to the Internal Reader (INTRDR).

This document describes how to use IEBGENER to submit jobs to the Internal Reader (INTRDR).

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

Explore The File Status Return Codes to interpret the results of accessing 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, Suggestions or Feedback
(Next) (Previous) (Table-of-Contents)

This document was created and is maintained by SimoTime Enterprises.

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

We appreciate hearing from you.

Company Overview
(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 complementary 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
Submit JCL to INTRDR from CICS using EXEC CICS SPOOL
Copyright © 1987-2012 SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com