Page 1 of 1

SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Wed Oct 23, 2013 6:22 am
by Viswanathchandru
Dear all,

I'm trying to capture an executing job for eg., my TSO id. But I'm ending up with error. The same script is working for queue=print, but not for queue=execution. Any suggestion would be really helpful. Below is the code that i used.


/* REXX */                                             
"ALLOC F (FINAL) DA ('SYS833K.PRODCHKT.TRACK') SHR REU"
"EXECIO * DISKR FINAL (STEM STC. FINIS"                 
DO I=1 TO STC.0                                         
ISFOWNER= '*'                                           
JOBNAME='SYS833K'                                       
HLQ=SYS833K                                             
RC=ISFCALLS('ON')                                       
MAIN:                                                   
IF I>STC.0 THEN                                         
EXIT                                                   
 PARSE VAR STC.I S1 "." S2 "." S3                       
 JOBNAM=STRIP(S1)                                       
 STATUS=STRIP(S2)                                       
 LOOKMSG=STRIP(S3)                                     
 JNAME=SUBSTR(JOBNAM,1,6)                               
 ISFPREFIX=JOBNAM                       
 IF STATUS=STC THEN                     
    STATUS=EXECUTION                   
  ELSE                                 
    STATUS=PRINT                       
ISFSORT='JOBID'                         
IF RC <> 0 THEN DO                     
   SAY 'ISFCALLS RC='RC                 
   RETURN RC                           
END                                     
ADDRESS SDSF 'ISFEXEC ST'               
IF RC <> 0 THEN DO                     
   SAY 'ISFEXEC RC='RC                 
   RETURN RC                           
END                                     
DO IX=1 TO JNAME.0                     
TRACE ?R                                                             
   IF QUEUE.IX=STATUS                                               
   THEN                                                             
   DO                                                               
   "ALLOC F (SPLV) DA ('"USERID()".LICFIN.PDS("JNAME.IX")') SHR REU"
        CC=RC                                                       
     END                     



Thanks,
Viswa..

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Wed Oct 23, 2013 9:17 pm
by dick scherrer
Hello,

Have you run a trace? Suggest you post the info from the trace.

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 1:01 am
by enrico-sorichetti
apart the misleading title of the topic ( where is the XDC ??? )
unfortunately the code snippet posted does not make any sense

why in heaven ????

DO I = 1 TO STC.0

and after a while
MAIN:                                                   
    IF I>STC.0 THEN                                         
        EXIT                                                   

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 2:18 am
by Pedro
But I'm ending up with error.

What are the symptoms of the error?

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 4:37 am
by Pedro
You are missing some END statements.

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 5:11 am
by Pedro
You set RC by using ISFCALLS then much later, you check the RC value. You should check it right away.

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 5:12 am
by Pedro
This worked for me:
/* REXX */                         
ISF_RC=ISFCALLS('ON')               
If ISF_RC <> 0 Then Do             
   Say 'ISFCALLS RC='ISF_RC         
   Return ISF_RC                   
End                                 
                                   
STC.1 = 'PEDRO.EXECUTION'           
STC.2 = 'JCADDH21.PRINT'           
STC.0 = 2                           
                                   
Do I = 1 To STC.0                   
  ISFOWNER= '*'                     
  Parse VAR STC.I S1 "." S2 "." S3 
  JOBNAM   = STRIP(S1)             
  STATUS   = STRIP(S2)             
  ISFPREFIX= JOBNAM                 
  ISFSORT  = 'JOBID'               
                                   
  Address SDSF 'ISFEXEC ST'         
  If RC <> 0 Then Do               
    Say 'ISFEXEC RC='RC             
    Return RC                       
  End                               
                                   
  Say 'number of rows' isfrows     
  Do IX=1 To JNAME.0               
    If (queue.ix = status) Then     
      Say 'JNAME('jname.ix') ' ,   
          'JOBID('jobid.ix') ' ,   
          'queue('queue.ix')'       
  End                               
End                                 

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 5:29 am
by Pedro
BTW, after struggling to get job information using the SDSF batch interface from rexx, I asked the SDSF developers for an interface better suited for rexx. They came up with the rexx api for SDSF.

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 11:02 pm
by Viswanathchandru
Oh!!! I will work on the suggestions. Thank you so much experts... for your valuable time and suggestions...


Thanks,
Viswa..

Re: SDSF Rexx - Error in xdc'ing executing job.

PostPosted: Thu Oct 24, 2013 11:15 pm
by Viswanathchandru
Hi Pedro and enrico,

I'm extremely sorry for not posting the complete code. I had copied the entire content here, not sure why its not reflecting the entire code. I can just see only a part of it. Not sure why.. My apologies for that.

Here is the complete code.

/* REXX */                                                   
"ALLOC DA('SYS833K.LICENSE.TRACK') F(LICTRK) SHR REU"         
"EXECIO * DISKR LICTRK(STEM LICTR. FINIS"                     
  DO I=1 TO LICTR.0                                           
PARSE VAR LICTR.I S1 " " S2 "." S3                           
JOBNAM=STRIP(S1)                                             
LICMSG=STRIP(S2)                                             
LICCON=STRIP(S3)                                             
ISFOWNER='SYS833K'                                           
ISFPREFIX=JOBNAM                                             
HLQ=SYS833K                                                   
RC=ISFCALLS('ON')                                             
ISFSORT='JOBID'                                               
IF RC <> 0 THEN DO                                           
   SAY 'ISFCALLS RC='RC                                       
   RETURN RC                                                 
END                                                           
ADDRESS SDSF 'ISFEXEC ST'                                             
IF RC <> 0 THEN DO                                                   
   SAY 'ISFEXEC RC='RC                                               
   RETURN RC                                                         
END                                                                   
DO IX=1 TO JNAME.0                                                   
   IF QUEUE.IX <> 'PRINT' & ,                                         
      QUEUE.IX <> 'OUTPUT'  ,                                         
     THEN ITERATE                                                     
   JNAME=SUBSTR(JNAME.IX,1,6)                                         
   JNAMEF=JNAME||I                                                   
   SAY JNAMEF                                                         
   DO                                                                 
     "ALLOC F (SPLV) DA ('"USERID()".LICFIN.PDS("JNAMEF")') SHR REU" 
        CC=RC                                                         
     END                                                             
     IF CC <> 0 THEN DO                                               
        SAY "FAILED TO ALLOCATE "JNAME.IX"."JOBID.IX             
        ITERATE                                                 
     END                                                         
     ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.IX"') PARM(NP SA)"   
     DO JX=1 TO ISFDDNAME.0                                     
        DO FOREVER                                               
        "EXECIO 10000 DISKR "ISFDDNAME.JX"(STEM LINE. "         
                 LINES = LINE.0                                 
               LINES = LINE.0                                   
               IF RC=2 THEN RC=0                                 
               IF RC <> 0 THEN DO                               
                  SAY "LINES READ="LINES" RC="RC                 
                  EXIT 12;                                       
               END                                               
               "EXECIO * DISKW SPLV (STEM LINE."                 
               DROP LINE.                                       
               IF LINES<10000 THEN LEAVE                         
          END                                         
          "EXECIO 0 DISKR "ISFDDNAME.JX"(FINIS"       
       END                                             
       DROP ISFDDNAME.                                 
     "EXECIO 0 DISKW SPLV(FINIS"                       
     "FREE FI(SPLV)"                                   
  END                                                 
  END       


And I'm getting the RC 8 here..

     ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.IX"') PARM(NP SA)"   


Any suggestions will be helpful..

Many thanks,
Viswa...