Sie sind auf Seite 1von 19

Introduction

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

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.

Example 01, Simple Job Submit


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

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.

Example 01, JCL Member to Submit a Job to the Internal Reader


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

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-2011 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=* //

Example 01, Sample COBOL Program


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

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-2011 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 * ----------* 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 ORGANIZATION ACCESS MODE FILE STATUS SELECT SUBTORDR-FILE ORGANIZATION ACCESS MODE FILE STATUS

ASSIGN TO JCLINPUT IS SEQUENTIAL IS SEQUENTIAL IS JCLINPUT-STATUS. ASSIGN TO SUBTORDR IS SEQUENTIAL IS SEQUENTIAL 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 01 SUBTORDR-FILE DATA RECORD IS SUBTORDR-REC . 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 'Created by SimoZAPS,'. 05 C3 pic X(20) value ' a utility package '. 05 C4 pic X(28) value 'of SimoTime Enterprises, LLC'. 01 01 01 01 01 01 01 01 JCLINPUT-STATUS. 05 JCLINPUT-STATUS-L 05 JCLINPUT-STATUS-R JCLINPUT-EOF JCLINPUT-OPEN-FLAG SUBTORDR-STATUS. 05 SUBTORDR-STATUS-L 05 SUBTORDR-STATUS-R SUBTORDR-EOF SUBTORDR-OPEN-FLAG JCLINPUT-LRECL SUBTORDR-LRECL pic 9(5) pic 9(5) pic pic pic pic pic pic pic pic X. X. X X X. X. X X

value 'N'. value 'C'.

value 'N'. value 'C'.

value 00080. 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.

01 01

05 IO-STATUS-0403 TWO-BYTES-BINARY TWO-BYTES-ALPHA 05 TWO-BYTES-LEFT 05 TWO-BYTES-RIGHT

pic 999 value 0. pic 9(4) BINARY. redefines TWO-BYTES-BINARY. pic X. 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 88 APPL-AOK 88 APPL-EOF CHANGE-JOB-CLASS pic S9(9) value 0. value 16. pic X comp.

01 01

value 'Y'.

01

JCLINPUT-TOTAL. 05 JCLINPUT-RDR pic 9(9) 05 filler pic X(3) 05 filler pic X(23) SUBTORDR-TOTAL. 05 SUBTORDR-ADD pic 9(9) 05 filler pic X(3) 05 filler pic X(23)

value 0. value ' - '. value 'Line count for JCLINPUT'. value 0. value ' - '. 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 else move 'is ABENDING...' to MESSAGE-TEXT end-if perform Z-DISPLAY-MESSAGE-TEXT APPL-EOF move 'is Complete...' to 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 * *****************************************************************

Example 02, Job Submit & Modify JCL


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

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.

Example 02, JCL Member to Submit a Job to the Internal Reader


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

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-2011 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=* //

Example 02, Sample COBOL Program


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

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 01 SUBTORDR-FILE DATA RECORD IS SUBTORDR-REC . 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 01 01 01 01 01 01 01

JCLINPUT-STATUS. 05 JCLINPUT-STATUS-L 05 JCLINPUT-STATUS-R JCLINPUT-EOF JCLINPUT-OPEN-FLAG SUBTORDR-STATUS. 05 SUBTORDR-STATUS-L 05 SUBTORDR-STATUS-R SUBTORDR-EOF SUBTORDR-OPEN-FLAG JCLINPUT-LRECL SUBTORDR-LRECL pic 9(5) pic 9(5)

pic pic pic pic pic pic pic pic

X. X. X X X. X. X X

value 'N'. value 'C'.

value 'N'. value 'C'.

value 00080. 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 88 APPL-AOK 88 APPL-EOF CHANGE-JOB-CLASS CLASS-SEARCH CLASS-MODIFY pic S9(9) value 0. value 16. pic X pic X(7) pic X(7) comp.

01 01 01 01

value 'Y'. value SPACES. value SPACES.

01

JCLINPUT-TOTAL. 05 JCLINPUT-RDR pic 9(9) 05 filler pic X(3) 05 filler pic X(23) SUBTORDR-TOTAL. 05 SUBTORDR-ADD pic 9(9) 05 filler pic X(3) 05 filler pic X(23) MESSAGE-TEXT-01. 05 filler pic X(20) 05 JCL-PARM-LENGTH

value 0. value ' - '. value 'Line count for JCLINPUT'. value 0. value ' - '. value 'Line count for SUBTORDR'.

01

value 'Parameter length is '. 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 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 APPL-EOF move 'is Complete...' to 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 * *****************************************************************

Shared Members
(Next) (Previous) (Table-of-Contents)

This section described the members that are used by other application or more than one (1) of the preceding examples.

Shared Members, JCL Member to be Submitted via Internal Reader


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

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 //*

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 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.

Das könnte Ihnen auch gefallen