![]() |
Internal Reader Submitting Jobs using COBOL |
| When technology complements business | Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| The SimoTime Home Page |
This suite of programs will describe how to submit a second job to the internal reader or INTRDR from within the currently running job using a COBOL program. For this example the second job (or submitted job) simply executes IEFBR14 with a return to the caller.
The source code, data sets and documentation are provided in a single zipped file called CBLSUB01.ZIP. This zipped file may be downloaded from the SimoTime Web site. In the Windows environment the file names have file extensions. If the JCL member is uploaded to a ZOS Mainframe from the Windows and Micro Focus environment the file extension is dropped.
This example contains two (2) JCL members. The first JCL member executes a COBOL program that will submit a job to the internal reader.
The second JCL member uses IEFBR14 to return to caller and is submitted by the COBOL program being executed by the first job.
The following mainframe JCL (CBLSUBJ1.JCL) executes a COBOL program that will submit a job to the Internal Reader. The COBOL program is coded to read an 80-byte record sequential file (JCLINPUT) and write to an 80-byte record sequential file (SUBTORDR). The COBOL program is a simply file copy. The DD statements map the COBOL file names to the actual physical locations. The file to be copied is JCLINPUT and the output file is SUBTORDR. The JCLINPUT file is member of a partitioned data set (PDS) that contains JCL. The SUBTORDR file is mapped to SYSOUT=(,INTRDR) and is copies the JCLINPUT to the internal reader (or submitts the job to the internal reader).
//CBLSUBJ1 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 - Submit JCL to the Internal Reader. //* Author - SimoTime Enterprises //* Date - January 24, 1996 //* //* The job will read an 80-byte file that contains JCL and write //* to the JES Internal Reader (INTRDR). //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* ************ //* * CBLSUBJ1 * //* ********jcl* //* * //* * //* ************ ************ ************ //* * JCLINPUT *-----* CBLSUBC1 *-----* SUBTORDR * //* ********pds* ********cbl* *****intrdr* //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 Execute the COBOL Program... //* //SUBMITS1 EXEC PGM=CBLSUBC1 //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //JCLINPUT DD DSN=SIMOTIME.PDS.JCL(BR14CC00),DISP=SHR //SUBTORDR DD SYSOUT=(,INTRDR) //SYSOUT DD SYSOUT=* //
The following COBOL program (CBLSUBC1.CBL) will submit a job to the Internal Reader. The COBOL program is coded to read an 80-byte record sequential file (JCLINPUT) and write to an 80-byte record sequential file (SUBTORDR). The COBOL program is a simply file copy. The DD statements in the JCL map the COBOL file names to the actual physical locations. The file to be copied is JCLINPUT and the output file is SUBTORDR. The JCLINPUT file is member of a partitioned data set (PDS) that contains JCL. The SUBTORDR file is mapped to SYSOUT=(,INTRDR) and this copies the JCLINPUT to the internal reader (or submitts the job to the internal reader).
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLSUBC1.
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
* -----------
* 1994/02/27 Simmons, Created program.
*
*****************************************************************
* Source Member: CBLSUBC1.CBL
* Copy Files: none...
* Calls to: none...
*****************************************************************
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* INPUT JCLINPUT SEQUENTIAL FIXED 00080 *
* OUTPUT SUBTORDR SEQUENTIAL FIXED 00080 *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT JCLINPUT-FILE ASSIGN TO JCLINPUT
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS JCLINPUT-STATUS.
SELECT SUBTORDR-FILE ASSIGN TO SUBTORDR
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS SUBTORDR-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD JCLINPUT-FILE
DATA RECORD IS JCLINPUT-REC
.
01 JCLINPUT-REC.
05 JCLINPUT-DATA-01 PIC X(00080).
FD SUBTORDR-FILE
DATA RECORD IS SUBTORDR-REC
.
01 SUBTORDR-REC.
05 SUBTORDR-DATA-01 PIC X(00080).
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
05 T1 pic X(11) value '* CBLSUBC1 '.
05 T2 pic X(34) value 'A COBOL Program, Submit to INTRDR '.
05 T3 pic X(10) value ' v08.02.15'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLSUBC1 '.
05 C2 pic X(20) value 'Copyright 1987-2012 '.
05 C3 pic X(28) value '--- SimoTime Enterprises ---'.
05 C4 pic X(20) value ' All Rights Reserved'.
01 JCLINPUT-STATUS.
05 JCLINPUT-STATUS-L pic X.
05 JCLINPUT-STATUS-R pic X.
01 JCLINPUT-EOF pic X value 'N'.
01 JCLINPUT-OPEN-FLAG pic X value 'C'.
01 SUBTORDR-STATUS.
05 SUBTORDR-STATUS-L pic X.
05 SUBTORDR-STATUS-R pic X.
01 SUBTORDR-EOF pic X value 'N'.
01 SUBTORDR-OPEN-FLAG pic X value 'C'.
01 JCLINPUT-LRECL pic 9(5) value 00080.
01 SUBTORDR-LRECL pic 9(5) value 00080.
*****************************************************************
* The following buffers are used to create a four-byte status *
* code that may be displayed. *
*****************************************************************
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 IO-STATUS-04.
05 IO-STATUS-0401 pic 9 value 0.
05 IO-STATUS-0403 pic 999 value 0.
01 TWO-BYTES-BINARY pic 9(4) BINARY.
01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLSUBC1 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*****************************************************************
01 PROGRAM-NAME pic X(8) value 'CBLSUBC1'.
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 CHANGE-JOB-CLASS pic X value 'Y'.
01 JCLINPUT-TOTAL.
05 JCLINPUT-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for JCLINPUT'.
01 SUBTORDR-TOTAL.
05 SUBTORDR-ADD pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for SUBTORDR'.
*****************************************************************
PROCEDURE DIVISION.
perform Z-POST-COPYRIGHT
perform JCLINPUT-OPEN
perform SUBTORDR-OPEN
perform until JCLINPUT-STATUS not = '00'
perform JCLINPUT-READ
if JCLINPUT-STATUS = '00'
add 1 to JCLINPUT-RDR
perform BUILD-OUTPUT-RECORD
perform SUBTORDR-WRITE
if SUBTORDR-STATUS = '00'
add 1 to SUBTORDR-ADD
end-if
end-if
end-perform
move JCLINPUT-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
if APPL-EOF
move 'is Complete...' to MESSAGE-TEXT
else
move 'is ABENDING...' to MESSAGE-TEXT
end-if
perform Z-DISPLAY-MESSAGE-TEXT
perform SUBTORDR-CLOSE
perform JCLINPUT-CLOSE
GOBACK.
*****************************************************************
BUILD-OUTPUT-RECORD.
*> TransCOPY...
move JCLINPUT-REC to SUBTORDR-REC
exit.
*****************************************************************
* I/O Routines for the INPUT File... *
*****************************************************************
JCLINPUT-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
JCLINPUT-READ.
read JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if JCLINPUT-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if
if APPL-AOK
CONTINUE
else
if APPL-EOF
move 'Y' to JCLINPUT-EOF
else
move 'READ Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
JCLINPUT-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to JCLINPUT-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the OUTPUT File... *
*****************************************************************
SUBTORDR-WRITE.
if SUBTORDR-OPEN-FLAG = 'C'
perform SUBTORDR-OPEN
end-if
write SUBTORDR-REC
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SUBTORDR-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'WRITE Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SUBTORDR-OPEN.
add 8 to ZERO giving APPL-RESULT.
open OUTPUT SUBTORDR-FILE
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SUBTORDR-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SUBTORDR-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SUBTORDR-FILE
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to SUBTORDR-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* The following Z-ROUTINES provide administrative functions *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display the file status bytes. This routine will display as *
* four digits. If the full two byte file status is numeric it *
* will display as 00nn. If the 1st byte is a numeric nine (9) *
* the second byte will be treated as a binary number and will *
* display as 9nnn. *
*****************************************************************
Z-DISPLAY-IO-STATUS.
if IO-STATUS not NUMERIC
or IO-STAT1 = '9'
move IO-STAT1 to IO-STATUS-04(1:1)
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
else
move '0000' to IO-STATUS-04
move IO-STATUS to IO-STATUS-04(3:2)
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
Z-POST-COPYRIGHT.
display SIM-TITLE
display SIM-COPYRIGHT
exit.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2008-04-28 Generation Time: 18:02:52:62 *
*****************************************************************
This example contains two (2) JCL members. The first JCL member executes a COBOL program that will submit a job to the internal reader. The JCL (or source code for the JOB script) will be modified prior to submission.
The second JCL member uses IEFBR14 to return to caller and is submitted by the COBOL program being executed by the first job.
The following mainframe JCL (CBLSUBJ2.JCL) executes a COBOL program that will submit a job to the Internal Reader. The COBOL program is coded to read an 80-byte record sequential file (JCLINPUT) and write to an 80-byte record sequential file (SUBTORDR). The COBOL program is a simply file copy. The DD statements map the COBOL file names to the actual physical locations. The file to be copied is JCLINPUT and the output file is SUBTORDR. The JCLINPUT file is member of a partitioned data set (PDS) that contains JCL. The SUBTORDR file is mapped to SYSOUT=(*,INTRDR) and is copies the JCLINPUT to the internal reader (or submitts the job to the internal reader).
//CBLSUBJ2 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 - Submit Modified JCL to the Internal Reader. //* Author - SimoTime Enterprises //* Date - January 24, 1996 //* //* The job will read an 80-byte file that contains JCL and write //* to the JES Internal Reader (INTRDR). //* //* This job will modify the JCL to be submitted based on the //* information passed from the PARM= statement of the primary job. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* ************ //* * CBLSUBJ2 * //* ********jcl* //* * //* * //* ************ ************ ************ //* * JCLINPUT *-----* CBLSUBC2 *-----* SUBTORDR * //* ********pds* ********cbl* *****intrdr* //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 Execute the COBOL Program... //* //SUBMITS1 EXEC PGM=CBLSUBC2,PARM='CHANGE CLASS=1 TO CLASS=R' //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //JCLINPUT DD DSN=SIMOTIME.PDS.JCL(BR14CC00),DISP=SHR //SUBTORDR DD SYSOUT=(*,INTRDR) //SYSOUT DD SYSOUT=* //* ******************************************************************* //* Step 2 Wait thirty (30) seconds... //* //WAIT0030 EXEC PGM=STWAIT01,PARM='00:00:30' //SYSOUT DD SYSOUT=* //
The following COBOL program (CBLSUBC2.CBL) will submit a job to the Internal Reader. The COBOL program is coded to read an 80-byte record sequential file (JCLINPUT) and write to an 80-byte record sequential file (SUBTORDR). The COBOL program is a simply file copy. The DD statements in the JCL map the COBOL file names to the actual physical locations. The file to be copied is JCLINPUT and the output file is SUBTORDR. The JCLINPUT file is member of a partitioned data set (PDS) that contains JCL. The SUBTORDR file is mapped to SYSOUT=(*,INTRDR) and this copies the JCLINPUT to the internal reader (or submits the job to the internal reader).
The following program will scan the JCL records looking for the CLASS= text string based on the PARM= data passed from JCL. The CLASS will be changed accoeding to the information in the PARM= parameter.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLSUBC2.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2011 SimoTime Enterprises, LLC. *
* *
* 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
* -----------
* 1994/02/27 Simmons, Created program.
*
*****************************************************************
* Source Member: CBLSUBC1.CBL
* Copy Files: none...
* Calls to: none...
*****************************************************************
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* INPUT JCLINPUT SEQUENTIAL FIXED 00080 *
* OUTPUT SUBTORDR SEQUENTIAL FIXED 00080 *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT JCLINPUT-FILE ASSIGN TO JCLINPUT
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS JCLINPUT-STATUS.
SELECT SUBTORDR-FILE ASSIGN TO SUBTORDR
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS SUBTORDR-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD JCLINPUT-FILE
DATA RECORD IS JCLINPUT-REC
.
01 JCLINPUT-REC.
05 JCLINPUT-DATA-01 PIC X(00080).
FD SUBTORDR-FILE
DATA RECORD IS SUBTORDR-REC
.
01 SUBTORDR-REC.
05 SUBTORDR-DATA-01 PIC X(00080).
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
05 T1 pic X(11) value '* CBLSUBC2 '.
05 T2 pic X(34) value 'A COBOL Program, Submit to INTRDR '.
05 T3 pic X(10) value ' v08.02.15'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLSUBC2 '.
05 C2 pic X(20) value 'Created by SimoZAPS,'.
05 C3 pic X(20) value ' a utility package '.
05 C4 pic X(28) value 'of SimoTime Enterprises, LLC'.
01 JCLINPUT-STATUS.
05 JCLINPUT-STATUS-L pic X.
05 JCLINPUT-STATUS-R pic X.
01 JCLINPUT-EOF pic X value 'N'.
01 JCLINPUT-OPEN-FLAG pic X value 'C'.
01 SUBTORDR-STATUS.
05 SUBTORDR-STATUS-L pic X.
05 SUBTORDR-STATUS-R pic X.
01 SUBTORDR-EOF pic X value 'N'.
01 SUBTORDR-OPEN-FLAG pic X value 'C'.
01 JCLINPUT-LRECL pic 9(5) value 00080.
01 SUBTORDR-LRECL pic 9(5) value 00080.
*****************************************************************
* The following buffers are used to create a four-byte status *
* code that may be displayed. *
*****************************************************************
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 IO-STATUS-04.
05 IO-STATUS-0401 pic 9 value 0.
05 IO-STATUS-0403 pic 999 value 0.
01 TWO-BYTES-BINARY pic 9(4) BINARY.
01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLSUBC2 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*****************************************************************
01 PROGRAM-NAME pic X(8) value 'CBLSUBC1'.
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 CHANGE-JOB-CLASS pic X value 'Y'.
01 CLASS-SEARCH pic X(7) value SPACES.
01 CLASS-MODIFY pic X(7) value SPACES.
01 JCLINPUT-TOTAL.
05 JCLINPUT-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for JCLINPUT'.
01 SUBTORDR-TOTAL.
05 SUBTORDR-ADD pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for SUBTORDR'.
01 MESSAGE-TEXT-01.
05 filler pic X(20) value 'Parameter length is '.
05 JCL-PARM-LENGTH pic 9(5) value 0.
*****************************************************************
LINKAGE SECTION.
01 PARM-BUFFER.
05 PARM-LENGTH pic S9(4) comp.
05 PARM-DATA pic X(256).
*****************************************************************
PROCEDURE DIVISION using PARM-BUFFER.
perform Z-POST-COPYRIGHT
perform EXTERNAL-PARAMETERS
perform JCLINPUT-OPEN
perform SUBTORDR-OPEN
perform until JCLINPUT-STATUS not = '00'
perform JCLINPUT-READ
if JCLINPUT-STATUS = '00'
add 1 to JCLINPUT-RDR
perform BUILD-OUTPUT-RECORD
perform SUBTORDR-WRITE
if SUBTORDR-STATUS = '00'
add 1 to SUBTORDR-ADD
end-if
end-if
end-perform
move JCLINPUT-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
if APPL-EOF
move 'is Complete...' to MESSAGE-TEXT
else
move 'is ABENDING...' to MESSAGE-TEXT
end-if
perform Z-DISPLAY-MESSAGE-TEXT
perform SUBTORDR-CLOSE
perform JCLINPUT-CLOSE
GOBACK.
*****************************************************************
BUILD-OUTPUT-RECORD.
*> TransCOPY...
move JCLINPUT-REC to SUBTORDR-REC
if CHANGE-JOB-CLASS = 'Y'
and SUBTORDR-REC(1:3) not = '//*'
inspect SUBTORDR-REC
replacing first 'CLASS=1' by 'CLASS=R'
if JCLINPUT-REC not = SUBTORDR-REC
move 'N' to CHANGE-JOB-CLASS
end-if
end-if
exit.
*****************************************************************
EXTERNAL-PARAMETERS.
add PARM-LENGTH to ZERO giving JCL-PARM-LENGTH
move MESSAGE-TEXT-01 to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
if PARM-LENGTH > 0
move PARM-DATA(1:PARM-LENGTH) to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
end-if
* ....:....1....:....2....:
* PARM='CHANGE CLASS=1 TO CLASS=R
if PARM-LENGTH = 25
and PARM-DATA(1:7) = 'CHANGE '
and PARM-DATA(15:4) = ' TO '
move PARM-DATA(8:7) to CLASS-SEARCH
move PARM-DATA(19:7) to CLASS-MODIFY
move 'External PARM accepted...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
else
move 'N' to CHANGE-JOB-CLASS
move 'External PARM is invalid, parameter ignored!'
to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
* I/O Routines for the INPUT File... *
*****************************************************************
JCLINPUT-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
JCLINPUT-READ.
read JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if JCLINPUT-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if
if APPL-AOK
CONTINUE
else
if APPL-EOF
move 'Y' to JCLINPUT-EOF
else
move 'READ Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
JCLINPUT-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input JCLINPUT-FILE
if JCLINPUT-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to JCLINPUT-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with JCLINPUT' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move JCLINPUT-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the OUTPUT File... *
*****************************************************************
SUBTORDR-WRITE.
if SUBTORDR-OPEN-FLAG = 'C'
perform SUBTORDR-OPEN
end-if
write SUBTORDR-REC
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SUBTORDR-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'WRITE Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SUBTORDR-OPEN.
add 8 to ZERO giving APPL-RESULT.
open OUTPUT SUBTORDR-FILE
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SUBTORDR-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SUBTORDR-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SUBTORDR-FILE
if SUBTORDR-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to SUBTORDR-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with SUBTORDR' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SUBTORDR-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* The following Z-ROUTINES provide administrative functions *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display the file status bytes. This routine will display as *
* four digits. If the full two byte file status is numeric it *
* will display as 00nn. If the 1st byte is a numeric nine (9) *
* the second byte will be treated as a binary number and will *
* display as 9nnn. *
*****************************************************************
Z-DISPLAY-IO-STATUS.
if IO-STATUS not NUMERIC
or IO-STAT1 = '9'
move IO-STAT1 to IO-STATUS-04(1:1)
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
else
move '0000' to IO-STATUS-04
move IO-STATUS to IO-STATUS-04(3:2)
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
Z-POST-COPYRIGHT.
display SIM-TITLE
display SIM-COPYRIGHT
exit.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2008-04-28 Generation Time: 18:02:52:62 *
*****************************************************************
This section described the members that are used by other application or more than one (1) of the preceding examples.
The following mainframe JCL (BR14CC00.JCL) is used to set the Condition Code to ZERO and return to caller.
//BR14CC00 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,USER=SIMOTIME //* ******************************************************************* //* This JCL Member is provided by SimoTime Enterprises * //* (C) Copyright 1987-2011 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - Set Condition-Code to ZERO and return to caller //* Author - SimoTime Enterprises //* Date - January 24, 1996 //* //* ******************************************************************* //* Step 1 of 1, Execute the program... //* //NULLSTEP EXEC PGM=IEFBR14 //*
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.
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 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, documentation or training material.
This section includes links to documents with additional information that is beyond the scope and purpose of this document.
You may download this at http://www.simotime.com/sim4dzip.htm#dzipcblsub01 .
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.
Note: You must be attached to the Internet to download a Z-Pack or view the list.
This document describes how to use IEBGENER to submit jobs to the Internal Reader (INTRDR).
Explore How to Submit a Batch Job from a CICS Application using a COBOL program and the Internal Reader (INTRDR).
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Check out The COBOL Connection for more examples of mainframe COBOL coding techniques and sample code.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
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.
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 |
| Internal Reader - Submitting Jobs using COBOL |
| Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |