Showing posts with label JOB statement. Show all posts
Showing posts with label JOB statement. Show all posts

Wednesday, 10 April 2019

How to schedule a job for a specific system?


JCL
How to schedule a job for a specific system?
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 Architecture.
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

SYSTEM= {[/](main-name,…)} {JGLOBAL} {JLOCAL} {ANY} 


Explanation


main-name

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.

JGLOBAL

The job must run on the global processor.

JLOCAL

The job can run on any local processor.

ANY

The job can run on any available processor.

Specifying system affinity

Under JES2

/*JOBPARM  SYSAFF=MVSA
/*JOBPARM  SYSAFF=(MVSA,MVSB)
/*JOBPARM  SYSAFF=ANY

Under JES3

//*MAIN    SYSTEM=(MVSA,MVSC,MVSD)
//*MAIN    SYSTEM=JLOCAL
//*MAIN    SYSTEM=/MVSB



Share Blog
Mainframe-Forum

Tuesday, 9 April 2019

How to create and use cataloged procedures.

In-stream procedure
JCL Catalog Procedure's
A JCL cataloged procedure (or just procedure) is a pre-written segment of code consisting of one or more job steps that you can include in a job stream. 

By using procedures/JCL catalog procedure, the amount of JCL coding you have to do is reduced, resulting in fewer coding errors and greater productivity.

Definition of cataloged procedure. 

A cataloged procedure is a series of JCL statements that are stored in a partitioned data set and may be invoked by any job on the system.

Typical types of cataloged procedures

  • IBM-supplied procedures that compile, link, and run programs
  • JCL steps that back up, delete and define VSAM files
  • Programs that are required by many jobs
  • Large jobs where it makes sense to separate the steps into manageable procedures.
Important Points:
Cataloged procedures are stored in partitioned data sets and can be invoked by any job on the system. When you invoke a cataloged procedure, the system looks for it in the system procedure library, SYS1.PROCLIB, unless you specify otherwise.

The syntax for invoking a JCL procedure


EXEC [PROC=]procedure-name

Explanation

procedure-name Identifies the procedure to be called and executed. For cataloged procedures, it’s the member name of the procedure. For in-stream procedures, it’s the name on the PROC statement that begins the procedure.

Example:

A job that invokes a cataloged procedure


//RC01RN JOB (45512),'R ROGGER',NOTIFY=RC01
//STEP1 EXEC TMP3000
//


The cataloged JCL procedure named TMP3000 that is invoked


//TMP3000  PROC 
//TMP3010 EXEC PGM=EMP33010
//SYSOUT  DD SYSOUT=*
//INVMAST DD DSNAME=RCA2.INVE.MASTER.FILE,DISP=SHR
//INVSEL  DD DSNAME=&&INVSEL,DISP=(NEW,PASS),
//           UNIT=SYSDA,SPACE=(CYL,(20,10))
//SELCTL  DD DUMMY
//INV3020 EXEC PGM=EMP3020
//SYSOUT  DD SYSOUT=*
//INVMAST DD DSNAME=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=*


JCL


Saturday, 10 August 2013

JCL IF/THEN/ELSE/ENDIF Statement Construct.

JCL
JCL IF/THEN/ELSE/ENDIF Statement Construct.


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}
// ENDIF



JCL
Share http://mainframe-forum.blogspot.com

Created with Artisteer

JCL Command Quick Reference.


JCL Command
JCL Command Quick Reference.
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.

 Job Control Language Statements  Quick Reference.

Sunday, 28 July 2013

JCL SORT | JCL SORT CARDS | JCL SORT COND

JCL Sort.
JCL Sort.

Sequential files are still commonly used in mainframe shops to store transaction records. Then, before the records in these files can be processed, they often need to be sorted or merged into an appropriate sequence. For instance, sales transactions may need to be sorted into salesperson, customer, or item number sequence before they can be used to prepare reports or update master files. 

To do this sorting or merging, you use the sort/merge utility that comes with OS/390. As you will see, you normally use JCL to run this utility as a standalone program. However, you can also use this utility to do an internal sort or internal merge within an application program. 

The JCL requirements for sorting


Sort the records in a file, the sort/merge utility (or program) reads the records from one or more input files, sorts them based on the data in one or more control fields (or sort keys), and writes the sorted records to an output file. 

If you want to sort two or more files at the same time, you can concatenate them like this: 

//SORTIN DD DSNAME=RC01.INVOICE.TRANS.APRIL,DISP=SHR 
//       DD DSNAME=RC01.INVOICE.TRANS.MAY,DISP=SHR
//       DD DSNAME=RC01.INVOICE.TRANS.JUNE,DISP=SHR

This assumes of course that the control field is in the same location in all of the files.

Although the JCL for this job step provides for only one work file, you can provide for more than one. Either way, the space allocation for the work files should be about twice the combined sizes of the input files. That extra space lets the sort/merge program work more efficiently while it does the sorting.


JCL Sort Utility
JCL Sort.

The DD statements required by a sort
ddname
Use
SORTLIB
A partitioned data set that contains the modules required by the sort/merge utility. Normally, SYS1.SORTLIB.
SYSOUT
The messages produced by the sort/merge utility. Normally, a SYSOUT data set.
SORTIN
The input file or files to be sorted. If more than one file is to be sorted, you can concatenate them.
SORTOUT
The sorted output file. It can be a new non-VSAM file with DISP=(NEW,KEEP) or DISP=(NEW,CATLG); an extension of an existing non-VSAM file with DISP=MOD; or an existing VSAM file.
SORTWKnn
The work files that are required by the sort, where nn is a consecutive number starting with 01. One or two files are usually adequate, and the total DASD space allocated to the work files should be about twice the input file size. You can specify up to 255 work files.
SYSIN
The sort control statements. Normally, an instream data set.

Example: Sample SORT JCL.


//RCORT01 JOB  (...JOB CARD..) 
//SORT    EXEC PGM=SORT
//SORTLIB DD DSNAME=SYS1.SORTLIB,DISP=SHR
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DSNAME=RCKT10.INVOICE.TRANS,DISP=SHR
//SORTOUT DD DSNAME=RCKT10.INVOICE.TRANS.SORTED,DISP=(NEW,CATLG),
//                  UNIT=SYSDA,VOL=SER=MPS8BV,
//                  SPACE=(CYL,(10,5))
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(20,5))
//SYSIN    DD * 

  SORT FIELDS=(9,5,CH,A)
/*



New In-feed ads