View previous topic :: View next topic
|
Author |
Message |
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
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 |
|
|
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
ooops..... I didn't see the wraper suggestion, sorry; will analyze that |
|
Back to top |
|
|
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
Ricardo Viegas
New User
Joined: 18 Oct 2012 Posts: 39 Location: Brasil
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
|