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
 

 

To validate JCL parameters by REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Jul 15, 2008 2:01 pm    Post subject: To validate JCL parameters by REXX
Reply with quote

I want to validate JCL parameters by REXX.
Like it should check for "CLASS", "MSGLEVEL", "MSGCLASS", jobname, "NOTIFY" etc.. and give the values in a report format...

Can i have one sample for the requirement.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jul 15, 2008 2:05 pm    Post subject:
Reply with quote

Please post your thread in the correct forum. What has this thread to do with JCL ? Moved to ISPF as ISPF macro(s) required.

Quote:
Can i have one sample for the requirement.

Only if somebody else has written the code to your exact requirement.

It should be fairly straightforward using ISPF EDIT macros
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 15, 2008 2:12 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

You are asking for a JCL parser written in REXX ??

what are Your rexx skills
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 15, 2008 6:16 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

Quote:
It should be fairly straightforward using ISPF EDIT macros


it depends on the parsing skills of the implementor icon_smile.gif

to give an idea of it here is a jcl reformatter/editor I have written

Code:

#! /bin/rexx
/*REXX- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

Trace "O"

__stime = time()
__etime = time("E")

gl.             = ""
dt.               = ""

dt.?blksize.3330    = 13030
dt.?dirblks.3330    = 28
dt.?trkscyl.3330    = 19
dt.?trksize.3330    = 13312

dt.?blksize.3350    = 19069
dt.?dirblks.3350   = 36
dt.?trkscyl.3350   = 30
dt.?trksize.3350   = 19456

dt.?blksize.3390   = 27998
dt.?dirblks.3390   = 45
dt.?trkscyl.3390   = 15
dt.?trksize.3390   = 56664

devtype          = "3350"
devdasd            = "SYSDA 3350 3390 3330 "
devtape            = "TAPE  2400 3400 "

parse source    gl.?srce
parse var      gl.?srce . . gl.?prog .
gl.?self       = filespec("N",gl.?prog)
parse var       gl.?self gl.?self "." .

gl.?msglvl    = 0
gl.?stdout    = "stdout"
gl.?stderr    = "stderr"
gl.?dbgout    = "stderr"

ampsnd   = "`"
apostr   = "~"

wchars   = "`~"
jchars   = "&'"

drop_tabl = "LABEL "
drop_subk = "RETAIN "

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

__stacked = 1

__convvol = 1
__convspc = 1
__convdcb = 1

call log "Started Time("__stime") "

parse arg args

args = space(args)
if args = "" then do
    call err "You need to specify a filename"
    signal err_exit
end

argc = words(args)

do iarg = 1 to argc

    fnam = strip(word(args ,iarg))

    if "" = strip(stream(fnam,"C","QUERY EXISTS") ) then do
        call err "File not found(" || fnam || ") "
        iterate
    end

    call log "Processing File("fnam") "

      outf = fnam || ".new"

    rcz  = stream(fnam,"C","OPEN READ")
      rcz  = stream(outf,"C","OPEN WRITE REPLACE")

    recs = 0
    orec = 0

   stmt_numb  = 0
   stmt_name  = ""
   stmt_oper  = ""
   stmt_data  = ""
   cont_flag  = 0

    do while ( lines(fnam) > 0 )
          buff = ""
          buff = linein(fnam)
      recs = recs + 1

          if   strip(buff)       =  "/*"  | ,
          strip(buff)       =  "//"  | ,
         substr(buff, 1,3) =  "//*" | ,
         substr(buff, 1,2) =  "/*"  | ,
         substr(buff, 1,2) <> "//" then do

         orec   = orec + 1
                call lineout outf ,buff
                iterate

      end

      buff = translate(buff,wchars,jchars)
      cont_flag = $Scan(buff)
      if cont_flag = 1  then ,
         iterate

      stmt_numb = stmt_numb + 1

      keyw_coun = 0;
      ppos_coun = 0;
      keyw_tabl = ""
      parm_buff = stmt_data || ","
      do while parm_buff <> ""
         keyw_name = $Keyw(parm_buff)
         if  keyw_name = "$" Then do
            ppos_coun = ppos_coun + 1
            keyw_name = "POSIT" || ppos_coun
         end
         if    wordpos(drop_tabl,keyw_name) = 0 then do
               temp         = stmt_oper"."keyw_name
               Interpret    stmt_oper"."keyw_name " = '"keyw_data"' "
               keyw_coun   = keyw_coun + 1
               keyw_tabl    = keyw_tabl || temp || " "
            end
         end

         if   stmt_name = "NONAME" then ,
            stmt_name = ""
         oper_leng  = length(stmt_oper)
         pref_leng  = length(stmt_name) + 2
         newstmt    = "//" || stmt_name
         if (pref_leng + 1 + oper_leng + 1 ) < 16 then ,
            newstmt = left(newstmt,14 - oper_leng) || stmt_oper || " "
         else ,
         if (pref_leng + 1                 ) < 16 then ,
            newstmt = left(newstmt,15) || stmt_oper || " "
         else ,
            newstmt = newstmt || " "   || stmt_oper || " "
         resspc_ = 71 - length(newstmt)

         interpret "call $Build_"stmt_oper

         if __stacked then ,
            call $Build_jcl keyw_tabl
         else ,
            do k = 1 To words(keyw_tabl)
               call $Build_jcl word(keyw_tabl,k)
            end

         keyw_tabl  = ""
      stmt_name  = ""
      stmt_oper  = ""
      stmt_data  = ""
      cont_flag  = 0

    end
    rcz = stream(fnam,"C","CLOSE")
    rcz = stream(outf,"C","CLOSE")

    Say "cards in   " recs
    Say "cards out  " orec

end

signal std_exit

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
Std_Exit:
    call log "Ended   Time("time()") Elapsed("time('E')") "
    Exit

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
Err_Exit:
    call log "Ended   Time("time()") Elapsed("time('E')") "
    Exit

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
log:
   parse arg log?t
    call lineout gl.?stdout, left(gl.?self,8) || "- " || strip(log?t)
    return

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
err:
    parse arg err?t
    call lineout gl.?stderr, left(gl.?self,8) || "- " || strip(err?t)
    return

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                   */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Edit:Procedure expose  jchars ,
                  wchars

   card = translate(arg(1),jchars,wchars)
   p_ =  pos("PARM^",card)
   if p_ <> 0 then ,
      card = overlay("PARM.",card,p_,5)
   return card

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Scan:Procedure expose   apostr ampsnd ,
                  stmt_name ,
                  stmt_oper ,
                  stmt_data 
   card = left(arg(1),80)

   card = left(left(card,71),80)
   p_ =  pos("PARM.",card)
   if p_ <> 0 then ,
      card = overlay("PARM^",card,p_,5)
   if stmt_name         = ""  then do
      if substr(card,3,1) = " " then do
         stmt_name = "NONAME"
         card = strip(substr(card,3))
      end
      else do
         stmt_name = strip(word(substr(card,3),1))
         card = strip(substr(card,3))
         card = strip(delword(card,1,1))
      end
      stmt_oper = word(card,1)
      card = strip(delword(card,1,1)) || " "
   end
   else do
      card = strip(substr(card,3)) || " "
   end

   _b  = 1
   _a  = pos(apostr,card)
   do while ( _a > 0 )
      _b = _a
      _a  = pos(apostr,card,_b+1)
   end

   _b = pos(" ",card,_b+1)
   card = strip(substr(card,1,_b))

   stmt_data = stmt_data || card
   if right(stmt_data,1) = "," then ,
      cont_flag = 1
   else
      cont_flag = 0

   return cont_flag

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Keyw:Procedure   Expose   ampsnd apostr ,
                  parm_buff ,
                  keyw_data

   data = Arg(1)
   Select
      When Left(data,1) = apostr | ,
         Left(data,1) = "("    Then do
         l_kwrd = 0
         i_parm = 1
         l_Skip = 1
         keyw   = "$"
      end
      When Pos("=",data)  =  0 | ,
         Pos("=",data) <>  0 & ,
         Pos(",",data)  <  Pos("=",data) Then do
         l_kwrd = 0
         i_parm = 1
         l_Skip = 1
         keyw   = "$"
      end
      Otherwise do
         l_kwrd = Pos("=",data) - 1
         i_parm = Pos("=",data) + 1
         l_Skip = 1
         keyw = Left(data,l_kwrd)
      end
   end
   Select
      When Substr(data,i_parm,1) = "(" Then do
         z_parm = Pos(")",data,i_parm+1)
         i_Skip = Pos("(",data,i_parm+1)
         do while (i_Skip <> 0 & ,
                  i_Skip  < z_parm)
            z_parm = Pos(")",data,z_parm+1)
            i_Skip = Pos("(",data,i_skip+1)
         end
         l_parm = z_parm - i_parm + 1
      end
      When Substr(data,i_parm,1) = apostr Then do
         z_parm = Pos(apostr,data,i_parm+1)
         do while Substr(data,z_parm+1,1) = apostr
            z_parm = Pos(apostr,data,z_parm+2)
         end
         l_parm = z_parm - i_parm + 1
      end
      Otherwise do
         z_parm = Pos(",",data,i_parm) - 1
         l_parm = z_parm - i_parm + 1
      end
   end
   keyw_data = Substr(data,i_parm,l_parm)
   parm_buff = Delstr(data,1,z_parm+l_Skip)
   Return keyw

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Build_jcl:

      kwds_buff = space(arg(1))
   /*
   say "****** $Build_jcl:kwds_buff >>" || kwds_buff || "<<"
   */
      do k_ = 1 To words(kwds_buff)
         curr_keyw = Strip(word(kwds_buff,k_))
         p = Lastpos(".",curr_keyw)
         if p = 0 Then ,
            full_keyw = stmt_oper || "." || curr_keyw
         Else do
            full_keyw = curr_keyw
            curr_keyw = Substr(full_keyw,p+1)
         end
         v = (symbol(full_keyw) = "VAR")
         if v Then do
            insert_ = 1
            kval = Value(full_keyw)
            Interpret "Drop "full_keyw
            if Left(curr_keyw,5) = "POSIT" Then ,
               ktoken_ = kval
            Else ,
               ktoken_ = curr_keyw || "=" || kval

            keyw_coun = keyw_coun - 1
            if keyw_coun > 0  Then ,
               ktoken_ = ktoken_ || ","
            if resspc_ > length(ktoken_) then do
               resspc_ = resspc_ - length(ktoken_)
               newstmt = newstmt || ktoken_
               ktoken_ = ""
            end
            else do
            orec   = orec + 1
            call    lineout outf, $Edit(newstmt)
               newstmt = Left("//",15) || ktoken_
               ktoken_ = ""
               resspc_ = 71 - length(newstmt)
            end
         end
      end

   if    insert_ Then do
      orec   = orec + 1
      call    lineout outf, $Edit(newstmt)
          newstmt = Left("//",15) || ktoken_
          ktoken_ = ""
          resspc_ = 71 - length(newstmt)
         insert_ = 0
      end

      Return

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Build_job:
      insert_ = 0
      call $Build_jcl "POSIT1 POSIT2 NOTIFY"
      call $Build_jcl "CLASS MSGCLASS MSGLEVEL"
      call $Build_jcl "REGION TIME"
      call $Build_jcl "COND"
      call $Build_jcl "USER PASSWORD GROUP"

      Return

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Build_proc:
      insert_ = 0
      call $Build_jcl "PGM REGION TIME"
      call $Build_jcl "COND"
      Return


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Build_exec:
      insert_ = 0
      call $Build_jcl "PGM REGION TIME"
      call $Build_jcl "PROC REGION TIME"
      call $Build_jcl "POSIT1 REGION TIME"
      call $Build_jcl "COND"
      Return

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$Build_dd:

   if   ( symbol("DD.DSNAME") = "VAR" ) then do 
      DD.DSN = DD.DSNAME
      keyw_tabl = keyw_tabl || "DD.DSN" || " "
      keyw_coun = keyw_coun + 1      

      trace "I"
        drop DSNAME   
      wp = wordpos("DSNAME",keyw_tabl)
      if    wp > 0 then do
         keyw_tabl = delword(keyw_tabl,wp,1)
         keyw_coun = keyw_coun - 1      
      end

        drop DD.DSNAME   
      wp = wordpos("DD.DSNAME",keyw_tabl)
      if    wp > 0 then do
         keyw_tabl = delword(keyw_tabl,wp,1)
         keyw_coun = keyw_coun - 1      
      end
      trace "O"

   end
   if   ( symbol("DD.VOLUME") = "VAR" ) then do 

      DD.VOL = DD.VOLUME
      keyw_tabl = keyw_tabl || "DD.VOL" || " "
      keyw_coun = keyw_coun + 1      

      wp = wordpos("VOLUME",keyw_tabl)
      if    wp > 0 then do
         keyw_tabl = delword(keyw_tabl,wp,1)
         keyw_coun = keyw_coun - 1   
         drop VOLUME   
      end
      wp = wordpos("DD.VOLUME",keyw_tabl)
      if    wp > 0 then do
         keyw_tabl = delword(keyw_tabl,wp,1)
         keyw_coun = keyw_coun - 1      
           drop DD.VOLUME
      end

   end

      if    __convvol = 1 & ,
         symbol("DD.VOL") = "VAR" Then do

         zvlser = $extract("SER=",$strip(dd.vol,"(",")"))
      if zvlser = "" then do
         drop VOL
         wp = wordpos("VOL",keyw_tabl)
         if    wp > 0 then do
            keyw_tabl = delword(keyw_tabl,wp,1)
            keyw_coun = keyw_coun - 1      
         end
           drop DD.VOL
         wp = wordpos("DD.VOL",keyw_tabl)
         if    wp > 0 then do
            keyw_tabl = delword(keyw_tabl,wp,1)
            keyw_coun = keyw_coun - 1      
         end
      end
      else ,
         dd.vol = "SER=" || zvlser
   
      trace "O"
   end
   
      if __convspc = 1 & ,
         symbol("DD.SPACE") = "VAR" Then do

         zspace = $strip(dd.space,"(",")")
         zunits = $extract(1,zspace)
         zalloc = $strip($extract(2,zspace),"(",")")
         prispc = $extract(1,zalloc)
         secspc = $extract(2,zalloc)
         dirblk = $extract(3,zalloc)

         if datatype(zunits) = "NUM" then do
            rectrk = $trkbal(zunits)
            prispc = ( prispc % rectrk ) + 1
            if  secspc <> "" & ,
               secspc <> 0  then do
               secspc = ( secspc % rectrk ) + 1
            end
            zunits = "TRK"
         end
         if zunits = "TRK" then do
            prispc = ( prispc % dt.?trkscyl.devtype ) + 1
            if    secspc <> "" & ,
               secspc <> 0  then do
               secspc = ( secspc % dt.?trkscyl.devtype ) + 1
            end
            zunits = "CYL"
         end
         prispc = $round(prispc,8)
         if  secspc <> "" & ,
            secspc <> 0  then do
            sectmp = prispc % 5 + 1
            if sectmp > secspc then ,
               secspc = sectmp
            secspc = $round(secspc,8)
            zalloc = $replace(2,zalloc,secspc)
            if secspc > prispc then ,
               prispc = secspc
         end
         zalloc = $replace(1,zalloc,prispc)
         if dirblk <> "" & ,
            dirblk <>  0 then do
            dirblk = $round(dirblk,dt.?dirblks.devtype)  - 1
            zalloc = $replace(3,zalloc,dirblk)
         end
         zalloc = "(" || zalloc || ")"
         zspace    = $replace(1,zspace,zunits)
         zspace    = $replace(2,zspace,zalloc)
         dd.space  = "(" || zspace || ")"
      end
      if __convdcb = 1 & ,
         symbol("DD.DCB")   = "VAR" Then do
         zdcb   = $strip(dd.dcb,"(",")")
         zrecfm = $extract("RECFM=",zdcb)
         zlrecl = $extract("LRECL=",zdcb)
         zblksz = $extract("BLKSIZE=",zdcb)
         zdsorg = $extract("DSORG=",zdcb)

