Page 1 of 1

Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 11:48 am
by arya_starc
Hi All,


I am trying to invoking a jcl program which I passed in my rexx code.
I am trying to achieving this by using "QUEUE" command, but it not working. Below is the snippet

ADDRESS TSO                                                        
SAY "PLEASE ENTER NUMBER"                                          
PULL NUM                                                          
IF NUM ==  1 THEN DO                                              
SIGNAL SUBMIT                                                      
END                                                                
EXIT                                                              
 SUBMIT:                                                          
ADDRESS TSO                                                        
"DELSTACK"                                                        
 QUEUE "//SAMPJCL1 JOB (0000,XXXX),'JCL_INVOKER',                "
 QUEUE "//       CLASS=Z,                                        "
 QUEUE "//       MSGCLASS=9,                                     "
 QUEUE "//       REGION=0M                                       "
 QUEUE "//*                                                      "
 QUEUE "//*---------- SERVICE EXCI TEST PROCESS -----------------"
 QUEUE "//*                                                      "
 QUEUE "//DELSVCO EXEC PGM=IEFBR14                               "
 QUEUE "//FIL11 DD DSN=MYFILE.TEST1.DEL.SE,                     "
 QUEUE "//       DISP=(MOD,DELETE,DELETE),                       "
 QUEUE "//       SPACE=(TRK,0)                                   "
 QUEUE "//*                                                      "
 QUEUE "/*                                                       "
 QUEUE "$$"                                                        
EXIT                                                              
 


I am executing this rexx by giving 'ex' command infront of the member name.

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 12:40 pm
by NicC
Many mistakes here:
1 - no such thing as a "JCL program" - JCL describes a job specification including programs to be executed
2 - saying it is not working means absolutely nothing. You MUST say how it is not working (what you expect to happen and what did happen)
3 - You are not submitting anything just putting items on the queue
4 - make submit a procedure and CALL it.
5 - only need 1 EXIT - the second, once you change SIGNAL to CALL should be a RETURN
6 - Read the Rexx manual from start to finish - in particular the keywoerds that you have used.
7 - search the forum for how to properly submit a job via the queue.
8 - TSO is the default address space so you do not need to use ADDRESS TSO
9 - "IF x THEN y" not "IF x THEN DO y END"
10 - "IF x THEN DO y; z; END"
That is enough tutoring.

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 1:00 pm
by expat
Why oh why do people insist on writing instream JCL statements to submit.

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 1:25 pm
by NicC
Because they can - or cannot, in this case!

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 1:29 pm
by arya_starc
Thanks NicC,

I am working on points.

Hi Expat,

In my case, I am instream jcl because I need to pass parameter in my jcl which should append in my jcl statement and then it will execute.

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 2:06 pm
by expat
Which is easily accomplished using ISPF file tailoring too

Re: Invoke JCL program thru rexx

PostPosted: Thu Oct 25, 2018 2:16 pm
by willy jensen
The recommended method for generating jobs is ISPF skeleton services. Having said that, I don't have a problem with people generating JCL inline in the program and submitting directly, as usual it depends on the situation.
And now to the program in question, it can be simplified to something like this:

 say "Please enter number"        
 pull num                          
 if num <> 1 then exit            
 "delstack"                        
 queue  .....your JCL....          
 queue  "$$"                      
 "submit * end($$)"                
 "delstack"    /* just in case */  

But you really need to work your way through the REXX reference and the TSO command reference manuals.