Page 1 of 1

How Can I take as an Input last file created by the Schedule

PostPosted: Tue Jan 07, 2020 11:04 pm
by danielgp89
Hello Everyone!

There are some files in our environment that are created automatically each day by some REXX utility, these files are not GDG some of they are created by a variable (D&LYYMMDD) that puts the date at the end of the name of the file.

The files are created like this

SMF.LPAR.RACF.D200101
SMF.LPAR.RACF.D200102
SMF.LPAR.RACF.D200103
SMF.LPAR.RACF.D200104
SMF.LPAR.RACF.D200105
SMF.LPAR.RACF.D200106

This files always are created with the same 4 hlq (SMF.LPAR.RACF.DXXXXXX) the only thing that it chage are the numbers of the date

I'm creating a job that creates a report of RACF activity, but my inputs are those files. I want to schedule this job taking the last of those inputs.

Is there any way that I can do this? I'm guessing that I need to use some REXX program to do this.

Regards!!

Re: How Can I take as an Input last file created by the Sche

PostPosted: Tue Jan 07, 2020 11:55 pm
by sergeyken
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ADDRESS TSO                                        
x = OutTrap('Lines.')                              
"LISTC ENTRIES( 'SMF.LPAR.RACF.*' )"                
x = OutTrap('OFF')                                
                                                   
MaxName = ''                                      
Do i = 1 To Lines.0                                
   If 0 < Pos( ' ------- ', Lines.i ) Then Do      
      NewName = Word( Lines.i, 3 )                
      If MaxName < NewName Then                      
         MaxName = NewName                            
   End                                            
End i                                              
                                                   
Say "MaxName="MaxName                              
                                                   
/* Do whatever you want with this MaxName */      
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                  
 

Re: How Can I take as an Input last file created by the Sche

PostPosted: Wed Jan 08, 2020 8:33 pm
by sergeyken
Another way may be using PARSE statement in REXX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ADDRESS TSO                                        
x = OutTrap('Lines.')                              
"LISTC ENTRIES( 'SMF.LPAR.RACF.*' )"                
x = OutTrap('OFF')                                
                                                   
MaxName = ''                                      
Do i = 1 To Lines.0                                
   Parse Var Lines.i . Separator NewName .   /* extract words 2 and 3 from output line */
   If 0 = Verify( Separator, '-' ) Then Do /* only when the second word includes nothing but '-' */      
      If MaxName < NewName Then                      
         MaxName = NewName                            
   End                                            
End i                                              
                                                   
Say "MaxName="MaxName                              
                                                   
/* Do whatever you want with this MaxName */      
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                  
 

Re: How Can I take as an Input last file created by the Sche

PostPosted: Fri Jan 10, 2020 2:32 pm
by Blackthorn
What scheduler do you use? Date variables can certainly be substituted by TWS, and most likely all others as well.