/*
      say "****** dsname >>" || dd.dsn || "<<"
      say "****** zdcb   >>" || zdcb   || "<<"
      say "****** zrecfm >>" || zrecfm || "<<"
      say "****** zlrecl >>" || zlrecl || "<<"
      say "****** zblksz >>" || zblksz || "<<"
      say "****** zdsorg >>" || zdsorg || "<<"
*/

         select
            when zrecfm = "U"   | ,
                  zrecfm = "VB"  | ,
                  zrecfm = "VBA" then do
            if zblksz = 1024 then do
            end
            else do
                  zblksz =  dt.?blksize.devtype
                  zdcb = $replace("BLKSIZE=",zdcb,zblksz)
            end
            end
            when zrecfm = "FB" then do
            if  zblksz = 80  | ,
               zblksz = 800 then do
            end
            else do
                  zblksz  = zlrecl * ( dt.?blksize.devtype % zlrecl )
                  zdcb = $replace("BLKSIZE=",zdcb,zblksz)
            end   
            end
            otherwise nop
         end
         dd.dcb  = "(" || zdcb || ")"
      end
      insert_ = 0

      call $Build_jcl "POSIT1"
      call $Build_jcl "DD.SYSOUT  DD.OUTPUT"

      if  ( symbol("DD.DSN") = "VAR"     & ,
        length(strip(dd.dsn)) > 36 ) then
      call $Build_jcl "DISP"

   /*
   if  symbol("DD.DISP") = "VAR" & ,
      Left(dd.disp,1)   = "("     Then ,
      call $Build_jcl "DISP"
   */

   call $Build_jcl "DISP DSN"
      if (symbol("DD.VOL")    = "VAR" ) then ,
      call $Build_jcl "UNIT VOL" 

   call $Build_jcl "UNIT SPACE"
      call $Build_jcl "LABEL"
   call $Build_jcl "DCB"
      Return

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$extract:procedure
      parse arg keywrd, target
      itable = "'" || '"' || "("
      otable = "'" || '"' || ")"
      target = target || ","
      result = ""
      if datatype(keywrd) = "NUM" then do
         do k = 1 to keywrd while target <> ""
            zdelim = ","
            if left(target,1) = '"' | ,
               left(target,1) = "'" | ,
               left(target,1) = "(" then ,
               zdelim = translate(left(target,1),otable,itable)
            de = pos(zdelim,target) + ( zdelim <> "," )
            if k = keywrd then do
               result = left(target,de-1)
               leave
            end
            target = substr(target,de+1)
         end
      end
      else do
         kl = length(keywrd)
         ks = pos(keywrd,target)
         if ks  > 0 then do
            ds = ks + kl
            zdelim = ","
            if   substr(target,ds,1) = '"' | ,
            substr(target,ds,1) = "'" | ,
                  substr(target,ds,1) = "(" then ,
               zdelim = translate(substr(target,ds,1),otable,itable)
            de = pos(zdelim,target,ds) + ( zdelim <> "," )
            dl = de - ds
            result = substr(target,ds,dl)
         end
      end
      return result

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$replace:procedure
      parse arg keywrd, target, string
      itable = "'" || '"' || "("
      otable = "'" || '"' || ")"
      target = target || ","
      result = target
      if datatype(keywrd) = "NUM" then do
         dn = 1
         do keywrd
            ds = dn
            zdelim = ","
            if substr(target,ds,1) = '"' | ,
               substr(target,ds,1) = "'" | ,
               substr(target,ds,1) = "(" then ,
               zdelim = translate(substr(target,ds,1),otable,itable)
            de = pos(zdelim,target,ds) + ( zdelim <> "," )
            dn = de + 1
         end
         head = substr(target,1,ds-1)
         tail = substr(target,de)
         result = head || string || tail
      end
      else do
         kl = length(keywrd)
         ks = pos(keywrd,target)
         if ks  > 0 then do
            head = substr(target,1,ks-1)
            ds = ks + kl
            zdelim = ","
            if substr(target,ds,1) = '"' | ,
               substr(target,ds,1) = "'" | ,
               substr(target,ds,1) = "(" then ,
               zdelim = translate(substr(target,ds,1),otable,itable)
            de = pos(zdelim,target,ds) + ( zdelim <> "," )
            tail = substr(target,de)
            result = head || keywrd || string || tail
         end
      end
      result = strip(result,"T",",")
      return result

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$strip:procedure
      parse arg string , head, tail
   wstr = string
      if  tail = "" then ,
         tail = head

   wstr = string
   llen = 0
      do while ( pos(left(wstr,1),head) > 0 )
         llen = llen + 1
      wstr = substr(wstr,2)
      end
      wstr = reverse(wstr)
   rlen = 0
      do while ( pos(left(wstr,1),tail) > 0 )
      rlen = rlen + 1
         wstr = substr(wstr,2)
      end
   if llen = rlen then do
         result = reverse(wstr)
         return result
   end

   if  llen < rlen then ,
      leng = llen
   else ,
      leng = rlen

   wstr = string
      do leng while ( pos(left(wstr,1),head) > 0 )
      wstr = substr(wstr,2)
      end
      wstr = reverse(wstr)
      do leng while ( pos(left(wstr,1),tail) > 0 )
         wstr = substr(wstr,2)
      end
   result = reverse(wstr)
   return result

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$trkbal:procedure expose dt. devtype
      parse arg blksz
      trkrec = dt.?trksize.devtype % blksz
      return trkrec

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
$round:procedure
      parse arg numb, fact
      numb = fact * ( ( numb % fact ) + 1 )
      return numb


