View previous topic :: View next topic |
Author |
Message |
Premkumar Moderator
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
Posted: Mon Dec 02, 2002 10:59 pm Post subject: How to submit a batch job in a Rexx program? |
|
|
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 |
|
|
Jeba Beginner
Joined: 02 Dec 2002 Posts: 48 Topics: 9 Location: Columbus, GA
|
Posted: Wed Dec 04, 2002 12:17 am Post subject: |
|
|
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 |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Wed Dec 04, 2002 4:21 am Post subject: |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Sat Mar 29, 2003 4:36 am Post subject: |
|
|
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 |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Sat Mar 29, 2003 4:54 am Post subject: |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Sat Mar 29, 2003 5:38 am Post subject: |
|
|
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 |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Sat Mar 29, 2003 6:27 am Post subject: |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Sat Mar 29, 2003 6:46 am Post subject: |
|
|
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 |
|
|
raj051076 Beginner
Joined: 05 Dec 2002 Posts: 64 Topics: 21
|
Posted: Sat Mar 29, 2003 1:32 pm Post subject: |
|
|
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 |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Sun Mar 30, 2003 10:55 pm Post subject: |
|
|
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 |
|
|
raj051076 Beginner
Joined: 05 Dec 2002 Posts: 64 Topics: 21
|
Posted: Mon Mar 31, 2003 12:26 am Post subject: |
|
|
Sorry Cogito......... _________________ Rajib |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Mon Mar 31, 2003 4:06 am Post subject: |
|
|
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 |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Mon Mar 31, 2003 10:12 pm Post subject: |
|
|
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 |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Mar 31, 2003 11:20 pm Post subject: |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Tue Apr 01, 2003 8:21 am Post subject: |
|
|
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 |
|
|
|
|