Define and use Variables
JCL, SET and Substitute a Variable
  Table of Contents  v-16.10.01 - jclsub01.htm 
  Introduction
  The SET Statement
  SET Statement & Substitute Variable
  Test Job, JCL with a PROCedure
  JCL Member, Parameter Substitution
  JCL and Procedure (or PROC)
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of programs is a mainframe JCL example that will describe how to define (or name) a variable value and then use or change the variable by its referenced name.

The source code, data sets and documentation are provided in a single zipped file called JCLSUB01.ZIP. This zipped file may be downloaded from the SimoTime Web site.


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section The SET Statement

The SET statement is used to define a variable by name and set an initial value for the variable. The format of the SET statement is as follows.

....:....1....:....2....:....3....:....4....:....5....:....6....:....7.
//         SET DSNUT1=SIMOTIME.DATA.SUB998D1
//         SET DSNUT2=SIMOTIME.DATA.SUB100D1

The variable may then be referenced in subsequent Job Steps within the JCL member or within a PROC that is executed by the JCL member. To reference the variable simply precede the name with an ampersand (for example, &DSNUT1).

Table of Contents Previous Section Next Section SET Statement & Substitute Variable

The preceding section described how to SET a value to a variable name. The following two statements show how to reference the variable by name. It is a simple matter of preceding the name with an ampersand.

//SYSUT1   DD  DSN=&DSNUT1,DISP=SHR
//SYSUT2   DD  DSN=&DSNUT2,DISP=(MOD,KEEP,KEEP)

The following shows the spooled output (or SYSOUT) of the expansion of the variable prior to the job being submitted for execution.

 135 //SYSUT1   DD  DSN=&DSNUT1,DISP=SHR
     SUBSTITUTION - DSN=SIMOTIME.DATA.SUB998D1,DISP=SHR
 136 //SYSUT2   DD  DSN=&DSNUT2,
     SUBSTITUTION - DSN=SIMOTIME.DATA.SUB100D1,

Table of Contents Previous Section Next Section Test Job, JCL with a PROCedure

The primary purpose of this sample job is to show the use of a single procedure (or PROC) to handle different files based on the variables passed from the JCL member that executes the PROC.

Table of Contents Previous Section Next Section JCL Member, Parameter Substitution

This is an eight (8) step job. The first job step (MAKENEAT) does the housekeeping and removes files that may be left from a previous execution of the job. Steps 2-5 make (or create) the primary files and the secondary files. Steps 6-8 will demonstrate the actual use of the variables and the use of IEBGENER for appending one file to another.

The following (JCLSUBJ1.jcl) is the JCL Member.

//JCLSUBJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*        This program is provided by SimoTime Technologies          *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Demonstrate parameter substitution.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, MAKENEAT will delete any previously created files.
//* Step 2, MKSUB100 will create a new Base File (SUB100D1).
//* Step 3, MKSUB200 will create a new Base File (SUB200D1).
//* Step 4, MKSUB998 will create a new Base File (SUB998D1).
//* Step 5, MKSUB999 will create a new Base File (SUB999D1).
//* Step 6, AP998001 will add a 998 record to the base file (SUB100D1).
//* Step 7, AP999001 will add a 999 record to the base file (SUB100D1).
//* Step 8, AP999002 will add a 999 record to the base file (SUB200D1).
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use IEBGENER to create and populate a new
//*    record sequential file with eighty (80) byte fixed length
//*    records.
//* 3. Demonstrate how to use the SET and &variablename to use
//*    a single (common or shared) PROC to process different files.
//*
//* *******************************************************************
//* Step   1 of 8, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//SUB100D1 DD  DSN=SIMOTIME.DATA.SUB100D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SUB200D1 DD  DSN=SIMOTIME.DATA.SUB200D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SUB998D1 DD  DSN=SIMOTIME.DATA.SUB998D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SUB999D1 DD  DSN=SIMOTIME.DATA.SUB999D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   2 of 8, Create and populate a new QSAM file (SUB100D1).
//*                This will be a primary file that will have a
//*                secondary files appended in later job steps.
//*
//MKSUB100 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
001 Record 101
002 Record 102
003 Record 103
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.SUB100D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   3 of 8, Create and populate a new QSAM file (SUB200D1).
//*                This will be a primary file that will have a
//*                secondary file appended in a later job step.
//*
//MKSUB200 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
001 Record 201
002 Record 202
003 Record 203
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.SUB200D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   4 of 8, Create and populate a new QSAM file (SUB998D1).
//*                This is a secondary file that is used to append
//*                records to a primary file.
//*
//MKSUB998 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
998 Record 998
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.SUB998D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//*
//* *******************************************************************
//* Step   5 of 8, Create and populate a new QSAM file (SUB999D1)...
//*                This is a secondary file that is used to append
//*                records to a primary file.
//*
//MKSUB999 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
999 Record 999
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.SUB999D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   6 of 8, Append the content of SYSUT2 to SYSUT1 within
//*                a Job Step using the SET statement to define a
//*                variable. Use the variable by referencing with
//*                the name preceded by an ampersand.
//*
//         SET DSNUT1=SIMOTIME.DATA.SUB998D1
//         SET DSNUT2=SIMOTIME.DATA.SUB100D1
//AP998001 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//SYSUT1   DD  DSN=&DSNUT1,DISP=SHR
//SYSUT2   DD  DSN=&DSNUT2,
//             DISP=(MOD,KEEP,KEEP)
//*
//* *******************************************************************
//* Step   7 of 8, Append the content of SYSUT2 to SYSUT1 by setting a
//*                variable value within a Job Step using the SET
//*                statement to define a variable.
//*                Execute a procedure (or PROC). From within the PROC
//*                use the variable by referencing with
//*                the name preceded by an ampersand.
//*
//         SET DSNUT1=SIMOTIME.DATA.SUB999D1
//         SET DSNUT2=SIMOTIME.DATA.SUB100D1
//AP999001 EXEC JCLSUBP1
//SYSOUT   DD  SYSOUT=*
//*
//*
//* *******************************************************************
//* Step   8 of 8, Append the content of SYSUT2 to SYSUT1 by setting a
//*                variable value within a Job Step using the SET
//*                statement to define a variable.
//*                Execute a procedure (or PROC). From within the PROC
//*                use the variable by referencing with
//*                the name preceded by an ampersand.
//*        Note:   This step performs the same function and executes
//*                the same PROC as the preceding step.
//*                However, since the SET statements define a different
//*                value to the variables (DSNUT1 znd DSNUT2) the PROC
//*                will append a different file to a different primary
//*                file.
//*
//         SET DSNUT1=SIMOTIME.DATA.SUB999D1
//         SET DSNUT2=SIMOTIME.DATA.SUB200D1
//AP999002 EXEC JCLSUBP1
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section JCL and Procedure (or PROC)

This procedure is executed multiple times by the primary JCL member. The primary JCL member must set the two (2) variables name DSNUT1 and DSNUT2. The following procedure will append the file named by DSNUT2 to the end of the file named by SYSUT1.

The following (JCLSUBP1.prc) is the PROC Member (or JCL Procedure).

//* *******************************************************************
//*        JCLSUBP1.prc - a JCL Procedure Batch Job Processing        *
//*      This JCL Procedure is provided by SimoTime Technologies      *
//*           (C) Copyright 1987-2016 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Use IEBGENER to append SYSUT2 to the end of SYSUT1
//* Author:  SimoTime Technologies
//* Date:    January 1,1998
//*
//* This PROC needs &DSNUT1 and DSNUT2 defined by the JCL member
//* that is executing this procedure.
//*
//* //       SET DSNUT1=AAAA.BBBB.CCCC
//* //       SET DSNUT2=AAAA.BBBB.DDDD
//* //       EXEC JCLSUBP1
//*
//*********************************************************************
//JCLSUBP1 PROC
//PRCSUBS1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  DSN=&DSNUT1,DISP=SHR
//SYSUT2   DD  DSN=&DSNUT2,DISP=(MOD,KEEP,KEEP)
//*
//         PEND
//*

Table of Contents Previous Section Next Section Summary

The purpose of this suite of programs is to describe how to define and use a variable within a JCL member or Procedure member. This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers.

This document may be used 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 document and the links to other documents are intended to provide a choice of alternatives.

In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. 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 Technologies.

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

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

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

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.

Link to Internet   Link to Server   Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   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.

Link to Internet   Link to Server   Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

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.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and 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. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

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. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions or need assistance with converting non-relational data structures simply give us a call at 415 883-6565 or check the web site at http://www.simotime.com


Return-to-Top
JCL, Define and use Variables, Variable Substitution and SET Statement
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com