IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to invoke a job through REXX..


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 5:05 pm
Reply with quote

Hi All,

Can we invoke a job ( JCL ) through REXX. currently i have developed a job which gives a desired o/p by submitting it.

if it is possible then is there any way we can recv input to jcl as a parm from the rexx screen.

Thanks in advance.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 5:16 pm
Reply with quote

Not exactly sure what you are on about here .....................

Do you mean that rather than submit the job you wish to process it in foreground via your terminal.

Please consider that the process will probably take longer doing it this way, will lock your terminal against doing any further useful work while waiting for the process to end, and because of memory size restrictions placed upon a TSO/ISPF session may well fail.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 5:41 pm
Reply with quote

expat.. you are correct .. i need to submit the job from the treminal.. i.e rexx screen....... job does not take much time to complete. i am trying this because the job needs to be run for different parameters and instead of running the job many times with different parms better way is to run the job through terminal providing the parm value.

Could you please help me hot to achieve this task.


Thanks,
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Nov 05, 2009 6:07 pm
Reply with quote

You can submit a job from TSO (the SUBMIT command). You can submit a job from ISPF (the ISPF SUBMIT command). You can submit a job anytime from anywhere by copying the JCL to the Internal Reader. So yes you can submit a job through REXX.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 6:08 pm
Reply with quote

OK, so what information do you think that we need to be able to help you.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 6:40 pm
Reply with quote

i have explored hot to submit jobs thru rexx piece of code... can i know how to pass values from rexx to job.... is it related to skel concept....
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 6:59 pm
Reply with quote

We seem to be going in opposite directions here. Do you want to submit the job from the REXX or do you want to execute the process at the terminal.

If you want to submit the job, then using file tailoring services is one of the easiest methods of making changes to the JCL that is submitted.

example - you enter a value of ABC at the screen, and the screen variable is PARMVAL. In the skeleton you have
Code:
//STEPNAME EXEC PGM=program,PARM='&PARMVAL'

By using the file tailoring services this translates to
Code:
//STEPNAME EXEC PGM=program,PARM='ABC'


If you wish to execute the program at the terminal then you need to allocate the DD names that the program requires, associated with the correct dataset names or whatever, and you can use the CALL command to invoke the program and pass a parameter string to the program.

So whichever way you decide to go, there is certainly enough information here for you to code and test with, although you may have to have a trawl through the manuals as well.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 7:07 pm
Reply with quote

expat......... i need to enter value in the terminal on rexx screen and that value should be accepted in a symbolic variable in job... this is my requirement.....


Thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 05, 2009 7:12 pm
Reply with quote

Quote:
i need to enter value in the terminal on rexx screen and that value should be accepted in a symbolic variable in job... this is my requirement
If the job is already running, this cannot be done -- period. Once a job has gone through the converter / interpreter phase of JES, no changes can be made to it (no symbolics, no parameters, nothing). You will have to submit the job with the change already in the JCL.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 7:15 pm
Reply with quote

in job we can give like


val= value from rexx input

var=&val

but overall scenario is not clera how the value input from rexx terminal will be caught in the val ..
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 7:16 pm
Reply with quote

Robert...... u are correct.. then how shall i achieve my requirement ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 05, 2009 7:19 pm
Reply with quote

If you are expecting to change the JCL of a job already executing, your solution is to go back to whoever gave you the requirement and tell them it cannot be done.

Otherwise, you will have to come up with a way to change the JCL before the job is submitted because once submitted, JCL doesn't get changed.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 7:21 pm
Reply with quote

Did not my previous reply give you any clues ?

The joys of using REXX and ISPF is that they interact very well together.

OK, when you define an ISPF panel, the fields are given a name. That name, without doing anything at all, is then valid within the calling REXX, or God forbid - CLIST, and contains exactly what was entered at the terminal.

Now, when we invoke the ISPF file tailoring services from the same REXX - guess what, the very same variable name still contains what was entered at the terminal.

So go back to my previous reply and look at the example, and see if you can work it out from what has been said in this reply.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 7:26 pm
Reply with quote

Robert,i am not trying to change the jcl already executing. Just needed to pass the value from rexx terminal and after that execute the job.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 05, 2009 7:31 pm
Reply with quote

expat has done a good job of explaining what you need to do.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 7:52 pm
Reply with quote

expat coding the below code in the job gives error.

//STEPNAME EXEC PGM=program,PARM='&PARMVAL'
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 7:55 pm
Reply with quote

Did you use the ISPF file tailoring services to generate the JCL
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 8:34 pm
Reply with quote

expat my code is like below

EXEC PGM=SARBCH,
PARM='K9490P0.SAR41,&TEST'


Now how to give other parm you have mentioned as

//STEPNAME EXEC PGM=program,PARM='&PARMVAL'

Need help on coding multiple parms.
Thank you,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 8:58 pm
Reply with quote

Mmmmmmmm, I suggest that you use ISPF file tailoring services, and give an example of the FTS inputs and outputs.

I take even more time to explain briefly the interaction between ISPF and REXX giving an example of once again using FTS.

You DO NOT use ISPF file tailoring with an example that I have given which SHOULD USE file tailoring and then you tell me that it doesn't work. Well of course it will not work if you do not do as suggested.

At the top of the CLIST/REXX forum is a sticky which will give you virtually all of the manuals you will ever need for REXX and ISPF processing. I strongly suggest that you take some time and familiarise yourself with those manuals and their contents, find out about file tailoring and then try it. It's not rocket science. It's not brain surgery. It is plain, straight forward invocation and use of services that were developed by IBM to make your life easier.

