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

Adding Multiple Filenames to DI Studio Job.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Adding Multiple Filenames to DI Studio Job.

Hi,

 

I'm having trouble adding the filenames to a DI Studio External File. I have followed this post How to put filename into the data using SAS-DI? and In the Advanced File Parameters i have added

 

filename=_infilename;
length _infilename Filename_Used $255;
Filename_Used=_infilename;

 

But when i run the Transformation it only brings back 8 characters and the following WARNING: Length of character variable _infilename has already been set. Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable.

 

Can anyone help please?

 

Thanks

 


Accepted Solutions
Solution
‎09-19-2017 07:55 AM
Occasional Contributor
Posts: 5

Re: Adding Multiple Filenames to DI Studio Job.

@PatrickOne work around i have found is by ticking Override generated INFILE statement with the following statement in the Advanced file parameters tab you can move the length statement to the correct position and you wont get a warning.

 

di_infilename.png

 

i'm basically reading in the headings of multiple .csv files to make sure a certain column exists before the file is allowed to enter a flow. So if any headers are missing it will put the problem files in a check folder and carry on checking other files instead of failing.

View solution in original post


All Replies
Respected Advisor
Posts: 4,536

Re: Adding Multiple Filenames to DI Studio Job.

[ Edited ]
Posted in reply to illusoryduck

@illusoryduck

I've been the author of the referenced post which had been marked as solution.

 

Looking into this again I conclude that you are right. The length statement comes too late in the sequence of events. 

 

The LENGTH statement would need to come before the INFILE statement in order for things to work. I believe there is no "hack" in DIS which would generate such code. Not sure if a User Written External File would allow for such a LENGTH statement to be ingested in the right place (before the INFILE statement).

 

I've updated the post you've referenced to be clear that this is not the solution.

 

Your subject line says Adding Multiple Filenames to DI Studio Job which is different from the problem my earlier post tried to cover.

Can you explain what you actually want to do. May be there is an easy solution to your actual problem.

Solution
‎09-19-2017 07:55 AM
Occasional Contributor
Posts: 5

Re: Adding Multiple Filenames to DI Studio Job.

@PatrickOne work around i have found is by ticking Override generated INFILE statement with the following statement in the Advanced file parameters tab you can move the length statement to the correct position and you wont get a warning.

 

di_infilename.png

 

i'm basically reading in the headings of multiple .csv files to make sure a certain column exists before the file is allowed to enter a flow. So if any headers are missing it will put the problem files in a check folder and carry on checking other files instead of failing.

Respected Advisor
Posts: 4,536

Re: Adding Multiple Filenames to DI Studio Job.

[ Edited ]
Posted in reply to illusoryduck

@illusoryduck

Sounds like you found the DIS way how to get this done. I believe you can close this track by accepting your own contribution as solution.

 

I've never thought of doing it this way and I believe I would have gone for user writtem code (or a user transformation with a macro and prompt if used in more than one job) prior to actually reading the data via File Reader. 

...but it sounds like you found a clean way for doing things so just "carry on".

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 253 views
  • 2 likes
  • 2 in conversation