MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to submit a batch job in a Rexx program?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Mon Dec 02, 2002 10:59 pm    Post subject: How to submit a batch job in a Rexx program? Reply with quote

Using File Tailoring
Code:

/* Rexx */                                         
Address ISPEXEC                                     
"LIBDEF ISPSLIB DATASET ID('your.pds.containing.the.jcl') STKADD"
"FTOPEN TEMP"                                       
"FTINCL jclmember"                                   
"FTCLOSE"                                           
"VGET ZTEMPF"                                       
Address TSO                                         
"SUBMIT" "'"ZTEMPF"'"                               


To construct the JCL on the fly and submit from stack,
Code:

/* REXX */
queue "//JOBNAME1  JOB (ACCT) MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B"
queue "//STEP01    EXEC PGM=IEFBR14"
queue "ZZ"
'SUBMIT * END(ZZ)'
Back to top
View user's profile Send private message Send e-mail
Jeba
Beginner


Joined: 02 Dec 2002
Posts: 48
Topics: 9
Location: Columbus, GA

PostPosted: Wed Dec 04, 2002 12:17 am    Post subject: Reply with quote

Hai all,

We can submit a batch job using the following rexx code also

Code:
/* REXX */                               
DSNA="'Your dataset containing JCL'"   
ADDRESS TSO                             
"SUBMIT " DSNA                           

_________________
Thanks,
Jeba
(Known is a drop Unknown is an ocean)
Back to top
View user's profile Send private message Send e-mail
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Wed Dec 04, 2002 4:21 am    Post subject: Reply with quote

Jeba,
What Premkumar meant was that you can submit a JCL dynamically through a REXX program using Queues or skels. You can prepare your own JCL in the REXX program dynamically taking user inputs or based upon some conditions and then submit it.
Its not simply submitting a static JCL already there in a dataset. For that you don't need to write a REXX. You can simply put a SUB in the command line of the member.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Sat Mar 29, 2003 4:36 am    Post subject: Reply with quote

Premkumar,

When I use your REXX method (To construct the JCL on the fly and submit from stack) the JCL is created in upper case. Is there any way to preserve the case while using 'SUBMIT *' in REXX.

Thanks,
Diba.
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Sat Mar 29, 2003 4:54 am    Post subject: Reply with quote

Diba,
Why would you want lower/mixed case in JCL in the first place? If the lower/mixed case is to be a part of some SYSIN, PARM, etc, then it could be worked out. I think, the lower/mixed case strings coded as literal in the REXX code should do.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Sat Mar 29, 2003 5:38 am    Post subject: Reply with quote

Cogito-Ergo-Sum,

Yes, lower case is part of 'DD *' data, built dyanamically. Input is in lower case. Flow is like this -

"MACRO (emailid)"
queue "To: "emailid
"SUB * END($$)"


The job is working fine with upper case but since it is sending email, one of my colleage didn't like to receive mails with email id in upper case. So I wan't to preserve the case of input email.

Diba.
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Sat Mar 29, 2003 6:27 am    Post subject: Reply with quote

Dibakar,
In that case, I guess, you will have to code a small procedure in your EXEC to convert uppercase to lowercase. I do not think, there is a direct way of conversion from upper case to lower case and vice-versa. The code could be something as follows:

Code:

len = length(upper_string)
i = 1
lower_str = ' '
do while i < = len
   x = substr(upper_string,i,1)
   dec_val = x2d(c2x(x))
   dec_val_lower = dec_val - 64
   y = x2c(d2x(dec_val_lower))
   lower_str = lower_str||y
   i = i + 1
end
lower_str = strip(lower_str,l,' ')

_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Sat Mar 29, 2003 6:46 am    Post subject: Reply with quote

Cogito-Ergo-Sum,

Maybe I didn't explain the problem properly. It is not that my data is in upper case. If I provide emailid in lower case then the program accepts it in lower case (confirmed by 'display'). But either 'queue' or 'SUB' is converting it into upper case.

Dibakar.
Back to top
View user's profile Send private message Send e-mail
raj051076
Beginner


Joined: 05 Dec 2002
Posts: 64
Topics: 21

