SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

DI Studio: Get External File last modified date

Reply
Contributor dkb
Contributor
Posts: 54

DI Studio: Get External File last modified date

Hello Community,

Environment: DI Studio 4.8, on a Unix platform

 

I'd like to create a user defined transform, or piece of user code, that checks the last modified date of an external file (so I can decide whether it should be reloaded). This is going to be used for multiple external files, so it needs to be generalised and neatly packaged, not a one-off bit of hardcoding.

 

If I have a physical file name, I can use FINFO to get what I need. 

 

But an external file can't be connected to the input of a user defined transform, and while it can be connected to the input of a user defined code transform, its name and physical location aren't then made available in macro variables to the code within. 

 

Any suggestions as to how I might get hold of the file name, or another approach to getting the last mod date?

 

Thanks,

Dave

Super User
Posts: 5,852

Re: DI Studio: Get External File last modified date

Hi,

usually, for this kind of logic, I think it better belongs to your scheduling tool. Most of them have file events that can trigger jobs depening on things like arrival.

 

That said, I also recognize the (weird?) fact that the User Written Transformation doesn't accept External Files.

Using Pre-code to the File RFeade is to little avail since almos no useful macros are defined here, especially not the file name.

 

Allthough, the User Written Code might work. For some reason, you get a lot of automatic macros here. So one way to wrap it up is to write a mcaro that you stored in a SASAUTOS location (typically configdir/SASApp/SASEnvironment/SASMAcro.

Then you need to instruct your users to simply add a call to that macro in the User Written Code Transformatino that is linked to the External File Object.

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 138 views
  • 0 likes
  • 2 in conversation