Page 1 of 2

Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 12:35 pm
by pub3377
Hi Fellas,

I am total newbie to REXX. I just know how write a Hello World program.

Now I have been tasked with the following requirements.
1. Only replace the last line "ROUTINE SAVE*" to user based input
2. Submit this JCL.
3. Everything has to be done in REXX, the replacing of the string and the submit command.

Sample JCL is as below.

How do I do this??? :)

I am in desparate need. Please help.

//TSYSTLOS JOB (MYSYS,UV00),
// 'SYS/1243',
// NOTIFY=&SYSUID,
// CLASS=B,
// MSGLEVEL=(1,1),
// MSGCLASS=T
//*********************************************************************
//S010 EXEC PGM=PROGRAM,REGION=4M
//*********************************************************************
//STEPLIB DD DSN=MY.LOAD1,DISP=SHR
// DD DSN=MY.LOAD2,DISP=SHR
// DD DSN=MY.LOAD3,DISP=SHR
// DD DSN=MY.LOAD4,DISP=SHR
//SYSIDMS DD *
DMCL=DMCL000
DICTNAME=DXXXYY
DBNAME=DXXXZZ
//SYSOUT DD SYSOUT=*
//SYSLST DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDUMP DD DUMMY
ROUTINE SAVE*
/*

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 1:24 pm
by prino
Ask your employer to send you on a course at a reputable training institute, rather than off-loading you to this forum!

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 2:55 pm
by pub3377
With all due respect Mr. Prino, that is not possible :)

Can anybody help me out with this?

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 3:00 pm
by Akatsukami
Depending on how much the JCL needs to be modified before each submission (job card? load library DSN?), a better course might be to create a skeleton and use ISPF file tailoring services, invoking them from Rexx. Read about file tailoring here.

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 3:04 pm
by pub3377
Hi Akatsukami,

Thank you for the link :)

There are no changes in any part of the job. I have to just change the last line "ROUTINE SAVE*" to any use given input.

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 3:54 pm
by Akatsukami
Well, I'd still use a skeleton.

Assuming for some reason that you can't, however, don't embed the JCL in the Rexx. Have it in a PS data set or PDS member somewhere; suck it into your script with EXECIO * DISKR to a stem (this is often not a good thing; however since your job is quite small, it's acceptable. If you write a script where you're not sure if your input data set has ten records or ten million in it, don't do this; in fact, use another language if possible). In a loop from 1 to stem.0, write to a temporary data set or PDS member. Test for the "ROUTINE SAVE*" (if that's definitely the only thing that'll be on that line, you can just use the equality operator; otherwise use the pos function and test for a non-zero return code). When you find it, read in the user input (and please don't tell me that you were planning to prompt for thousands of lines) and from write it instead. When you've written the last line, close the data set, free it, and submit it (using the SUBMIT command, of course).

If I have time, I'll write an example when I get in to my office.

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 4:05 pm
by enrico-sorichetti
see here for a tested snippet on FTINCL facilities
http://ibmmainframes.com/about55549.htm ... ght=ftincl

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 4:15 pm
by pub3377
Thanks for the suggestion :)

Now, they say the requirement. They want automate the process of searching throught IDD (CA IDMS) in the system :x
This will help in reducing the manual intervention needed during the analysis of the codes. I have no clue what they think.

I tried the following by googling. I am pretty certain there will be improvements in the following code :D

/* REXX */                                                             
/*TRACE I*/                                                             
SAY "ENTER A LETTER TO DISPLAY DATASETS "                               
PARSE UPPER PULL HLQ                                                   
                                                                       
SAY HLQ                                                                 
                                                                                                             
CALL UPDATE_DS                                                         
                                                                       
EXIT                                                                   

UPDATE_DS: PROCEDURE                                                   
PARSE ARG HLQ                                                           
                                                                       
SAY 'IN UPDATE_DS ' HLQ                                                 
                                                                       
ADDRESS TSO                                                             
"ALLOC DA(HLQ) F(UPDATEDD) OLD"                                         
                                                                       
EOF = 'NO'                /* INITIALIZE END-OF-FILE FLAG */             
DO FOREVER                                                             
   IF EOF = 'NO' THEN DO                                               
      "EXECIO 1 DISKRU UPDATEDD "                                       
      /* QUEUE THE NEXT LINE ON THE STACK */                           
                                                                       
      IF RC = 2 THEN                                                   
      /* RETURN CODE INDICATES END-OF-FILE */                           
         EOF = 'YES'                                                   
      ELSE                                                             
      DO                                                               
        PARSE PULL LINE                                                 
        SAY 'PLEASE MAKE CHANGES TO THE FOLLOWING LINE.'               
        SAY 'IF YOU HAVE NO CHANGES, PRESS ENTER.'                     
        SAY LINE                                                       
        PARSE PULL NEWLINE                                             
        IF NEWLINE = '' THEN NOP                                       
        ELSE                                                           
        DO                                                             
          PUSH NEWLINE                                                 
          "EXECIO 1 DISKW UPDATEDD"                                     
          I = I + 1                                                     
        END                                                             
      END                                                               
   END                                                                 
   ELSE                                                                 
       LEAVE                                                           
END                                                                     
"EXECIO 0 DISKW UPDATEDD (FINIS"                                       

RETURN

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 4:54 pm
by enrico-sorichetti
why do You feel that somebody outside of Your organization shuld have more cues ??? :geek:

and about <Your> coding ... it is pure garbage ( no offense meant )
why not edit directly the dataset ???

Re: Submitting JCL using REXX

PostPosted: Thu Mar 14, 2013 10:43 pm
by Akatsukami
I won't go so far as to call this "garbage", but the days of the command line interface and prompting are long over. I seriously suggest, pub3377, that you put some time into a study of ISPF services and dialog development; you will find these things invaluable for tool development.