hope that the TS skills are better than average
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jul 15, 2008 6:24 pm    Post subject:
Reply with quote

Hell, if us old gribs can do it ............. icon_rolleyes.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 15, 2008 6:32 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

the issue for the PC rexx version is the I have to keep track Of the keywords
while they are accumulated ( keyw_tabl,keyw_coun) stuff

under tso is much simpler, I have a rexx function RXVARS that returns all the variable names with a certain pattern
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Jul 15, 2008 9:27 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

I have only a very basic knowledge of REXX...
Not able to get through the logic provided by enrico-sorichetti.

But i feel REXX could be better to solve the purpose...

More explanation to my requirement -
I need to check the following -
1. JCL parameters.
2. Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).

Basic need is to check if any of the production parameters are not used and that if any of the production files are not attempted for addition or updation.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 15, 2008 9:46 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

Quote:

...
I need to check the following -
1. JCL parameters.
2. Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).



the code might not easy to understand because its a parser based on the structure of jcl language, with no reference to the jcl keywords being used
- I.E whenever a pattern is found of the type some_string=something
some_string is assumed to be a jcl keyword,
so apart the formal apperance balanced parentheses, apostrophes
anything is considered valid ( I did not want to be troubled by new keyword being added )

the only place where the keywords are referenced is at the rebuild stage
when I call the build function with the keyword names to rebuild in a particular sequence

