Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to get the output from submit commands

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: How to get the output from submit commands
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: 8657
Location: Back in jolly old England

PostPosted: Tue Feb 06, 2018 12:55 pm    Post subject:
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    Post subject:
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    Post subject:
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: 198
Location: Denmark

PostPosted: Tue Feb 06, 2018 1:33 pm    Post subject:
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    Post subject:
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    Post subject:
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: 198
Location: Denmark

PostPosted: Wed Feb 07, 2018 3:19 pm    Post subject:
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    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Thu Feb 15, 2018 2:13 am    Post subject: Reply to: How to get the output from submit commands
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: 198
Location: Denmark

PostPosted: Thu Feb 15, 2018 1:51 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Submit a job/script from webpage vasanthz All Other Mainframe Topics 6 Thu Feb 01, 2018 4:10 am
No new posts Unable to send mail with SMTP commands harsh.saxena579 JCL & VSAM 10 Tue Dec 12, 2017 1:58 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts How many people submit job? Pedro All Other Mainframe Topics 2 Thu Oct 26, 2017 2:59 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us