Dear Community,
I am facing the following problem: given a specific folder and zip filename, I need to unzip the file using Data Integration Studio.
In order to achieve this, I have created the following test flow as displayed below.
In the first component I have created a dataset via User Written component with three attributes:
The path of the file in which the zip file is included
The filename along with the path
And the zip file which is basically only the name of the zip file
The code for your convenience is as follows:
DATA PARAMS;
FILEPATH = 'D:\My_Input';
FILENAME = 'D:\My_Input\My_File_V2_20210201.zip';
ZIP = SCAN(FILENAME, 3, '\');
RUN;
DATA &_OUTPUT1;
SET WORK.PARAMS;
RUN;
Then I try to unzip the file via the "X" command as follows:
I create two macro variable and I bind the values of the dataset
I write the output in the console
I perform the unzip command, just as I would normally do via the command prompt
DATA _null_;
set &_INPUT1;
call symputx('pFilepath',strip(Filepath));
call symputx('pZipname',strip(ZIP));
RUN;
%put &pZipname;
%put %sysfunc(length(&pZipname));
x "cd &pFilepath";
x ' "c:\Program Files\7-Zip\7z.exe" x &pZipname ';
What I have noticed is that when I hardcoded the values and execute the flow, the unzip mechanism works.
When I try to execute the same with the macro variables it fails.
For your convenience below you will find the hardcoded script which works.
x "cd D:\My_Input";
x '"c:\Program Files\7-Zip\7z.exe" x My_File_V2_20210201.zip';
Any suggestion, is highly appreciated.
Best Regards,
Vasileios
... View more