REXX SDSF diff behavior during complete or partial exec



IBM's Command List programming language & Restructured Extended Executor

REXX SDSF diff behavior during complete or partial exec

Postby Enrico_Dondi » Tue Jul 29, 2014 1:18 pm

Hi, I'm write a program in rexx that work with sdsf.

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


Enrico_Dondi
 
Posts: 4
Joined: Mon Jul 28, 2014 8:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX SDSF diff behavior during complete or partial exec

Postby Pedro » Tue Jul 29, 2014 9:39 pm

Show us the trace.

Note: this sequence will always give you an error... you turn it off then try to use it. Though, it is not clear that is the problem you mention.
rc=isfcalls('OFF')
 Address SDSF
  "ISFEXEC ST"

It is not clear why that is there.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: REXX SDSF diff behavior during complete or partial exec

Postby Enrico_Dondi » Thu Jul 31, 2014 12:47 pm

Hi Pedro,
the code you have selected is a refuse of my test.

When it work (without job_rec) the result of trace is:

   132 *-*   do ix=1 to JNAME.0                                           
   133 *-*    /**/                                                         
   134 *-*    say JNAME.ix        JOBID.ix        RETCODE.ix               
       >>>      "CXF2TERM S0880649 "   
CXF2TERM S0880649                       
   135 *-*    IF (JNAME.ix = jn  & JOBID.ix = jid & RETCODE.ix <> "" )     
       >>>      "0"                                                       
   137 *-*   end                                                           
   132 *-*   do ix=1 to JNAME.0                                           
   133 *-*    /**/                                                       
   134 *-*    say JNAME.ix        JOBID.ix        RETCODE.ix             
       >>>      "CXF3TERM S0044095 CC 0000"                               
CXF3TERM S0044095 CC 0000                                                 
   135 *-*    IF (JNAME.ix = jn  & JOBID.ix = jid & RETCODE.ix <> "" )   
       >>>      "0"                                                       
   137 *-*   end     


If you see retcod.ix is NULL "" if job runn or the rc if is finished

When it work with job_rec the result of trace is:

   132 *-*   do ix=1 to JNAME.0                                                 
   133 *-*    /**/                                                             
   134 *-*    say JNAME.ix        JOBID.ix        RETCODE.ix                   
       >>>      "CXF2TERM S0880649 RETCODE.5009"                               
CXF2TERM S0880649 RETCODE.5009                                                 
   135 *-*    IF (JNAME.ix = jn  & JOBID.ix = jid & RETCODE.ix <> "" )         
       >>>      "0"                                                             
   137 *-*   end                                                               
   132 *-*   do ix=1 to JNAME.0                                                 
   133 *-*    /**/                                                             
   134 *-*    say JNAME.ix        JOBID.ix        RETCODE.ix                   
       >>>      "CXF3TERM S0044095 RETCODE.5010"                               
CXF3TERM S0044095 RETCODE.5010                                                 
   135 *-*    IF (JNAME.ix = jn  & JOBID.ix = jid & RETCODE.ix <> "" )         
       >>>      "0"                                                             
   137 *-*   end


ie no value to the variable that holds the value RETCODE.nnnnn (ix value)

Thanx
Enrico

Code'd
Enrico_Dondi
 
Posts: 4
Joined: Mon Jul 28, 2014 8:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX SDSF diff behavior during complete or partial exec

Postby Enrico_Dondi » Thu Jul 31, 2014 4:51 pm

Is possible this?

In this step I open DA panel
Address SDSF "ISFEXEC DA"       

and in a step get_rc I open ST panel
Address SDSF "ISFEXEC ST"       


I suspect that the sdsf not change panel... is possible?
and in this case I have two solution:
1) change DA to ST and control execution column
2) find the change panel command

Tnx
Enrico
Enrico_Dondi
 
Posts: 4
Joined: Mon Jul 28, 2014 8:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX SDSF diff behavior during complete or partial exec

Postby Pedro » Thu Jul 31, 2014 9:22 pm

the code you have selected is a refuse of my test.

Please do not ask us to try to debug your refuse.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: REXX SDSF diff behavior during complete or partial exec

Postby Pedro » Thu Jul 31, 2014 10:25 pm

Read the SDSF manual about the use of the ISFCOLS variable. It is both an input and an output variable. You do not set it in your exec, so it is created for you by the first SDSF call. I think the problem is that that output value from DA is used as input for the next SDSF call which is ST. DA does not have a RETCODE variable so you do not "ask" for it when you issue ST.

I recommend using the rexx DROP instruction to drop ISFCOLS between calls. If that does not work, then you should set ISFCOLS explicitly to get the columns that you want.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: REXX SDSF diff behavior during complete or partial exec

Postby Enrico_Dondi » Mon Aug 04, 2014 11:36 am

Hi Pedro,
thanks for the suggestion
I added
DROP isfcols
as a last line of proc rec_jobid (that of DA) before command return and and everything works correctly.

Enrico
Enrico_Dondi
 
Posts: 4
Joined: Mon Jul 28, 2014 8:09 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post