BookmarkSubscribeRSS Feed
puntigama
Fluorite | Level 6

Hi all,

finally I got it to sign to this community and a first question already came up:

I'm trying to transfer a file from SAS 9.3 on Windows via psftp to a Unix-Server.

I've written a dos-bat file "execute_cmd.bat" which contains the following ftp-commands:

cd /cid/test_folder

put d:\test\test.dat

quit

When I type in the dos-prompt the following line everything works fine and the file is transferred to the Unix server:

psftp av2 -batch -b d:\test\execute_cmd.bat  ("av2" is a stored putty session for connection to the unix server).

When I try to execute this line of code within SAS Enterprise Guide (X commands are enabled):

X "psftp av2 -batch -b d:\test\execute_cmd.bat";

The Program ends fine, without error, but there is no file transferred to the Unix Server.

If I try to execute another .bat file e.g.: "doit.bat" wiht X "d:\test\doit.bat"  which contains the following (non ftp) commands it works.

d:

cd d:\test

dir > testit.txt

Does anybody have a glue why my transfer isn''t working? I've already searched in google and read lots of related documents but unfortunately without success.

Thanks a lot for your help and kind regards,

Arnold

9 REPLIES 9
Tom
Super User Tom
Super User

No idea about psftp, but if you use a PIPE in SAS then you can read the messages that the program might spit out.

filename getfiles pipe "psftp av2 -batch -b d:\test\execute_cmd.bat";

data _null_;

  infile getfiles;

input;

list;

run;

Peter_C
Rhodochrosite | Level 12

the account which executes your SAS programs on the EG server might have different privileges (like psftp and putty and ... )

art297
Opal | Level 21

I'm confused by what you are saying you are trying to submit.  Your command looks like it is trying to run the ftp program and having that program call the batch program.

If your batch program is already calling the ftp program, shouldn't you just be submitting the batch program?  And, like Tom suggested, you might want to run the program via a pipe but, again, I think you simply want to run the batch program.

Tom
Super User Tom
Super User

The program he listed is a series of FTP command, not DOS commands.  He should give it a different extension because the .BAT extension might confuse Windows into think that it is an actual batch of DOS commands.

puntigama
Fluorite | Level 6

Thanks for the numerous answers.

It seems that it doesn't matter which ending the file containing the FTP commands has.

@Tom: The glue with the pipe is great. Now, I get the follwoing message into the Log:

<log-output>

Stderr output:

The server's host key is not cached in the registry. You

have no guarantee that the server is the computer you

think it is.

The server's rsa2 key fingerprint is:

ssh-rsa 1024 39:95:d4:82:cf:25:8f:92:9a:92:6a:23:4f:89:47:4f

Connection abandoned.

</log-output>

Now, I think I got the solution. I was logged in EG with a different user than the user logged on to the server, because the users usually are not allowed to log-on to the Win-Server. I have a SASADMIN windows user and was logged in Windows with this user. So the keys in the registry are stored under HKEY_CURRENT_USER. But when I use a different user in EG to execute the program the keys are not available to this user.

Any idea how to deal with this issue?

Thanks again for your support!

puntigama
Fluorite | Level 6

Any suggestions anybody?

Workaround could be to create a user profile for each user on the win-server and configure putty there. so the sessions are strored in the registry for each user and they can use the psftp transfer?

What do you think about this?

puntigama
Fluorite | Level 6

Does anybody have a auggestion how to deal with this?

Don't you use sftp transfers out of SAS EG for your personalized users or do they work with a common user for which the servers fingerprint is already stored?

Thanks for your collaboration!

Tom
Super User Tom
Super User

Did you try using the FTP filename engine to just let SAS ftp the file for you?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 9 replies
  • 4168 views
  • 4 likes
  • 5 in conversation