Page 1 of 2

Difference between Catalogued Procedure & Include Statement

PostPosted: Fri Jan 21, 2011 10:37 pm
by shabukumar
Hi,

As both catalogued procedure and Include statement works in the same way, kindly let me know How include differs from a catalogued procedure?

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Fri Jan 21, 2011 11:06 pm
by Bill Dennis
A cataloged procedure (PROC) is usually a complete job step or series of job steps and allow for supplying variable values on the call which are substituted into the inserted JCL. PROCs are called from a system-defined set of libraries.

INCLUDE is generally used for a subset of the job stream and can be found in user-specified libraries.

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Sat Jan 22, 2011 12:03 am
by NicC
They do NOT work in the same way. If you want an analogy with COBOL you could say the cobol program was the procedure and a copybook the included code. Of course, if you do not know COBOL that analogy is a waste of space!

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Sat Jan 22, 2011 2:51 am
by dick scherrer
Hello,

As both catalogued procedure and Include statement works in the same way,
Only in the most limited (oversimplified) sense. . .

Suggest you thoroughly read about Cataloged PROCedures . . . Both the creation of these as well as the execution.

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Sat Jan 22, 2011 1:36 pm
by shabukumar
Thank you to all for your replies

Bill:
Yes, Catalogued procedures will be searched in the JCLLIBs and then in PROCLIBs by default. INCLUDE can be found in JCLLIBs only. However, using INCLUDE statement I can have a series of job steps. I can make use of symbolic parameters but not overriding parameters in INCLUDE. Kindly let me know if I am wrong and anything else left.

Nic:
I understood both not works in the same way. I mean that for both we are using JCLLIB statement for to locate the catalogued procedure and member to be included. Of Course, I know COBOL and already done with cobol program as a procedure. But the copybook you mean that the copy library. If yes, there is no relation between the INCLUDE statement of JCL and the copy lib. Because we are making use of LIB option and SYSLIB DD statement in the compiler. Kindly let me know am I clear.

Dick:

I thoroughly read about Catalogued PROCedures and done the hands on as well for both Catalogued procedure and Include statement. But I hope overriding parameter cannot be used in INCLUDE Statement. I am not sure. Kindly let me know.

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Sat Jan 22, 2011 6:21 pm
by prino
shabukumar wrote:Bill:
Yes, Catalogued procedures will be searched in the JCLLIBs and then in PROCLIBs by default. INCLUDE can be found in JCLLIBs only. However, using INCLUDE statement I can have a series of job steps. I can make use of symbolic parameters but not overriding parameters in INCLUDE. Kindly let me know if I am wrong and anything else left.
Bull! INCLUDEs will also be found in PROCLIBs.
shabukumar wrote:Nic:
I understood both not works in the same way. I mean that for both we are using JCLLIB statement for to locate the catalogued procedure and member to be included. Of Course, I know COBOL and already done with cobol program as a procedure. But the copybook you mean that the copy library. If yes, there is no relation between the INCLUDE statement of JCL and the copy lib. Because we are making use of LIB option and SYSLIB DD statement in the compiler. Kindly let me know am I clear.
About as clear as mud...
shabukumar wrote:Dick:
I thoroughly read about Catalogued PROCedures and done the hands on as well for both Catalogued procedure and Include statement. But I hope overriding parameter cannot be used in INCLUDE Statement. I am not sure. Kindly let me know.
If an INCLUDE contains symbolic parm, and it occurs in a PROC with the same, these symbolic parms will be used for the symbolics on the INCLUDE, you could very easily have tried this yourself!

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Sat Jan 22, 2011 8:44 pm
by NicC
You did not seem to understand what I was illustrating: the INCLUDE in JCL includes other JCL, copying a COPYBOOK into a COBOL program copies other COBOL code and/or comments into a COBOL program. The idea is the same - they just work on different data in different environments.
Is what I posted before now clear to you?

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Mon Jan 31, 2011 7:32 pm
by shabukumar
Nicc,

The same you provided now was the same I told.

Friends,

Kindly let me know how exactly include statement differ from catalogued procedure as I am now into lot more confusion. I would be grateful to you. Please help.

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Mon Jan 31, 2011 7:50 pm
by Robert Sample
INCLUDE groups and procedures are very similar. From the JCL Reference manual:
18.1.7 Considerations for Using INCLUDE Groups

System and private libraries can contain both procedures and INCLUDE groups. The order in which the system searches system and private libraries for INCLUDE groups is the same as the search order used for procedures (see "Using a Procedure" in topic 5.1.3).

INCLUDE groups cannot contain the following JCL statements:


JOB statements
PROC and PEND statements
JCLLIB statements
JES2 and JES3 statements and commands
DD * and DD DATA statements

Do not define procedures in an INCLUDE group. However, you can put EXEC statements that invoke procedures in an INCLUDE group.
You can use INCLUDE statements to imbed INCLUDE groups that contain DD and OUTPUT JCL statements, which allows you to use the same data set definitions for various jobs.

When the INCLUDE statement and the INCLUDE group contain symbolic parameters, the system substitutes the values that are current at the time the symbolic parameter is encountered. Values assigned to symbolic parameters in an INCLUDE group (such as with the SET statement) are valid for use on subsequent JCL statements.
and
5.1.3 Using a Procedure

To execute a procedure, call it on an EXEC statement in an in-stream job. Specify the name of the procedure in the PROC parameter of the EXEC statement. The step uses the JCL statements in the procedure as if the JCL statements appeared in the input stream immediately following the EXEC statement. If necessary, you can modify the procedure for the current execution of the job step.

When you call a procedure, the system retrieves it using the following search order:



From the input stream
If the called procedure is an in-stream procedure, the system retrieves it from the job input stream. You must place the in-stream procedure before the EXEC statement that calls it.


From a private library
If the called procedure is cataloged in a private library, the system retrieves it from the private library that you specify on the JCLLIB statement that appears earlier in the job stream.


From the system library (in a non-APPC scheduling environment)
If the called procedure is cataloged in a system library, the subsystem retrieves it as follows:


In JES2, from the library name on the PROCLIB= parameter on a JES2 /*JOBPARM statement. See "/*JOBPARM Statement" in topic 27.3 for more information.
In JES3, from the library name on the PROC= parameter of the JES3 //*MAIN statement. See "//*MAIN Statement" in topic 28.8 for more information.
In MSTR, the data set specified by the IEFPDSI DD statement in the currently active master JCL is searched for procedures. The default master JCL specifies SYS1.PROCLIB.
Difference 1: an INCLUDE group cannot contain PROC or PEND whereas a procedure can contain them
Difference 2: an INCLUDE group must be external whereas a procedure can be in-stream
Difference 3: procedures are allowed to include JES statements and INCLUDE groups cannot

These aren't the only differences but they're enough to clarify the issue.

Re: Difference between Catalogued Procedure & Include Statem

PostPosted: Mon Jan 31, 2011 9:09 pm
by shabukumar
Thanks for your reply Robert.

All I know except difference 3. I think I am expecting the 3rd difference. If you dont mind, Kindly provide me the samples for JES statements so that I can be clear on it. Will be thankful to you.