Page 1 of 2

PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 3:42 am
by dn2012
Hello,

By using SYMBOLIC Variables in the PROC and pass all the variables from Job. I need to write External Proc which should create a Dataset PDS and copy from one dataset to other.
Dataset should be a TAPE dataset.

Currently I used following JCL for creating a PDS and copy from one dataset to other.

//***************THE DD STATEMENT FOR A NEW DATA SET********************
//*THE IMPORTANT ITEMS ON THE FOLLOWING IS THE DISP AND DCB INFORMATION.
//**********************************************************************
//*
// EXEC PGM=IEFBR14
//SQADB512 DD DSN=WORLD.IMF714.ITD.TEST,DISP=(NEW,CATLG,DELETE),
// STORCLAS=MFI,
// SPACE=(TRK,5),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*


//*COPY A MEMBER FROM OTHER PDS TO THIS PDS THRU IEBCOPY
//******************************************************************
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=WORLD.SL9.JOB3 <== INPUT PDS
//SYSUT2 DD DISP=SHR,DSN=WORLD.JCL.CNTL <== OUTPUT PDS
//SYSIN DD *
COPY OUTDD=SYSUT2,INDD=((SYSUT1,R))
S M=RESTF161

I am new to JCL, this will be my first procedure. Thanks for help.

Thank You

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 4:12 am
by Robert Sample
Dataset should be a TAPE dataset
You did not specify if your INPUT or your OUTPUT data set is to be on tape. And since a PDS cannot exist on a tape (except in unloaded sequential format), then either (1) your requirement cannot be met, or (2) you are copying from a disk PDS to a tape output data set.

Using too many symbolic parameters defeats the purpose -- having EVERY value a symbolic means it takes as long, or longer, to code up the procedure execution than it would to just code up the JCL directly. You can use this as a starting point for coding up your procedure:
//COPYPDS  PROC INHLQ=WORLD,OUTHLQ=WORLD
and continue from there.

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 4:49 am
by dn2012
what about this?

//PDSCRTP4 PROC                                               
//PDSCRTS1 EXEC PGM=IEFBR14                                   
//TEMPLIB1 DD  DISP=(NEW,CATLG),DSN=&DSNAME,                 
//             STORCLAS=MFI,                                 
//             SPACE=(TRK,(45,15,50)),                       
//             RECFM=FB,LRECL=80,BLKSIZE=800
//         PEND                                               
//*


Create a PDS using EXEC and DSNAME substitution

//STEPJ42  EXEC PDSCRTP4,DSNAME=WORLD.DEMO.TEMP

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 5:31 am
by dn2012
sorry above is instream,

I need to create External Proc that should have the below steps.

a) STEP1 Create a Dataset PDS or PS
b) STEP2 Copy from one dataset to other. Dataset should be a TAPE dataset.
c) STEP3 Create GDG Base.
d) STEP4 Create New version GDG file and copy tape data to Disk
e) STEP5 Create VSAM File (KSDS, Key length 30)

I need to use SYMBOLIC Variables in the PROC and pass all the variables from Job. Use COND Code in all the steps.

I need assits in a & b, rest I think I will take care.

thanks

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 5:36 am
by steve-myers
dn2012 wrote:Hello,

By using SYMBOLIC Variables in the PROC and pass all the variables from Job. I need to write External Proc which should create a Dataset PDS and copy from one dataset to other.
Dataset should be a TAPE dataset.

Currently I used following JCL for creating a PDS and copy from one dataset to other.

//***************THE DD STATEMENT FOR A NEW DATA SET********************
//*THE IMPORTANT ITEMS ON THE FOLLOWING IS THE DISP AND DCB INFORMATION.
//**********************************************************************
//*
// EXEC PGM=IEFBR14
//SQADB512 DD DSN=WORLD.IMF714.ITD.TEST,DISP=(NEW,CATLG,DELETE),
// STORCLAS=MFI,
// SPACE=(TRK,5),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
... I am new to JCL, this will be my first procedure. Thanks for help.

Thank You

I hope you realize that WORLD.IMF714.ITD.TEST cannot be a PDS: your SPACE parameter did not specify any directory blocks.

When the SPACE parameter specifies directory blocks, you do not need to specify DSORG=PO; the system is smart enough to realize you are allocating a PDS.

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 8:50 pm
by dn2012
Thanks

I removed DSORG=PO

But how to specify any directory blocks in SPACE parameter.

DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 8:58 pm
by Robert Sample
SPACE=(TRK,(5,1,50))
specifies 5 primary tracks, 1 secondary track for the data set with 50 directory blocks. Based upon your questions, you really need to spend a LONG time reading the JCL Reference manual to learn the details of the different parameters.

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 10:47 pm
by dick scherrer
Hello,

Suggest you explain (in paragraph form, not the "steps" for the proc/jcl) what your process is to accomplish.

Once we all understand your goal, we may be able to offer better suggestions.

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 10:47 pm
by NicC
There is no such item as an 'external' proc - you mean catalogued procedure. Just remove the PEND line from your above code and put he procedure into a library - preferably one called PROC or PROCLIB.

Do not use IEFBR14 to pre-allocate a dataset. In this simple exercise - and it is an exercise as you would find things simpler for a straight copy job to just have a straight JCL deck - just code the symbolics directly and use SET to resolve them.

Re: PROC and pass all the variables from Job

PostPosted: Wed Apr 04, 2012 11:22 pm
by steve-myers
dn2012 wrote:...
I need to create External Proc that should have the below steps.

a) STEP1 Create a Dataset PDS or PS
b) STEP2 Copy from one dataset to other. Dataset should be a TAPE dataset.
c) STEP3 Create GDG Base.
d) STEP4 Create New version GDG file and copy tape data to Disk
e) STEP5 Create VSAM File (KSDS, Key length 30)
...
  • What do mean by "external proc"?
  • Step 1 - JCL can create a sequential dataset and a PDS dataset. Your spec seems to imply the procedure can select the type based on some symbolic parameter. This is possible if the symbolic parameter includes the entire SPACE parameter, but this is not a good way to use symbolics.
  • Step 2 - You seem to imply the output dataset is the dataset created in step 1. Since you want the output dataset to be on tape, it is not a good idea to "create" the dataset in step 1 and the use it in step 2.
  • Step 3 - JCL, by itself, cannot create a generation data index. It must be created by a utility such as IDCAMS and by using IDCAMS control statements. Starting with z/OS Release 13 the IDCAMS control statements can be in the procedure, but not all sites are running this release.
  • Step 4 - Is the GDG using the index specified in step 3? Is the input dataset the dataset created in step 2?
  • Step 5 - A KSDS needs many more parameters. What are they?
In general, these specifications seem to be pretty half baked, and this exercise seems to be homework.

We do not do homework.