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



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

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

Postby danielgp89 » Tue Jan 07, 2020 11:04 pm

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!!
danielgp89
 
Posts: 18
Joined: Fri Feb 15, 2019 5:41 am
Has thanked: 8 times
Been thanked: 0 time

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

Postby sergeyken » Tue Jan 07, 2020 11:55 pm

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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 */      
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                  
 
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 437
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

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

Postby sergeyken » Wed Jan 08, 2020 8:33 pm

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 */      
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                  
 
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 437
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

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

Postby Blackthorn » Fri Jan 10, 2020 2:32 pm

What scheduler do you use? Date variables can certainly be substituted by TWS, and most likely all others as well.
Blackthorn
 
Posts: 130
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 1 time
Been thanked: 9 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post