BookmarkSubscribeRSS Feed
saroj
Calcite | Level 5

Hello All,

I am trying to ftp a file to a remote location using filename FTP method.

the below is the code snippet i am using

DATA FTPDATA;                                    

                                                 

INFILE INPUTFL;                                 

INPUT @001 FULLREC $255.;                       

                                                 

FILENAME CREATE FTP "&FTP_FILE_NAME"             

         CD=&PATH                                

         HOST=&HOST                              

         USER="&USERID" PASS="&PWD" RECFM=V DEBUG

         LRECL=&RECLTH;                          

RUN;                                             

DATA _NULL_;                                     

SET FTPDATA;                                    

FILE CREATE;                                    

PUT @001 FULLREC $255.;                         

RUN;                                             

I am able to use this program to ftp the file to the same location in my test ZOS region. SAS 9.2 runs here.

NOTE: 220 jdshare FTP server (NetApp Release 7.3.5.1P3: Tue Apr 26 21:51:53 PDT

NOTE: <<< 220 jdshare FTP server (NetApp Release 7.3.5.1P3: Tue Apr 26 21:51:53

NOTE: >>> USER ADYPSTT                                                         

NOTE: <<< 331 Password required for ADYPSTT.                                   

NOTE: >>> PASS XXXXXXXX                                                        

NOTE: <<< 230 User ADYPSTT logged in.                                          

NOTE: >>> PORT 192,43,81,1,213,16                                              

NOTE: <<< 200 PORT command successful.                                         

NOTE: >>> TYPE A                                                               

NOTE: <<< 200 Type set to A.                                                   

NOTE: >>> CWD /vol/vol7/DY028PR_STOCKHOLM                                      

NOTE: <<< 250 CWD command successful.                                          

NOTE: >>> PWD                                                                  

NOTE: <<< 257 "/vol/vol7/DY028PR_STOCKHOLM" is current directory.              

NOTE: >>> STOR GB.UPDATE-2011-08-13                                            

NOTE: <<< 150 ASCII data connection for GB.UPDATE-2011-08-13 (192.43.81.1|54544)

But i am getting error if i run this program in production region which runs SAS 9.1.3 service pack 4.

48         DATA _NULL_;                                            

49          SET FTPDATA;                                           

50          FILE CREATE;                                           

51          PUT @001 FULLREC $255.;                                

52         RUN;                                                    

                                                                   

ERROR: Open failed for file CREATE                                 

ERROR: Open failed for file CREATE                                 

ERROR: Open failed for file CREATE                                 

ERROR: Hostname jdshare.jdnet.xxxx.com not found.                 

ERROR: Hostname jdshare.jdnet.xxxx.com not found.                 

ERROR: Hostname jdshare.jdnet.xxxx.com not found.                 

NOTE: The SAS System stopped processing this step because of errors.

NOTE: The DATA statement used 0.04 CPU seconds and 15960K.    

Can anybody help me with this ??    

3 REPLIES 3
DF
Fluorite | Level 6 DF
Fluorite | Level 6

I would try logging into the FTP manually from the 9.1.3 box (e.g. using Putty or something).

The error messages seem to suggest that the server cannot find or connect to the FTP server.  If 9.1.3 is installed on a seperate box, for example, it might have different firewall or DNS settings that are preventing the connection from being established.

If you try connection to FTP manually then you'll be able to rule that out, and also try other things like pinging the FTP.

Assuming it doesn't work manually then you'd probably need your server admin to update the settings to allow it.  I have a similar problem here in that our firewall doesn't allow external connections from the SAS box.

saroj
Calcite | Level 5

i am able to login into that ftp folder from that prod region using FTP command in the unix command prompt. is there a firewall in mainframe region ? never heard of it.

MikeZdeb
Rhodochrosite | Level 12

Hi ... not an  FTP answer, but just curious as to why you create the intermediate data set FTPDATA. 

Can't you just read/write within the same data step.  I assume that the variable name FULLREC means

read/write the entire record ...

filename create ftp "&ftp_file_name"

         cd=&path

         host=&host

         user="&userid" pass="&pwd" recfm=v debug

         lrecl=&reclth;

data _null_

infile inputfl;

input;

file create;

put _infile_;

run;       

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1611 views
  • 1 like
  • 3 in conversation