Page 1 of 1

Rexx pgm to pass JCl statements

PostPosted: Mon Oct 25, 2010 2:03 pm
by jaggz
Hi folks,
Iam new to Rexx Programming and i need to execute a Rexx program that contains JCL statements inside to it. Im also in need to pass value to a certain parameters in that JCL through REXX. So that it looks like a menu driven pgm.

Re: Rexx pgm to pass JCl statements

PostPosted: Mon Oct 25, 2010 5:32 pm
by NicC
I do not understand - I THINK I understand SOME of your requirement but not all.

You need to write or execute a rexx program? Or both?

Rexx programs cannot contain JCL statements - the rexx interpreter would not know what to do with them. You can have strings within your rexx program that represent JCL statements and these can be assigned to variables.

I am not sure what you mean about the rest. My best guess is, if this is related to your other post today re ALIAS, that you want to get a parameter or 2 into the rexx program, create JCL for an IDCAMS job that contains these parameters in the IDCAMS control cards and submit that job. If this is correct then to prompt for the parameters use the SAY command, to get the parameters from the user use the PULL command, create the job from constant strings intermixed with the variables holding your PULLed parameters, write the generated JCL to a file and then issue the TSO SUBMIT command.

Re: Rexx pgm to pass JCl statements

PostPosted: Sun Oct 31, 2010 9:00 pm
by NicC
So, have you resolved this yet? Or do you need more assistance?

Re: Rexx pgm to pass JCl statements

PostPosted: Tue Nov 02, 2010 6:53 pm
by Pedro
If you need a menu, you will need to create an ISPF panel.

You can use the QUEUE instruction of rexx to build your JCL. This example will compress a PDS:
/* REXX */                                                   
parse arg indsn                                               
indsn = strip(translate(indsn,"","'"))                       
say indsn                                                     
queue  "//PEDROC    JOB ,                                  " 
queue  "//         MSGLEVEL=(1,1),MSGCLASS=H,USER=&SYSUID, " 
queue  "//         NOTIFY=&SYSUID,TIME=2,REGION=24M        " 
queue  "//STEP1   EXEC PGM=IEBCOPY                         " 
queue  "//SYSPRINT DD SYSOUT=*                             " 
queue  "//INDD1   DD DISP=SHR,DSN="||indsn                   
queue  "//OUTDD1  DD DISP=SHR,DSN="||indsn                   
queue  "//SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(10,20))         " 
queue  "//SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(10,20))         " 
queue  "//SYSIN DD *                                       " 
queue  "       COPY INDD=INDD1,OUTDD=OUTDD1                " 
queue  "/*                                                 " 
queue  "@#"                                                   
Address TSO "SUB * END(@#)"                                   


QUEUE is one way, but many people instead use ISPF file tailoring services to build the job.

Re: Rexx pgm to pass JCl statements

PostPosted: Tue Nov 09, 2010 6:31 pm
by Viswanathchandru
Hi pedro,
Thanks for your post.!!!!
I tried with the way u posted. my requirment is to create a user id. The JCL is getting submitted but am getting error. can you pls help me on this. My jcl goes this way....

/* REXX */
SAY " HELLO "
SAY " JCL INSIDE A REXX "
QUEUE "//ALIASACE JOB MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B,"
QUEUE "// REGION=5M,NOTIFY=&SYSUID"
QUEUE "//STEP1 EXEC PGM=IDCAMS"
QUEUE "//SYSPRINT DD SYSOUT=*"
QUEUE "//SYSIN DD *"
QUEUE "//DEFINE ALIAS(NAME(TEST010) RELATE(CATALOG.NGF.VZ39CAT))"
QUEUE "/*"
QUEUE "22"
ADDRESS TSO "SUB * END(22)"


Thanks,
Viswa

Re: Rexx pgm to pass JCl statements

PostPosted: Tue Nov 09, 2010 6:43 pm
by Robert Sample
Problem 1. User ids are created by the security package (RACF or ACF2 or Top Secret), not by an IDCAMS job. You are creating an ALIAS which is a catalog entry, not a user id. Terminology is critical in IT, where similar terms may mean very different things. If you think you're creating a user id using this JCL, you need to go back to your security manuals and read them cover to cover.

Problem 2. After your //SYSIN DD * statement, the IDCAMS control statements cannot have // in columns one and two -- yours do.

Re: Rexx pgm to pass JCl statements

PostPosted: Tue Nov 09, 2010 8:48 pm
by expat
Also, I would recommend the use of ISPF file tailoring rather than creating instream jobs via a REXX.

One place where I worked had about 19 different REXX codes that generated the self same JCL.
A real pain to maintain, but so much easier to update ONE ISPF skeleton tham 19 different REXX codes