Dear all,

As promised, below please find the rexx program. It was not fully tested,
and need some enhancements ((like support for instream set commands that is
easy to implement and will come soon).  The atatched will help you use
variables in the a jcl like this:

//jobcard  etc.
//var1     jcllib order=my.pds

//include  unclude member=setup

//step1    exec pgm=idcams
//sysprint dd   sysout=*
//sysin    dd   *
  listcat ent(&hlq.data) all     
  delete &hlq..data
  Listcat ent(&hlq..data) all
/*

Will be happpy to get feedbacks. Enjoy it. 

| Itschak Mugzach | Director | SecuriTeam Software |
| Email: [EMAIL PROTECTED] | Mob: +972 522 986404 | Skype: Itschak
Mugzach | Web: www.Securiteam.co.il  |

/* MugiRexx */                                                          
   Signal set.Var                                                       
   Trace On                                                             
Set.Doc:                                                                
   ------------------------------------------------------------------   
                         JCL SET Support for SYSIN                      
                                                                        
   Function: This program runs as an EDIT MACRO replacing the original  
             SUB macro. It will substitute Variables in an "DD *" type  
             datasets (Instream sysin) based on the JCL SET commands.   
                                                                        
             Below are the main functions of the program:               
             > checkpoint with save, change profile to nosave rec on.   
             > Find and read the INCLUDE member pointed by JCCLIB.      
             > Create a command table that holds the vars & values.     
             > Ignores none sysin variables (Let interpeter dos it).    
             > Mark the "DD *" data with labels.                        
             > Do the actual change.                                    
             > Submit the job                                           
             > Discard changes.                                         
                                                                        
   NextRel.: > Support for Instream SET command                         
             > Ignore IEBUPDTE inputs                                   
                                                                        
   Location: Your Clist (sysproc) concatanation.                        
                                                                        
   Contact:   <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]

                                                                        
   (c) SecuriTeam Software Ltd. 1999-2008                               
   ------------------------------------------------------------------   
Set.Var:                                                                
   Cindx        = 1                                                     
   Csetup.0     =  1                                                    
   Csetup.1.Var = '..'                                                  
   Csetup.1.Val = '.'                                                   
   Lindx        = 0                                                     
   LabelStr     = "abcdefghijklmnopqrstuvwxyz"                          
   SIFlag       = -1                                                    
                                                                        
Set.MsgDir:                                                             
   SA0001E = "SA0001E no JCLLIB Definition found in"                    
   SA0002E = "SA0002E no INCLUDE Definition found in"                   
   SA0003I = "SA0003I variable name & value:"                           
                                                                        
Set.Main:                                                               
   Address ISPEXEC                                                      
      "isredit macro"                                                   
      "ISREDIT Recovery On"                 /* Enable UNDO      */      
      "ISREDIT Nosave "                     /* Enable UNDO      */   
      "ISREDIT (qfdsn) = DATASET"           /* get library name */      
      "ISREDIT (qmemb) = MEMBER"            /* get Member  name */      
   If (Qmemb <> 'QMEMB') Then Do            /* meber of pds?    */      
      Qfdsn   = qfdsn||'('||Qmemb||')'      /* create full dsn  */      
      end                                                               
   "ISREDIT FIND 'JCLLIB' first"            /* locate in jcl    */      
   If (Rc > 0) Then do                      /* not found?       */      
      say SA0001E qfdsn                                                 
      exit                                  /* tell & exit      */      
      end                                   /* of not found     */      
   "ISREDIT (TextLine) = LINE .ZCSR"        /* Get Line number  */      
   Qvardsn = Substr(TextLine,Pos('ORDER=',TextLine)+6)                  
   "ISREDIT FIND 'INCLUDE' first"           /* locate in jcl    */      
   If (Rc > 0) Then do                      /* Not found?       */      
      say SA0002E qfdsn                                                 
      exit                                  /* Tell & Exit      */      
      end                                   /* of RC>0          */      
   "ISREDIT (TextLine) = LINE .ZCSR"        /* Get text in line */      
   Qvardsn = Strip(Qvardsn)||'('||,         /* Build dsn of set */      
      Strip(Substr(TextLine,Pos('MEMBER=',TextLine)+7))||')'            
   ADDRESS TSO                              /* switch to tso    */      
      "Alloc f(QSETUP) da("||Qvardsn||") shr reuse"                     
      "EXECIO * DISKR QSETUP (FINIS STEM QSETUP."                       
      Qindx = 0                                                         
      Do While (Qindx < Qsetup.0)                                       
         Qindx = Qindx + 1                                              
         TextLine = Qsetup.Qindx                                        
         If (Substr(TextLine,1,3) = '//*') Then Do                      
            Iterate                                                     
            end                                                         
         TextLine = Translate(textline,' ','=')                         
         Cindx = Cindx + 1                                             
         Csetup.Cindx.Var  = '&'||Word(Textline,3)                     
         Csetup.Cindx.Val  = Word(Textline,4)                          
     /*  say 'var=' Csetup.Cindx.Var                                   
         Say 'Val=' Csetup.Cindx.Val */                                
         end                                                           
      Address ispexec                 /* switch back to member */      
      "isredit (lastline) = LINENUM .zlast"                            
      Qindx = 0                                                        
      Do While (Qindx < LastLine)                                      
         Qindx = Qindx + 1                                             
         "ISREDIT (TextLine) = LINE " Qindx                            
         If (Substr(TextLine,1,1) = '/') Then do                       
            If (SIFlag > 0) Then Do                                    
               "ISREDIT LABEL " Qindx-1 "=" ".E"||,                    
                   Substr(LabelStr,LIndx,1)                            
               say ".E"||,                                             
                   Substr(LabelStr,LIndx,1)                            
               Say 'end   label at line' Qindx-1                       
               SIFlag = -1                                             
              Iterate                                                  
              end                                                      
           SIFlag = 0                                                  
           Iterate                                                     
           End                                                         
        If (SIFlag < 1) Then Do                                        
           LIndx = LIndx + 1                                           
           "ISREDIT LABEL " Qindx " = " ".S"||Substr(LabelStr,LIndx,1) 
              Say 'start label at line' Qindx                          
           end                                                         
        SIFlag = SIFlag + 1                                            
        End                                                            
     exit                                                              
     Cindx   = 0                                                       
     Tindx   = 0                                                       
     ChngCnt = 0                                                       
     Do while (Cindx < Csetup)                                         
        Cindx = Cindx + 1                                              
        CmdVar = Csetup.Cindx.Var                                      
        CmdVal = Csetup.Cindx.Var                                      
         Do while (Tindx < LIndx)                                       
            Tindx = Tindx + 1                                           
            SLabel = ".S"||Substr(LabStr,Tindx,1)                       
            ELabel = ".E"||Substr(LabStr,Tindx,1)                       
            "isredit change " CmdVar CmdVal " ALL " Slabel Elabel       
            If (Rc = 0) then do                                         
               ChngCnt = ChngCnt + 1                                    
               End                                                      
            End                                                         
         End                                                            
      /* undo changes                                                   
      CIndx = 0                                                         
      Do While (Cindx < ChngCnt)                                        
         Cindx = Cindx + 1                                              
         "ISREDIT UNDO"                                                 
         End */                                                         
     Say "That All folks"                                               


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to