PostPosted: Sat Mar 29, 2003 1:32 pm    Post subject: Reply with quote

Cognito I kow for sure that Queue will always convert to uppercase..I did not go thru the whole string of messages above..but I feel your problem will be solved if you put your jcl statements into a stem variable and then write them to a file and submit it..

e.g; 'EXECIO * DISKW OUTDD (STEM STMT.'

DO I = 1 TO STEM.0
PUSH STEM.I
EXECIO 1 DISKW JCLDD
END

Try this and let me know if it works..
_________________
Rajib
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Sun Mar 30, 2003 10:55 pm    Post subject: Reply with quote

Rajib,
The query is of Dibakar's and not mine! BTW, my logonid is Cogito and not Cognito.

Dibakar,
I understand your question now. Have you tried Rajib's method?
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
raj051076
Beginner


Joined: 05 Dec 2002
Posts: 64
Topics: 21

PostPosted: Mon Mar 31, 2003 12:26 am    Post subject: Reply with quote

Sorry Cogito.........
_________________
Rajib
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Mon Mar 31, 2003 4:06 am    Post subject: Reply with quote

Rajib,

Problem is with submit command, queue does not convert to uppercase, you can verify this by -
Code:

 queue 'Hello World!'
 parse pull next_item
 say next_item


Still, writing to a file will definitely solve this problem but I would prefer not to use any file since I may run into problem when many people simultaneously use this exec.

Cogito-Ergo-Sum,

The routine you provided to convert to lower case will work only if input contains all upper case letters, maybe that was your intention.

Still I would like to share this code I found somewhere.
If you assign 'Cogito-Ergo-Sum' to upper_string and display lower_str then you will get 'c::::::e::::s::'.
But you will get 'cogito-ergo-sum' with the following code -
Code:

 u_case = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 l_case = 'abcdefghijklmnopqrstuvwxyz'
 lower_str = translate(upper_string,l_case,u_case)



Finally, again,

Is it possible to submit a job in mixed case thru REXX using "SUB * END(CC)".

Thanks,
Diba.
Back to top
View user's profile Send private message Send e-mail
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Mon Mar 31, 2003 10:12 pm    Post subject: Reply with quote

You could try writing directly to the internal reader e.g.

ADDRESS TSO "ALLOC F(INTRDR) RECFM(F) LRECL(80) SYSOUT(A) ",
"WRITER(INTRDR)"
ADDRESS TSO "EXECIO * DISKW INTRDR (STEM j. FINIS"
ADDRESS TSO "FREE F(INTRDR)"
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Mon Mar 31, 2003 11:20 pm    Post subject: Reply with quote

I haven't really been following this, but I'll add a little trivia just to 'muddy the waters'.
Quote:
Problem is with submit command, queue does not convert to uppercase...

In this case you may want to use
Code:
Queue translate(whatever)
because translate()'s default behaviour is to uppercase.
Quote:

Still, writing to a file will definitely solve this problem but I would prefer not to use any file since I may run into problem when many people simultaneously use this exec.

SUBMIT is one of the very few TSO commands that will understand references to the dsname of a temporary file. So you can allocate a new file with no dsname but with a DD name, then use LISTDSI to get the temporary DSNAME and use SUBMIT with that temporary dsname. Since temp names are gaurenteed to be unique , you will not have multi-user contentions. Plus, since you can allocate it to VIO, there is no real I/O involved either.
Back to top
View user's profile Send private message Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Tue Apr 01, 2003 8:21 am    Post subject: Reply with quote

Thanks everybody,

I am getting my data in lower case after implementing these suggestions but me exec is not running smoothly, problem is coming at submit statement. With the following code -
Code:

f_name = 'AJCLFILE'
"ALLOC F("f_name") NEW"
"EXECIO * DISKW "f_name" (FINIS"
x = LISTDSI(f_name "FILE")
"SUB '"SYSDSNAME"'"
"FREE  F("f_name")"


First time I get the error - 'IKJ56265I THE DATA SET IS EMPTY'. Second time it runs fine. Third time it again gives problem and fourth time it runs fine and keeps on alternating like this.

Diba.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group