View previous topic :: View next topic
|
Author |
Message |
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
Hi Experts,
I'm new at REXX. I want to use REXX to
1, In the view mode, change all the "AAA" to "BBB" in the dataset which is a JCL.
2, submit the JCL
3. Get the output from the submit command. The output is like "JOB AJOB(J0071024) SUBMITTED". I need the job name and the job ID.
For doing such scenario, I tried to make a macro for the first step and the second step like below,
Code: |
/*MACRO ATOB */
ISREDIT MACRO (NP)
ISPEXEC VGET (ZUSER)
ISREDIT CHANGE ALL 'AAA' 'BBB'
ISREDIT SUBMIT
ISREDIT CANCEL |
And then I tried to use OutTrap to get the output of the submit. But I found it didn't work. Could you please advise where I was wrong?
BTW I used below command to execute the REXX.
EX 'EXERR.REXX(#GETOPUT)' 'EXERR.TEST.JCL(TEMPAAA) ATOB'
Code: |
/* Rexx */
Parse Arg InitJcl MACRONAME
Address TSO
X=OutTrap("Line")
Address ISPEXEC "VIEW DATASET('"InitJcl"') MACRO("MACRONAME")"
SubRC=RC
X=OutTrap("OFF")
Parse Var Line1 "JOB " JobName "(" JobId ") SUBMITTED"
Say "Jobname=" JobName
Say "JobID=" JobId
return 0 |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Try
Code: |
X=OutTrap("Line.")
Do abc = 1 to Line.0
Say "Line " abc " = " Line.abc
End |
and see if the results are different to what you expect |
|
Back to top |
|
|
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
Thank you for reply. But it doesn't work either. I 've checked and found Line.0 = 0 which means OutTrap didn't get the output. |
|
Back to top |
|
|
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
The way I posted above can finish the first two steps. But failed at the third step. Experts, I want the submitted jobname and jobID. If OutTrap cannot accomplish it, could you please advise another way?
1, In the view mode, change all the "AAA" to "BBB" in the dataset which is a JCL.
2, submit the JCL
3. Get the output from the submit command. The output is like "JOB AJOB(J0071024) SUBMITTED". |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
You can trap the output of the TSO SUBMIT command, but not the ISPF SUBMIT command. So for this to work you must save the data to a dataset and then use TSO submit, like in this sample:
Code: |
zz=outtrap('lst.')
address tso "submit 'MY.LIB.CNTL(BR14)'"
zz=outtrap('off')
say '->'lst.1
|
|
|
Back to top |
|
|
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
Hi Willy,
Thank you for the suggestion. If there's no way for submitting the JCL without saving changes. I will take your advice to use address tso submit.
Thank you again. |
|
Back to top |
|
|
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
Can anybody please help on the question I posted on the top? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
If you are referreing to question 1 'In the view mode, change all the "AAA" to "BBB" in the dataset which is a JCL.' then I would suggest that you look at ISPF edit macros.
The following sample shows one way to do it all, for further details you need to read the 'ISPF Edit and Edit Macros' manual.
Code: |
/* ISPF edit macro */
Address Isredit "MACRO NOPROCESS"
Address Isredit
"(ds)=dataset"
"(mb)=member "
/* load data to stem */
"(l) = linenum .zl"
line.0=l
Do n=1 to l
"(s)= Line (n)"
line.n=strip(s,'t')
End
/* update */
"change 'AAA' 'BBB' all"
/* submit */
"save"
zz=outtrap('lst.')
address tso "submit '"ds"("mb")'"
zz=outtrap('off')
parse var lst.1 . 'JOB' jbn'('jnr')' .
say 'Job' jbn 'nr' jnr 'submitted'
/* rewrite original data */
"del .zf .zl"
Do n=1 to line.0
s=line.n
"line_after .zl = (s)"
End
"reset"
|
|
|
Back to top |
|
|
Joanna2016
New User
Joined: 02 Feb 2018 Posts: 6 Location: China
|
|
|
|
Willy, thank you so much |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2545 Location: Silicon Valley
|
|
|
|
Quote: |
If there's no way for submitting the JCL without saving changes. |
You can QUEUE all of the lines of JCL and use this form of the TSO SUBMIT command:
where END(##) are two characters that also need to be QUEUE'd as the last line: they signify the end of the input. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
@Pedro, great - I didn't know that even after all those years. Just tried it and it returned 2 lines in the outtrap stem. |
|
Back to top |
|
|
|