Mainframe Forum: A comprehensive repository for programming tutorials and technology news. Got a minute? Click upon those blue words to start learning in Cobol, DB2, CICS, JCL, CA7, APIs, DevOps, Agile, JAVA, SORT, Excel macro, python, and mainframe tools.
As you might be aware, JES2 and JES3 can be used to manage a multiprocessor network that consists of more than one system.
In a multiprocessor network, each system operates under the control of its own copy of OS/390 or ZOS.
However, the JES components of each processor’s operating system are connected in various ways to the JES components of the other processors, and a common spool is used to service all the processors in the network.
IBM Mainframe Architecture
As a result, JES2 and JES3 can control how jobs are processed by the systems within the multiprocessor network.
The term system affinity can be used to describe the relationship between a job and the system on which it executes.
Under JES2, you use the SYSAFF parameter of the /*JOBPARM statement to specify system affinity.
Under JES3, you use the SYSTEM parameter of the //*MAIN statement.
The global processor is the processor that’s in charge of the entire network. A local processor is one that’s controlled by the global processor.
The syntax for the SYSAFF parameter of the JES2 /*JOBPARM statement
SYSAFF= {*} {(system-name,…)} {ANY}
Explanation
*
The job will run on the system that reads it (the default).
system-name
A one- to four-character system-id defined in the multiprocessor network that identifies which processor will run the job. If more than one system-name is specified, the job can run on any one of the processors listed.
ANY
The job can run on any available processor.
The syntax for the SYSTEM parameter of the JES3 //*MAIN statement
A system-id defined in the multiprocessor network that identifies which processor will be used to run the job. If more than one main-name is specified, the job can run on any one of the processors listed.
/
The job can run on any processor except the one(s) listed.
Welcome back to another interesting JCL Tutorial on "IEHLIST" in JCL. In this session, you'll learn the basics of the IEHLIST utility. You'll also go through the IEHLIST examples to understand how the IEHLIST utility is used to list entries?
The term JCL stands for Job Control Language. Job Control Languageis the command language of the IBM z/OS. JCL defines a job by furnishing information that distinguishes the programs to be executed and the data to be processed. JCL tells the operating system what to do.
What is IEHLIST Utility?
JCL IEHLIST Utility
Utility programs are pre-written applications, generally used in IBM Mainframes by system programmers and application developers to perform day-to-day maintenance tasks.
IEHLIST utility in JCL is another important system utility popularly used in Mainframe. It is generally used to list entries in the directory of one or more partitioned data sets or PDSEs, or entries in an indexed or non-indexed volume table of contents.
Any number of listings can be requested in a single execution of the program.
Let's focus on JCL IEHLIST Utility in JCL Examples.
Example 1: List Partitioned Directories Using DUMP and FORMAT.
In this IEHLIST utility example, the directory of a PDSE is listed. In addition, the directories of two partitioned data sets that reside on the system residence volume are listed.
DD1 DD statement defines the system residence device.
DD2 DD statement defines a device on which a disk volume (333222)
is mounted.
SYSIN DD statement defines the control data-set, which follows in the input stream. The first IEHLIST LISTPDS statement indicates that the PDSE
directory belonging to data set RC42.PDSE1.FLE is to be listed. The listing is in unedited (dump) format. This data set resides on volume 222222.
The second LISTPDS statement indicates that partitioned data set directories belonging to data sets RC55.PART1 and D55.PART2 are to be listed. The listing is in an edited format. These data sets exist on the system residence volume.
Example 2: List
Non-indexed Volume Table of Contents [IEHLIST listvtoc]
In this example, a
non-indexed volume table of contents is listed in the first edited format. The
edited listing is supplemented by an unedited listing of selected data set
control blocks.
Finally, this marks the end of today's IEHLIST in JCL Tutorial. JCL IEHLIST is an IBM-supplied utility that is used for list entries. You can also include IEHLIST from Rexx. Do check out our mainframe blog for more tutorials on REXX. JCL, COBOL, etc.
►Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. Also, Please visit mention the link below to stay connected with Topictrick and the Mainframe forum on -
IEBGENER Utility in JCL is an easy way to copy, print, and create non-VSAM datasets. The IEBGENER utility is used to copy multiple files or copy a single file. In this session, you'll learn the basics of the IEBGENER utility, followed by IEBGENER DD control statements and the IEBGENER SYSIN control statements. To reinforce your understanding, I will walk you through the IEBGENER examples. Let's get started with an introduction to the IEBGENER utility.
IEBGENER Utility Tutorial - Agenda.
Introduction.
IEBGENER DD Statements/IEBGENER SYSIN Statements.
IEBGENER Vs IEBCOPY utility.
IEBGENER Examples.
IEBGENER in JCL - YouTube video.
Conclusion.
Introduction.
Let's try to answer or let's try to understand what is JCL utility or what do you understand by the term utility. In layman terms, mainframe utility programs or just utilities are the programs that can be used for common data processing functions like copying or printing a data set these utilities are supplied with IBM z/OS and they're widely used in batch jobs now let's talk about IEBGENER utility.
What is the IEBGENER Utility in JCL?
IBM IEBGENER Utility.
IEBGENER utility in JCL, it is a popular mainframe utility. IEBGENER utility is a copy program that has been a part of the operating system since the first release of OS/360 and one of its many uses is to copy a sequential data set a member of partition data set (i.e. PDS) or PDSE or probably z/OS Unix system services files such as HFS files.
As a result, the IEBGENER utility is used can be used to backup or restore sequential data sets you can also use this utility to print a non-VSAM sequential data set by copying it to an SYSOUT data set. Finally, the common use of IEBGENER utility is to create, reformat, and backup non-VSAM sequential data sets
You can use IEBGENER to perform the following daily tasks:
IEBGENER utility in the JCL is used to create a backup of the sequential data set.
IEBGENER utility can be used to print a non-VSAM sequential data set.
IEBGENER utility can be used to rearrange fields and convert their data formats.
IEBGENER utility can amplify an existing partitioned data set (PDS).
IEBGENER utility can change or re-block the data set record logical length. Copy user labels on sequential output data sets.
The following figure, explains the process of creating partitioned data set from sequential data et. The sequential dataset is represented by the left section of the figure.
The IEBGENER utility statement is used to split a sequential dataset into logical record groups. Finally, the right section of the fig represents a partitioned data set.
IEBGENER Utility Creating PDS sequential data set.
IEBGENER DD Statements and IEBGENER SYSIN control statements.
Now, let's try to understand what are the different DD statements that are required by an IEBGENER utility. There are four different DD statements that are required by an IEBGENER utility.
JCL IEBGENER Utility DD Statement.
SYSUT1 - it's used to specify the input file.
SYSUT2 - it's used to specify the output file.
SYSPRINT - it's an output message file.
SYSIN - it's used to specify the control parameters.
Important point - If you do not want to use a control statement the SYSIN DD statement is still required. You must code it as a dummy data set.
What is the difference between IEBGENER utility and IEBCOPY utility (iebgener vs iebcopy)?
Well, the correct answer is that both utilities are used for data processing. However, the IEBGENER utility is used for the non-VSAM sequential data sets. It's used to copy, create print or reformat data set as you copy.
IEBCOPY utility in the JCL is primarily used to perform the operation on a personal data set (PDS) or PSDE. It's used to copy, merge, compress, or archive a PDS into a sequential file.
IEBGENER Example - Sample JCL to invoke the IEBGENER utility (iebgener syntax).
The following IEBGENER JCL example illustrates the use of the IEBGENER utility to copy multiple files or to copy PDS members. Let's discuss each step one by one.
//TPRCK99AJOB'TOPICTRICK',MSGCLASS=A,CLASS=C,
//MSGLEVEL=(1,1),NOTIFY=&SYSUID
//*
//* PROJECT DESC:: SAMPLE JCL TO INVOKE IEBGENER UTILITY.
//* STEP04 - IEBGENER example to Reformat data while copying the data.
//* - How to use IEBGENER Generate and Record field.
//*
//STEP04EXECPGM=IEBGENER
//SYSUT1DDDSN=Z03130.INPUT.FILE,DISP=SHR
//SYSUT2DDDSN=Z03130.INPUT.FILE.BKP,DISP=OLD
//SYSPRINTDDSYSOUT=*
//SYSINDD *
GENERATE MAXFLDS=11,MAXLITS=10
RECORD FIELD=(23,1,,1),FIELD=(8,'EMP SAL-',,24), X
FIELD=(4,24,,32)
/*
//
Created with Artisteer
IEBGENER utility in JCL - YouTube Video.
Conclusion.
Finally, this marks an end to the JCL IEBGENER Utility tutorial (JCL Utility). In this tutorial, you learn the basics of IEBGENER utility and the use of IEBGENER utility. Also, you learned how to use the IEBGENER utility in JCL. Do check out COBOL LEVEL 88 Condition.
►Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. Also, Please visit mention the link below to stay connected with Topictrick and the Mainframe forum on -
The IF/THEN/ELSE/ENDIF statement construct provides a simple meaning of selectively executing jobs steps and eliminates the need to struggle with the COND parameter.
The IF statement is always followed by a relational-expression and a THEN clause. Optionally, an ELSE clause can follow the THEN clause. An ENDIF statement always follows the ELSE clause, if present, or the THEN clause.
The THEN clause specifies the job steps that the system processes when the evaluation of the relational-expression for the IF statement is a true condition. The system evaluates the relational-expression at execution time.
The ELSE clause specifies the job steps that the system processes when the evaluation of the relational-expression for the IF statement is a false condition.
The ENDIF statement indicates the end of the IF/THEN/ELSE/ENDIF statement construct and must be coded for each construct.
You can nest IF/THEN/ELSE/ENDIF statement constructs up to a maximum of 15 levels. The steps that execute in a THEN clause and an ELSE clause can be another IF/THEN/ELSE/ENDIF statement construct.
You code the construct as follows:
//[name] IF [(]relational-expression[)] THEN [comments]
. . action when relational-expression is true
//[name] ELSE [comments]
. . action when relational-expression is false
//[name] ENDIF [comments]
The IF statement consists of the characters // in columns 1 and 2 and the five fields: name, operation (IF), the relational-expression, the characters THEN, and comments.
The relational-expression can be enclosed in parentheses.
The ELSE statement consists of the characters // in columns 1 and 2 and the three fields: name, operation (ELSE), and comments.
The ENDIF statement consists of the characters // in columns 1 and 2 and the three fields: name, operation (ENDIF), and comments.
Exmple : 1
// IF RC > 4 THEN
You can continue relational-expressions on the next JCL statement. Break the relational-expression where a blank is valid on the current statement, and continue the expression beginning in column 4 through 16 of the next statement. Do not put comments on the statement that you are continuing. You can code comments after you have completed the statement.
Example : 2
//TESTCON IF (RC = 8 | RC = 10 | RC = 12 |
// RC = 14) THEN COMMENTS OK HERE
.
.
A relational-expression consists of:
Comparison operators
Logical operators
NOT (¬) operators
Relational-expression keywords.
Example : 3
// IF (STEPA.RC GE 1 AND STEPA.RC LT 4) THEN
//STEP010 EXEC PGM=EMP001 {system execute this step for RC 0 to 4}
// ELSE
//STEP020 EXEC PGM=EMP002 {system execute this step for RC > than 4}
Job Control Language (JCL) is used to tell the system what program to execute, followed by a description of program inputs and outputs. It is possible to submit JCL for batch processing or start a JCL procedure (PROC), which is considered a started task.
The details of JCL can be complicated but the general concepts are quite simple. Also, a small subset of JCL accounts for at least 90% of what is actually used.
Job control language (JCL) is a set of statements that you code to tell the z/OS® operating system about the work you want it to perform.
Although this set of statements is quite large, most jobs can be run using a very small subset. Below is list of important command.
A batch job can delete, keep, catalog, or overwrite a data set based on one DD statement. That is why JCL data set protection is not only a security topic. It is also a job-control topic. A small mistake in DISP, RETPD, or EXPDT can keep a file longer than expected, remove it too early, or let the wrong job try to update it.
This guide explains the basic checks in plain English. You will see what JCL controls, what RACF controls, and what to review before a production job touches business data.
What Data Set Protection Means In JCL
In JCL, a data set is a named file used by a batch job. It might be a customer extract, a payroll file, a report, a temporary work file, or a GDG generation. Protection means three practical things:
Only approved users and jobs should read or change the data set.
The job should use the right disposition, such as keep, catalog, delete, or pass.
The data set should not expire or be deleted before the business is finished with it.
JCL helps describe how the job should handle the data set. RACF or another security product decides whether the user or job has access. Storage rules decide how long the data set remains on disk or tape.
The Three JCL Fields To Check First
Field
Simple meaning
Common check
DSN
The data set name.
Confirm the job points to the right file, high-level qualifier, and GDG generation.
DISP
What the job wants to do with the file.
Check whether the job needs old, new, shared, or temporary access.
RETPD or EXPDT
How long the file should be retained.
Confirm the retention period or expiry date matches the business rule.
DISP: How The Job Handles The Data Set
DISP tells z/OS the starting status of a data set and what to do with it when the step ends. It is one of the first fields to review when a job creates or updates a file.
In the first line, DISP=SHR means the job is sharing an existing input file. In the second example, the job creates a new output file. If the step ends normally, z/OS catalogs it. If the step fails, z/OS deletes it.
Common DISP Values
OLD means the job needs exclusive access to an existing data set.
SHR means the job can share an existing data set.
NEW means the job creates a new data set.
MOD means the job appends to an existing data set or creates it if it does not exist.
Use OLD only when the job really needs to update the data set without another job using it at the same time. Use SHR for normal read-only input where sharing is acceptable.
RETPD And EXPDT: Retention Checks
RETPD gives a retention period in days. EXPDT gives an expiry date. Both are used to protect a data set from being removed too early. They are common on output files, archive files, and files written to tape or managed storage.
This example asks the system to retain the archive for 90 days. A site may prefer a storage class, management class, or another local rule instead of coding retention directly in every job. Follow your site standard.
When To Use RETPD
Use RETPD when the rule is easy to express as a number of days, such as 7 days for a daily extract or 90 days for a monthly archive.
When To Use EXPDT
Use EXPDT when the business rule is tied to a date, such as a legal hold date or a fixed archive expiry date. Avoid hard-coded old dates copied from another job.
RACF: Who Can Read Or Change The Data Set
JCL does not grant security access by itself. RACF protects many kinds of z/OS data sets by using data set profiles. Those profiles can cover VSAM, non-VSAM DASD, tape data sets with standard labels, SMS-managed data sets, and GDG data sets.
A security administrator can protect a data set with a discrete profile for one data set, or a generic profile for a group of names. For example, a generic profile such as PAYROLL.** can protect many payroll data sets under the same high-level qualifier.
LISTDSD DATASET('PAYROLL.**') ALL
PERMIT 'PAYROLL.**' ID(PAYBATCH) ACCESS(READ)
The first command lists a RACF data set profile. The second command is an example of granting access. Do not run security changes unless your role and change ticket allow it.
JCL Protection Checklist Before Production
Check the DSN value. Make sure the job points to the intended data set.
Check DISP. Confirm whether the job should read, create, update, append, pass, catalog, or delete the data set.
Check RETPD or EXPDT. Make sure the retention rule is not copied from an unrelated job.
Check RACF access. Confirm the job user ID can read or update the data set profile.
Check GDG use. Make sure the job uses the right generation, such as (0), (+1), or (-1).
Check restart behavior. A restart can fail if the first run already cataloged a data set that the next run tries to create again.
Common Mistakes
Using DISP=OLD For Read-Only Input
DISP=OLD can block another job from using the same data set. If the program only reads the file, DISP=SHR may be the better choice.
Creating A File Twice After Restart
A failed job may leave a cataloged output data set behind. If the restart step tries DISP=(NEW,CATLG,DELETE) again, the job can fail because the data set already exists.
Copying RETPD From Another Job
A retention value copied from an old job may not match the current file. A 7-day report and a 7-year audit archive should not use the same retention rule.
Does JCL protect a data set from unauthorized users?
No. JCL describes how a job wants to use the data set. RACF or another security product decides whether the job user ID has permission.
What is the difference between RETPD and EXPDT?
RETPD keeps a data set for a number of days. EXPDT uses a specific expiry date.
What does DISP=(NEW,CATLG,DELETE) mean?
It means the job creates a new data set, catalogs it if the step ends normally, and deletes it if the step fails.
Why does a restart fail when the job creates a data set?
The earlier run may have already cataloged the output data set. The restart then tries to create the same name again. Check the catalog and restart step before rerunning.
Before changing JCL in production, check the data set name, disposition, retention rule, RACF profile, and restart path together.
A print job can need control information that is not a normal DD, EXEC, or OUTPUT statement. In z/OS JCL, CNTL marks the start of one or more program control statements, and ENDCNTL marks the end of that group. The common example is a PSF direct-printing job where a PRINTDEV statement sits between CNTL and ENDCNTL.
Group the control statements.
What are CNTL and ENDCNTL in JCL?
CNTL and ENDCNTL define a block of program control statements in the input stream. IBM lists CNTL as the statement that marks the beginning of one or more program control statements and ENDCNTL as the statement that marks their end.
Most everyday batch jobs never use these statements. You are more likely to see them in special printing work, especially where a job supplies printer initialization data through PRINTDEV.
The label matters because the DD statement can refer to the control block by using the CNTL=*.label parameter. Keep the names short and clear. JCL statement names begin after the leading // and can be up to eight characters.
PRINTDEV example
This sample shows the shape of a direct-printing step. Site standards vary, so copy real printer parameters from your print support team instead of guessing values.
The DD statement named PRTDD points back to the PSFCTL control block. That connection is the reason the label needs to be stable and easy to read.
How the statements work together
Part
Purpose
Check during review
CNTL
Starts the program control block.
Has a label that the DD statement can reference.
Control statement
Supplies subsystem or program control data, such as PRINTDEV.
Uses parameters approved for that subsystem.
ENDCNTL
Ends the control block.
Appears after the control statements and before the referencing DD.
DD CNTL=*.label
Connects the DD statement to the control block.
References the correct label in the same step.
Placement rules
Place the CNTL and ENDCNTL block in the same step as the DD statement that references it. In the usual pattern, the DD statement follows the block and uses CNTL=*.name to point to it.
Do not treat CNTL as a substitute for PROC, INCLUDE, or IF/THEN/ELSE/ENDIF. It has a narrower job: it groups control statements for a program or subsystem that expects them.
When would you use CNTL and ENDCNTL?
PSF direct printing
IBM's direct-printing examples show CNTL, PRINTDEV, and ENDCNTL used together. This is the main case a JCL learner is likely to find in old production libraries.
Subsystem-specific control data
Some subsystem interfaces accept control statements through the input stream. If your site uses that pattern, the production JCL should include a runbook note that explains who owns the parameters.
Legacy print procedures
Old cataloged procedures can hide this block behind symbolic parameters. When a print problem appears, expand the PROC or review the resolved JCL before changing CNTL labels.
Common mistakes
Using the wrong label
If CNTL=*.PSFCTL points to a label that does not exist in the step, conversion or allocation can fail before the program does useful work.
Putting the DD in another step
The control block and the referencing DD belong in the same job step. A later step cannot safely rely on a prior step's CNTL block.
Adding comments where the subsystem example forbids them
For PSF direct-printing examples, IBM states that CNTL and ENDCNTL have no parameters and must not have comments on the same line. Keep comments on separate //* lines if your site wants notes.
Troubleshooting checklist
Confirm the CNTL label is spelled the same way in CNTL=*.label.
Check the control block is in the same EXEC step as the referencing DD.
Verify the DD appears after the CNTL/ENDCNTL block when your site follows the standard print pattern.
Review the subsystem statement, such as PRINTDEV, against local print support documentation.
Keep labels within the JCL name length rules.
Check the JES conversion messages before changing the program.