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

How to get the output from submit commands


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

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Tue Feb 06, 2018 7:26 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Feb 06, 2018 12:55 pm
Reply with quote

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
View user's profile Send private message
Joanna2016

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Tue Feb 06, 2018 1:03 pm
Reply with quote

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
View user's profile Send private message
Joanna2016

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Tue Feb 06, 2018 1:08 pm
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 416
Location: Denmark

PostPosted: Tue Feb 06, 2018 1:33 pm
Reply with quote

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
View user's profile Send private message
Joanna2016

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Tue Feb 06, 2018 1:37 pm
Reply with quote

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
View user's profile Send private message
Joanna2016

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Wed Feb 07, 2018 6:36 am
Reply with quote

Can anybody please help on the question I posted on the top?
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 416
Location: Denmark

PostPosted: Wed Feb 07, 2018 3:19 pm
Reply with quote

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
View user's profile Send private message
Joanna2016

New User


Joined: 02 Feb 2018
Posts: 6
Location: China

PostPosted: Fri Feb 09, 2018 6:46 am
Reply with quote

Willy, thank you so much
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2214
Location: Silicon Valley

PostPosted: Thu Feb 15, 2018 2:13 am
Reply with quote

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:
Code:
SUBMIT *  END(##)

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 416
Location: Denmark

PostPosted: Thu Feb 15, 2018 1:51 pm
Reply with quote

@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
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

 


Similar Topics
Topic Forum Replies
No new posts Altering output file attributes All Other Mainframe Topics 5
No new posts DB2 - row_number function - Need 1st ... DB2 5
No new posts ISPF Panel commands DDLIST /LISTBOX TSO/ISPF 11
No new posts ISPF Edit Macro with profile commands... TSO/ISPF 14
No new posts Need to open a DSN using REXX & e... CLIST & REXX 10
Search our Forums:

Back to Top