Saturday 10 August 2013

Instream Procedure.



An instream procedure consists of a PROC statement, followed by the JCL for the procedure, followed by a PEND statement.

Before cataloging a procedure in a procedure library, it’s a good idea to test it. You can do that by inserting the procedure into a job as an instream procedure.

A name is always required on the PROC statement for an instream procedure. You can also specify a name on the PEND statement, but it’s optional.

JCL statements falling between the PROC and PEND statements are not executed when first encountered. Instead, they’re scanned for errors and retained as a temporary procedure. Any JCL statements after the PEND statement are recognized as normal statements and are executed.
An instream procedure should be placed near the beginning of a job stream, before any EXEC statement that refers to it.

An instream procedure should be placed near the beginning of a job stream, before any EXEC statement that refers to it.

GDG

SYS1.PROCLIB is normally used to store system oriented cataloged procedures, like those supplied by IBM.

It can also be used to store other types of cataloged procedures (like those for production jobs, job steps, or jobs that are in development), but other private procedure libraries are often created for these.

The JCLLIB statement lets you identify libraries as private procedure libraries that the system should search to find a specified cataloged procedure.

The job will search the JCLLIB libraries in the order in which they’re coded. If the procedure is not found in any of the named libraries, SYS1.PROCLIB is searched.
The JCLLIB statement must appear after the JOB statement but before any EXEC statements in the job.

The system and private libraries you specify in the JCLLIB statement can contain both procedures and INCLUDE groups.

Syntax JCLLIB statement

//[name] JCLLIB ORDER=(library[,library]…)

ORDER      

 Specifies the names of the libraries to be searched for cataloged procedures. You can specify private libraries, system libraries, and installation-defined libraries. The system will search the libraries in the order specified.

A job that invokes a cataloged procedure in a test library

//MM01RN JOB (36512),'R MENENDEZ',NOTIFY=MM01
// JCLLIB ORDER=(MMA2.TEST.PROCLIB,MMA2.PROD.PROCLIB)
//STEP1 EXEC INV3000
//


The search sequence used to find procedure INV3000

MMA2.TEST.PROCLIB ---> MMA2.PROD.PROCLIB --> SYS1.PROCLIB

INCLUDE

The INCLUDE statement is similar to the EXEC statement for a procedure in that it lets you copy text directly into your job stream. When the job is submitted, the INCLUDE group (the JCL statements in the library member that’s specified) replaces the INCLUDE statement, and the system processes the embedded text as part of the job stream.

You can use the INCLUDE statement to copy portions of a step, such as a single DD statement or a group of commonly used DD statements.

INCLUDE statements can be nested up to 15 levels deep.

The JCL submitted for processing

//RC01RN  JOB (36512),'R XXXXXXX',NOTIFY=RC01
// JCLLIB ORDER=MMA2.PROCLIB
//INV3010 EXEC PGM=INV3010
//SYSOUT  DD SYSOUT=*
// INCLUDE INVMAST
//INVSEL  DD DSNAME=&&INVSEL,DISP=(NEW,PASS),
//           UNIT=SYSDA,SPACE=(CYL,(20,10))
//SELCTL  DD DUMMY
//INV3020 EXEC PGM=INV3020
//SYSOUT  DD SYSOUT=*
//INVMAST DD DSNAME=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=*
//

No comments:

Post a Comment

New In-feed ads