otherwise all the variables are build dynamically the values are set
using INTERPRET and retrieved using VALUE

anyway writing something along the lines of my script is the only way to go
remember anyway that from jcl only You might not be able to infer the mode of a dataset
- You can use in output a DISP=SHR or DISP=OLD
but You can filter and classify on the disposition

I really thing that You cannot get away with less than I showed You
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 15, 2008 10:11 pm    Post subject:
Reply with quote

Hello,

Quote:
I have only a very basic knowledge of REXX...
Not able to get through the logic provided by enrico-sorichetti.

But i feel REXX could be better to solve the purpose...
As has been mentioned, this is not a basic task - it is an advanced task. If you cannot follow the code Enrico posted, this probably means that you need to learn much more before attempting this. Yes, REXX is a good tool for this type of requirement, but only when the developer is fluent with the tool.

Where did this requirement originate?
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Jul 15, 2008 10:16 pm    Post subject:
Reply with quote

For checking the file updation, "DISP=SHR or DISP=OLD" will not help since it do not signify whether the file is updated or just used as input in the job.

Is there any other way which could better solve the requirement and could be moulded as per requirement more easily.
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Jul 15, 2008 10:24 pm    Post subject:
Reply with quote

Enrico, can you please explain how to use the code you had provided so that i could go through the logic of the code with a better understanding.

The requirement is meant for reviewing the JCL for the specified checks in one go.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 15, 2008 11:04 pm    Post subject:
Reply with quote

Hello,

There is no way to tell "for sure" if an existing dataset is updated by only looking at the jcl icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 15, 2008 11:41 pm    Post subject: Reply to: To validate JCL parameters by REXX
Reply with quote

Quote:
Display the files used in the JCL which are updated or created (can be in any Easytrieve as well in update mode).


for this type of reporting the best thing would be to process smf data..


I suggest You talk to the storage support group to verify that :
smf collection is activated for dataset open/close/activity
( record types 14/15/42s - if I remember correctly )

as far as smf processing is concerned,
unless Your support has something already written
I would suggest to ask them to look on the net for a freeware utility
called DAF - Dataset Audit Facility
http://www.geocities.com/michaeljosephcleary/Freeware.html
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


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