BookmarkSubscribeRSS Feed
ColleenCB
Fluorite | Level 6

Hi everyone,

 

Once again we are changing systems from SAS Base 9.4 to Unix Enterprise Guide 7.15 and using SAS Manangement console to run the schedules.

We got PKZIP25 working on Base, but I seem to have an issue with it on EG.

 

This is what the Code looks like and the resulting Log:

916 data _null_ ;

917 zipexe = '"/data/fnb/hr_intelligence/Scripts Programs/REQUIRED_PROGRAMS/PKZIP25.EXE" -min -a -s';
918 pw="&pwdit";
919 zipfile="/data/fnb/hr_intelligence/OutPut_Data/ZIPs_Monthly/BISM060_&MON1_
919 ! MONYY7..zip";
920 files="&MnlyOut./BISM060_&MON1_MONYY7..xlsx";
921 cmd=zipexe || pw || ' ' || zipfile || ' ' || files ;
922 putlog "NOTE-Processing command " cmd ;
923 call system( cmd ) ;
924 run;

Processing command
"/data/fnb/hr_intelligence/Scripts Programs/REQUIRED_PROGRAMS/PKZIP25.EXE" -min -a -sPSWd /data/fnb/hr_intelligence/OutPut_Data/ZIPs_Monthly/BISM060_JUL2019.zip /data/fnb/hr_intelligence/OutPut_Data/Monthly/BISM060_JUL2019.xlsx
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.00 seconds

 

It seems to run but I cannot find the Zip file in the directory as specified.

Those with the knowledge of the insides 🙂 , did this actually process correctly or what went wrong?

Should I be using something else to zip with?

Thank you for sharing your knowledge.

Have a great day

4 REPLIES 4
SimonDawson
SAS Employee
PKZIP25.EXE is file with instructions for a computer running Windows. That will only run on a Windows host. If you are on UNIX you will need to use a program specifically for the operating system you are running. If you are on Linux you'd likely use the zip program that your Linux system administrators deploy. You can read the zip manual page for Linux here https://linux.die.net/man/1/zip
Kurt_Bremser
Super User

And use the filename pipe method to run your external command:

filename oscmd pipe "put your whole command here 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

so you can see all responses (normal and error) in the SAS log.

ColleenCB
Fluorite | Level 6

So my problem did not get solved with the pipe method...

 

I was given the following:

data _null_;
%let file1 = /data/fnb/hr_intelligence/OutPut_Data/Weekly/Position_Rpt2_&DAY0_DATE9..xlsx; /* Assign macro variable, this is a path and your excel file name*/
%let passwd = MY_SECRET; /* Assign macro variable password to protect your file.*/
%let zippedFile = /data/fnb/hr_intelligence/OutPut_Data/ZIPs_Weekly/Position_Rpt2_&DAY0_DATE9..zip; /* creating a zipped folder.*/
x 'cd /data/fnb/hr_intelligence/OutPut_Data/Weekly/';/* change to the directory where you saved the files*/
x "zip --password &passwd &zippedFile &file1"; /* pass all macro variable created to zip and protect the file*/
x 'pwd';
run;

 

This worked once. Made the zipped file and put it in the correct zip folder the works.

When running it a day or so later it does not work. The report log is as follows:

917 data _null_;
918 %let file1 = /data/fnb/hr_intelligence/OutPut_Data/Weekly/Position_Rpt2_&DAY0_DATE9..xlsx; /* Assign macro
918 ! variable, this is a path and your excel file name*/
919 %let passwd = MY_SECRET; /* Assign macro variable password to protect your file.*/
920 %let zippedFile = /data/fnb/hr_intelligence/OutPut_Data/ZIPs_Weekly/Position_Rpt2_&DAY0_DATE9..zip; /* creating a zipped
920 ! folder.*/
921 x 'cd /data/fnb/hr_intelligence/OutPut_Data/Weekly/'
921 ! ;/* change to the directory where you saved the files*/
922 x "zip --password &passwd &zippedFile &file1"
922 ! ; /* pass all macro variable created to zip and protect the file*/
NOTE: Current working directory is '/data/fnb/hr_intelligence/OutPut_Data/Weekly'.
923 x 'pwd'
923 ! ;
924 run;

NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 

There is nothing created in the Zip drive!!!

Why would it work 1 day and not the next?

Kurt_Bremser
Super User

The filename pipe method won't make your code work in some magical way, but it grabs all responses from the command and puts it into the SAS log. X does not do that. Right now, you have no clue at all what went wrong, and there's nothing in the log (as you can see) to help us to help you.

Using the pipe method will supply the necessary diagnostic information.

So please run

filename oscmd pipe "zip --password &passwd &zippedFile &file1 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

and then post the log here, using the {i} button.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2105 views
  • 0 likes
  • 3 in conversation