Yes, there are alternatives to using these services which include building your JCL in situ, editing a base member to fit your requirements, but to me the ISPF file tailoring is the easiest way to do this.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 9:06 pm
Reply with quote

expat thanks i will surely go through the manuals. pls correct me if i have dome the wrong coding below taking two parm values in a single parm.

//SAREXTR EXEC PGM=SARBCH,
// PARM='K9490P0.SAR41,&TEST'
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//REPORT DD DSN=&&TEMP,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(20,10),RLSE),
// LRECL=133,RECFM=FBA,BLKSIZE=27930
//SYSIN DD *
/LIST ID=&&TEST*,GEN=0
/*

where test is the parm used in rexx
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Thu Nov 05, 2009 9:12 pm
Reply with quote

Expat, the way i have declared the parm did not work. report is blank.

// PARM='K9490P0.SAR41,&TEST'


Please help me how the code can be corrected


Thanks in advance,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 05, 2009 9:20 pm
Reply with quote

Let us call this member TEST99 in the ISPSLIB
Code:
//SAREXTR EXEC PGM=SARBCH,
// PARM='K9490P0.SAR41,&TEST'
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//REPORT DD DSN=&&&&TEMP,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(20,10),RLSE),
// LRECL=133,RECFM=FBA,BLKSIZE=27930
//SYSIN DD *
/LIST ID=&&TEST*,GEN=0
/*


When you user or whoever enters a value in the screen, and the value entered is ABC in the panel field called TEST, and then the ISPF file tailoring is invoked by your REXX, every occurence of &TEST will be substituted by the file tailoring service to become ABC. You have two occurences of &TEST, so both will become ABC.

Also note that I have changed your &&TEMP into &&&&TEMP in an ISPF skeleton, so that when it is resolved during file tailoring it reverts back to &&TEMP in the JCL. Also note the file tailoring input and output for the line /LIST ID=

So, in your REXX you have
Code:
"ISPEXEC FTOPEN"
"ISPEXEC FTINCL TEST99"
"ISPEXEC FTCLOSE"

The result output will be
Code:
//SAREXTR EXEC PGM=SARBCH,
// PARM='K9490P0.SAR41,ABC
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//REPORT DD DSN=&&TEMP,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(20,10),RLSE),
// LRECL=133,RECFM=FBA,BLKSIZE=27930
//SYSIN DD *
/LIST ID=&ABC*,GEN=0
/*

As an aside point, it is not required to code the BLKSIZE parameter on most files as the sytem will select the best blocksize for you. If this file was now written to tape then you would be using an inefficient blocksize.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Fri Nov 06, 2009 11:35 am
Reply with quote

Expat.., thanks for exploring your strong technical ideas to us.

please see the code below in rexx and let me know if i am wrong somewhere.

/* REXX */
/* SUBMITTING JOB THROUGH REXX */
SAY 'ENTER QUALIFIER(EG:F3698 ) :'
PULL TEST
"ISPEXEC FTOPEN"
"ISPEXEC FTINCL TEST99"
"ISPEXEC FTCLOSE"
ADDRESS TSO "SUBMIT '"Z1225AN.EM"("SAREX")'"

Job :

//SAREXTR EXEC PGM=SARBCH,
// PARM='K9490P0.SAR41,&TEST'
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//REPORT DD DSN=&&&&TEMP,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(20,10),RLSE),
// LRECL=133,RECFM=FBA
//SYSIN DD *
/LIST ID=&&TEST*,GEN=0
/*

Thanks in advance.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 06, 2009 12:45 pm
Reply with quote

here is the proper way of doing it ...
tested
Code:

Trace "I"                         
address ispexec "FTOPEN TEMP"     
address ispexec "FTINCL TSTSKEL"   
address ispexec "FTCLOSE"         
address ispexec "VGET ZTEMPF"     
Address TSO     "SUBMIT ("ZTEMPF")"
return 0                           


and here is the relative trace ...

Code:

 5 *-* address ispexec "FTOPEN TEMP"     
   >L>   "FTOPEN TEMP"                   
 6 *-* address ispexec "FTINCL TSTSKEL"   
   >L>   "FTINCL TSTSKEL"                 
 7 *-* address ispexec "FTCLOSE"         
   >L>   "FTCLOSE"                       
 8 *-* address ispexec "VGET ZTEMPF"     
   >L>   "VGET ZTEMPF"                   
 9 *-* Address TSO     "SUBMIT ("ZTEMPF")"
   >L>   "SUBMIT ("                       
       >V>   "ENRICO.SPFTEMP1.CNTL"         
       >O>   "SUBMIT (ENRICO.SPFTEMP1.CNTL" 
       >L>   ")"                             
       >O>   "SUBMIT (ENRICO.SPFTEMP1.CNTL)"
JOB ENRICO@A(JOB00905) SUBMITTED             
    10 *-* return 0                         
       >L>   "0"                             


of course You need to run in an ISPF environment with the proper libraries allocated
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Nov 06, 2009 1:06 pm
Reply with quote

Just to clarify why I used FTOPEN rather than FTOPEN TEMP is that I will allocate an ISPFILE DD for my file tailoring output.

Either method works, it is just a matter of choice.

I do suggest that you, and anyone else unfamiliar with the products who are thinking about using REXX / ISPF, take a good long read of the documentation before attempting to write your own applications.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top