Hi all,
use following rexx code to achieve what I want:
run_under_mvs = 1                                                               
vol_cnt. = 0 /*vol cnt*/                                                        
vol_seq. = 0 /*vol seq*/                                                        
vol_name. = 0 /*volser*/                                                        
dsn_name. = 0                                                                   
rmm_cont = ''                                                                   
ix = 1                                                                          
debug = 1                                                                       
sysauth.edgdate = "EUROPEAN"        /* Tell RMM TSO command to return */        
                                    /* output as REXX variables and   */        
                                    /* dates in EUROPEAN (DD/MM/YYYY) */        
                                    /* format.                        */        
save_prompt = prompt("OFF")         /* Turn PROMPTing off.            */        
save_msg    = msg("OFF")            /* Turn messages off.             */        
                                    /* Get information for data sets  */        
                                    /* on the volume                  */        
address "TSO" "RMM SD D("dsn") OWNER(*) SEQ(*) LIMIT(1) ",                      
        "STatus(PRIVATE) CONTINUE("rmm_cont")"                                  
junk = msg(save_msg)                /* Restore previous message status*/        
                                                                                
if debug = 1 then do                                                            
  say "edg@rc=" edg@rc                                                          
  say "rc=" rc                                                                  
  say "edg@dsn.0=" edg@dsn.0                                                    
  say "edg@cont=" edg@cont                                                      
end                                                                             
If (rc = 0) ! ((rc=4)&(edg@rc=2))  then do                                      
    do while (rc = 0) ! ((rc=4)&(edg@rc=2))                                     
      Do dataset = 1 to edg@dsn.0                                               
        if debug = 1 then do                                                    
          say "edg@dsn=" edg@dsn.dataset                                        
          say "edg@oxd=" edg@oxd.dataset                                        
          say "edg@xdt=" edg@xdt.dataset                                        
          say "edg@cdt=" edg@cdt.dataset                                        
          say "edg@cdtj=" edg@cdtj.dataset                                      
          say "edg@cjbn=" edg@cjbn.dataset                                      
          say "edg@ctm=" edg@ctm.dataset                                        
          say "edg@own=" edg@own.dataset                                        
          say "edg@vol=" edg@vol.dataset                                        
          say "edg@rc=" edg@rc                                                  
          say "rc=" rc                                                          
          say "edg@dsn.0=" edg@dsn.0                                            
        end                                                                     
        vol_name.ix = edg@vol.dataset                                           
        dsn_name.ix = edg@dsn.dataset                                           
        ix = ix + 1                                                             
      end                                                                       
      rmm_cont = edg@cont                                                       
      if rmm_cont <> '' then                                                    
        address "TSO" "RMM SD D("dsn") OWNER(*) SEQ(*) LIMIT(1)",               
        " STatus(PRIVATE) CONTINUE("rmm_cont")"                                 
  end /* do while*/                                                             
  vol_name.0 = ix -1                                                            
  dsn_name.0 = ix -1                                                            
  say "ix=" ix                                                                  
  /* save vol_seq and vol_cnt */                                                
  /* issue sd with chain */                                                     
  do ix=1 to vol_name.0                                                         
    vol=vol_name.ix                                                             
    if debug = 1 then do                                                        
      say "vol=" vol_name.ix                                                    
      say "dsn=" dsn_name.ix                                                    
      say "vol_seq."vol"="vol_seq.vol                                           
      say "vol_cnt."vol"="vol_cnt.vol                                           
    end                                                                         
    if vol_seq.vol = 0  then do /* not already saved/processed*/                
      address "TSO" "RMM SD D('"dsn_name.ix"') OWNER(*) SEQ(*) ",               
      " LIMIT(*) STatus(PRIVATE) CHAIN volume("vol_name.ix")"                   
      say "chain rc=" rc                                                        
      say "edg@dsn.0" edg@dsn.0                                                 
        if rc = 0 then  do                                                      
          do iy = 1  to edg@dsn.0                                               
            vol = e...@vol.iy                                                   
 
            vol_seq.vol = iy                                                    
            vol_cnt.vol =edg@dsn.0                                              
         /* queue dsn_name.ix vol vol_seq.vol vol_cnt.vol */                    
            queue vol!!format(vol_seq.vol,3)!!format(vol_cnt.vol,3)             
          end                                                                   
        end                                                                     
        else do                                                                 
          if debug = 1 then do                                                  
            say "edg@rc=" edg@rc                                                
            say "rc=" rc                                                        
          end                                                                   
        end                                                                     
      end                                                                       
    end/*ix*/                                                                   
                                                                                
/*  do  ix =1  to vol_name.0  */                                                
/*   vol = vol_name.ix */                                                       
/*   say   dsn_name.ix vol_name.ix vol_seq.vol vol_cnt.vol */                   
/*  end */                                                                      
if Run_under_mvs = 1 then                                                       
  "EXECIO * DISKW OUTPUT(FINIS"                                                 
else                                                                            
  do queued()                                                                   
    parse pull line                                                             
    dummy = lineout('output.txt',line)                                          
  end /*do */                                                                   
end/*if*/                                                                       
else                                                                            
  do                                                                            
    drop sysauth.edgdate            /* An error has occured.  Tell    */        
                                    /* the RMM TSO command to return  */        
                                    /* output via messages.           */        
                                    /* Get error information from     */        
                                    /* RMM.                           */        
    address "TSO" "RMM SD D("dsn") OWNER(*) SEQ(*) LIMIT(*) ",                  
    "STATUS(PRIVATE)"                                                           
  end                                                                           
junk = prompt(save_prompt)          /* Restore PROMPT status.         */        
exit(0)                             /* return to caller               */        

Regards
Victor

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to