the rexx is composoe for this procedure
/* 1) find job in lpar and pick job id */
/* 2) close address space */
/* 3) get rc if exist */
/* 4) search in output */
If exclude the function "rec_jobid" the function get_RC work correctly
if i execute also the rec_jobid don't work correctly in particular I have a variable "RETCODE.ix" is not properly assigned
Attention if you test rexx please attention to a lot of sysout
Thanks a lot
/* REXX */
/* 1) find job in lpar and pick job id */
/* 2) close address space */
/* 3) get rc if exist */
/* 4) search in output */
/* TRACE('R') */
/* 1) */
ARG CICSNAME
/* CICSNAME = "CXB2INTE" */
/* */
say "name cics" cicsname
/* only for test */
JN = "CXB2INTE"
jid = "S0862866"
/* 1) */
/* if execute this step I have problem */
say "call rec_jobid"
call rec_jobid
/* only for test */
say "address space" ADDRESS()
/* 2) */
say "call close"
call close(cicsname)
/*call wait*/
/* 3) get RC */
say "call get rc "
call get_RC
exit 33 /* temporary exit for resolve previusly problem */
/* 4) get otuput */
say "call get output"
call get_output
exit outp
/* get jobid */
rec_jobid:
trovato = 0
rc=isfcalls('ON')
Address SDSF "ISFEXEC DA"
if rc<>0 then
exit 20
/*do ix=1 to isfrows */
do ix=1 to JNAME.0
/* if value("JNAME."ix) = cicsname then*/
if JNAME.ix = cicsname then
do
jid = JOBID.ix
jn = JNAME.ix
trovato = 1
say "found" jn "JOBID " jid
end
end
rc=isfcalls('OFF')
if trovato = 0 then exit 49
Address SDSF
"ISFEXEC ST"
return
close:
rc=isfcalls('ON')
if rc<>0 then
exit 20
say "adr "ARG(1)
/* only for test I change the command */
/* ADDRESS SDSF "ISFEXEC '/F "||ARG(1)||",CEMT P SHUT'" */
ADDRESS SDSF "ISFEXEC '/F "||ARG(1)||",CEMT I CONN'"
/* ------------------------ */
rc=ISFCALLS('OFF')
return
get_RC:
say "jn = " jn
say "jid = " jid
starttime = time('S')
ettime = 360 /* max number second wait */
/* if over exit with rc 55*/
trovat = 0
ttime = 0
ciclo = 0
say "TR" trovat
/* cicle exit if trovat o ttime change to 0 */
do until (trovat <> 0 && ttime <> 0 )
ciclo = ciclo + 1
say ciclo
rc=isfcalls('ON')
Address SDSF "ISFEXEC ST"
if rc<>0 then
exit 20
do ix=1 to JNAME.0
/* -------------------------------------------------------- */
/* the problem is here RETCODE not contain value */
/* -------------------------------------------------------- */
say JNAME.ix JOBID.ix RETCODE.ix
IF (JNAME.ix = jn & JOBID.ix = jid & RETCODE.ix <> "" ) then
trovat = ix
end
rc=isfcalls('OFF')
timed = time('s') - starttime
if timed >= ettime then ttime = 55
end /* do until */
if ttime <> 0 then
do
say " loop ?????"
exit 55
end
say "ix " ix
say "TR1" trovat
say "RETCODE.trovat " RETCODE.trovat
say "word(RETCODE.ix,1) " word(RETCODE.ix,1)
/* alligne ix whit trovat for other step */
ix = trovat
say "ix " ix
say "word(RETCODE.ix,1) " word(RETCODE.ix,1)
return
get_output:
rc=isfcalls('ON')
Address SDSF "ISFEXEC ST"
lrc=rc
/*call msgrtn */
if lrc<>0 then
exit 20
/* ------------------------ */
say ix
/* da qui in avanti non } piu sotto do */
say "sono qui 1"
Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)" ,
"( prefix jds_"
lrc=rc
call msgrtn
if lrc<>0 then
exit 20
/* Find the JESMSGLG data set and allocate it */
/* using the SA action character */
do jx=1 to jds_DDNAME.0
if jds_DDNAME.jx = "JESMSGLG" then
do
Address SDSF "ISFACT ST TOKEN('"jds_TOKEN.jx"')" ,
"PARM(NP SA)"
lrc=rc
call msgrtn
if lrc<>0 then
exit 20
/* Read the records from the data set and list them. */
/* The ddname for each allocated data set will be in */
/* the isfddname stem. Since the SA action was done */
/* from JDS, only one data set will be allocated. */
do kx=1 to isfddname.0
Say "Now reading" isfdsname.kx
"EXECIO * DISKR" isfddname.kx "(STEM line. FINIS"
/*
Say " Lines read:" line.0
do lx = 1 to line.0
Say " line."lx "is:" line.lx
end
*/
say "call cerca DFH130"
call cerca
end
end
end
if trovato = 1 then
do
say "chiuso bene (con DFHRM0130)"
outp = 0
end
else
do
say "chiuso male (senza DHRM0130)"
outp = 99
end
/*trova */
end
rc=isfcalls('OFF')
return
wait:
secs = 30
rc = Time(R)
Do Forever
n = Time(E)
If n >= secs Then Leave
End
return
cerca:
trovato = 0
do lx = 1 to line.0
if word(line.lx,3) = "+DFHRM0130" then
do
trovato = 1
end
end
/* Subroutine to list error messages */
msgrtn: procedure expose isfmsg isfmsg2.
/* The isfmsg variable contains a short message */
if isfmsg<>"" then
Say "isfmsg is:" isfmsg
/* The isfmsg2 stem contains additional descriptive */
/* error messages */
do ix=1 to isfmsg2.0
Say "isfmsg2."ix "is:" isfmsg2.ix
end
return
return