Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get REXX RC under TSO-BATCH

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Sun Nov 25, 2012 3:37 am    Post subject: How to get REXX RC under TSO-BATCH
Reply with quote

I am running a job similar to:

//.... JOB .....
//... EXEC PGM=IKJEFT01
....
//SYSTSIN DD *
%REXXEXEC ABC
%REXXEXEC XYZ
/*

If first invocation of REXXEXEC returns RC different of zero I don't want to run the second one.
How should I proceed to do that?
Any solution/hint will be very much appreciated.
Thanks!
Regards, Ricardo
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Nov 25, 2012 4:51 am    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

use two steps
or write a wrapper around <rexxexec>

something like

the wrappper

Code:
  EDIT       ENRICO.ISPF.EXEC(WRAPPER) - 01.01               Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 /* REXX */
 000002 Trace "O"
 000003 parse arg gift  plis
 000004 do i = 1 to words(plis)
 000005    Address tso gift word(plis,i)
 000006    say RC
 000007    if RC \= 0  then ,
 000008       return RC
 000009 end
 000010 return 0
 ****** **************************** Bottom of Data ****************************


the invocation

Code:
%wrapper <rexxexec> ABC DEF GHI


tested and working
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Sun Nov 25, 2012 5:17 am    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

Yes, that's a solution....

But, actually I have 23 jcl statements and 34 invocations of the exec (invocations will increase in the future).
I don't intend to repeat 34 times the jcl now (and more times in the future...)

Anyway, thanks for the suggestion!
Regards, Ricardo
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Sun Nov 25, 2012 5:19 am    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

ooops..... I didn't see the wraper suggestion, sorry; will analyze that
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Sun Nov 25, 2012 5:38 am    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

Enrico, the "wrapper" solution will work fine.

But, the problem is that each invocation of the exec will have a variable number os parameters (most of the time will be 2 parameters, presently it could vary between 1 and 4 and could be more in the future)

I could solve that by using some kind of "separator" but I think this is a
somewhat awkward solution.
Aren't there any other simpler way to solve that??

Anyway, thanks again!
Regards, Ricardo
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Nov 25, 2012 6:00 am    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

here is a solution ....

the wrapper

Code:
EDIT       ENRICO.ISPF.EXEC(WRAPPER) - 01.04               Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 /* REXX */
 000002 Trace "O"
 000003 parse arg inner
 000004 Address TSO "EXECIO * DISKR PARMS ( FINIS STEM PLIS."
 000005 do i = 1 to plis.0
 000006    say i plis.i
 000007 end
 000008 do i = 1 to plis.0
 000009    interpret plis.i
 000010    say RC
 000011    if RC \= 0  then ,
 000012       return RC
 000013 end
 000014 return 0
 ****** **************************** Bottom of Data ****************************


the <inner>
Code:
 EDIT       ENRICO.ISPF.EXEC(INNER) - 01.02                 Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 /* REXX */
 000002 Trace "O"
 000003 parse arg retc rest
 000004 say "inner" "running"
 000005 say "inner" retc rest
 000006 return retc
 ****** **************************** Bottom of Data ****************************


the jcl
Code:
 SDSF EDIT    ENRICO1  (JOB00052) JCLEDIT                   Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,
 000002 //             REGION=0M,
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X
 000004 //*
 000005 //IKJ     EXEC PGM=IKJEFT01,PARM=WRAPPER
 000006 //SYSPROC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC
 000007 //SYSPRINT  DD SYSOUT=*
 000008 //SYSUDUMP  DD SYSOUT=*
 000009 //SYSTSPRT  DD SYSOUT=*
 000010 //SYSTSIN   DD DUMMY
 000011 //PARMS     DD *
 000012 ADDRESS TSO "INNER 0 P1 P2 P3"
 000013 ADDRESS TSO "INNER 0 P4 P5 P6 P7 P8"
 000014 ADDRESS TSO "INNER 4 P8 P9"
 000015 ADDRESS TSO "INNER 0 P4 P5 P6 P7 P8"
 ****** **************************** Bottom of Data ****************************


the output
Code:
 -------------------------------------------------------------------------------
 SDSF OUTPUT DISPLAY ENRICO1  JOB00052  DSID   104 LINE 0       COLUMNS 02- 81
 COMMAND INPUT ===>                                            SCROLL ===> CSR
********************************* TOP OF DATA **********************************
1 ADDRESS TSO "INNER 0 P1 P2 P3"
2 ADDRESS TSO "INNER 0 P4 P5 P6 P7 P8"
3 ADDRESS TSO "INNER 4 P8 P9"
4 ADDRESS TSO "INNER 0 P4 P5 P6 P7 P8"
inner running
inner 0 P1 P2 P3
0
inner running
inner 0 P4 P5 P6 P7 P8
0
inner running
inner 4 P8 P9
4
READY
END
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Tue Nov 27, 2012 9:38 pm    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

Enrico, I used the "wrapper" idea, but a little bit modified:

Code:
//..... JOB ......
//..... EXEC PGM=IKJEFT01
.....
//SYSTSIN DD *
   %WRAPPER
/*

---------------------------------------
WRAPPER exec:

Code:
/*REXX*/
parms.  = ''
parms.1 = 'AA BB CC'
........
parms.nn = 'XX YY'

Address TSO
Do ctr = 1  While parms.ctr \= ''
   Say 'Starting ctr='ctr 'Parms='parms.ctr
   "EXEC 'DSNAME(REXXEXEC)'  '"parms.ctr"'"
   If RC \= 0 Then Exit RC
   End ctr
Return 00


Thanks for the "wrapper" suggestion!
Regards, Ricardo

Code'd
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Nov 27, 2012 10:09 pm    Post subject: Reply to: How to get REXX RC under TSO-BATCH
Reply with quote

my approach is more flexible because ...

You can wrap different <execs>
the wrapper is general use
the inner execs are specified in an external file ...

just tested... no need to use ADDRESS TSO ...

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,
 000002 //             REGION=0M,
 000003 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X
 000004 //*
 000005 //IKJ     EXEC PGM=IKJEFT01,PARM=WRAPPER
 000006 //SYSPROC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC
 000007 //SYSPRINT  DD SYSOUT=*
 000008 //SYSUDUMP  DD SYSOUT=*
 000009 //SYSTSPRT  DD SYSOUT=*
 000010 //SYSTSIN   DD DUMMY
 000011 //PARMS     DD *
 000012  "INNER 0 P1 P2 P3"
 000013  "INNER 0 P4 P5 P6 P7 P8"
 000014  "OTHER 4 P8 P9"
 000015  "INNER 0 P4 P5 P6 P7 P8"
 ****** **************************** Bottom of Data ****************************


work equally nice

and ... about Your coding

Code:
parms.  = ''
parms.1 = 'AA BB CC'
........
parms.nn = 'XX YY'

.......
Do ctr = 1  While parms.ctr \= ''


....

it is safer to use ( what if You were reading a file and found an empty record )

Code:
parms.0 = <count>
do ctr = 1 to parms.0
   if strip(parms.ctr) = "" then iterate  /* null record */
   if left(strip(parms.ctr),1) = "*" then iterate /* comment */
   ...
   ...
   ...
end

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 How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. MIPS reduction for Batch job Virendra Shambharkar All Other Mainframe Topics 8 Mon Nov 07, 2016 4:02 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us