BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PAzevedo
Fluorite | Level 6

Hi There,

I'm trying to read some files stored in a Mainframe from a HP-UX server using filename ftp.

The code i'm using is the following:

filename ftpcom "/home/saswsp/ftpcmd";

data _null_;
file ftpcom;
put "user XXXXXX YYYYYYYY";
put 'prom no';
put 'bin';
put "ls LOG*";
stop;
run;

filename doftp pipe "ftp -n 172.20.1.5 < /home/saswsp/ftpcmd";

data a;
infile doftp;
input;
input=_infile_;
if index(input,'LOG');
file=substr(input,index(input,'LOG'));
call symput ('ficheiro',compress(file));
run;

filename test1 ftp "'U36497.&ficheiro'" HOST='172.20.1.5' USER='XXXXXX' pass='YYYYYYYY' s370v RCMD='site rdw';

data _null_;

  call execute ('data a;infile TEST1;');
  call execute ('input @1 log_data_criacao $ebcdic26.
         @27 log_ambiente $ebcdic8.
         @35 log_tabela $ebcdic18.
         @53 log_chave_registo $ebcdic12.
       @65 log_tipo_instrucao $ebcdic2.');
  call execute (';run;');
run;

For some reason i can't yet understand i can't read any records and i get a note where it seems that the file is unavailable for read.

NOTE: 220-FTPD1 IBM FTP CS V1R11 at MG1D, 18:51:29 on 2012-03-23.

NOTE: User U36497 has connected to FTP server on Host .

NOTE: The infile TEST1 is:

Filename='U36497.LOGM.D120322.T104320.LLOG.DATA',

Pathname= "'U36497.'" is working directory,

Local Host Name=huxsasddsd1,

Local Host IP addr=10.203.22.12,

Service Hostname Name=N/A,

Service IP addr=172.20.1.5,Service Name=FTP,

Service Portno=21,Lrecl=256,Recfm=S370V

3 The SAS System 18:40 Friday, March 23, 2012

NOTE: <<< 450 Data set U36497.LOGM.D120322.T104320.LLOG.DATA is allocated to another job and is unavailable for RETR command.

NOTE: 0 records were read from the infile TEST1.

NOTE: The data set WORK.A has 0 observations and 5 variables.

NOTE: DATA statement used (Total process time):

real time 0.23 seconds

cpu time 0.01 seconds

I've talked to the person who produced this file and she ensured me that the file wasn't being used by anyone. I tried to read other files from the Mainframe and the same problem happens.

Any idea on how to overcome this?

Regards.

1 ACCEPTED SOLUTION

Accepted Solutions
PAzevedo
Fluorite | Level 6

I found a more up-to-date article that as some info on reading from a a tape on a remote server trough filename ftp. There is an indication on an option to be used in the filename statement wich worked for me:

 

RCMD='site rdw READTAPEFORMAT=V'

The link to the article is the following:

www.torsas.ca/attachments/File/03012008/FTP_Fileref.pdf

View solution in original post

8 REPLIES 8
SASKiwi
PROC Star

Suggest trying a manual FTP from the mainframe to the HP-UX server using the Unix FTP command. If it works from the command line then it must be something in your SAS program that is different. If it doesn't work either way then you know your SAS program is not to blame.

PAzevedo
Fluorite | Level 6

The ftp made from the command line works, although there is a behaviour that might explain the problem i'm facing.

It gives the following log message:

125-Waiting for allocation of tape data set U36497.LOGM.D120322.T104320.LLOG.DATA

125 Sending data set U36497.LOGM.D120322.T104320.LLOG.DATA

250 Transfer completed successfully.

100732780 bytes received in 3.76 seconds (26176.25 Kbytes/s)

I accessed the file through a TSO interface and found that the file is in a tape that is mounted every time it is accessed.

When i run the SAS program for the first time it stalls for a few seconds and then gives an error without any information:

"An error occurred executing the workspace job "Program". The server is disconnected."

It's after this first error that the error i posted before, about the file being allocated to another job, starts happening. If after the SAS error happens, i try to do the ftp trough the command line, i receive the same message that the file is allocated to another job.

My impression is that altough the first sas call gives an error, the tape mounting starts and any call made after it will be rejected until the mounting is done, from SAS or ftp or even TSO.

So, i believe the problem here might be about the file being in a tape but i'm still not sure.

Any idea if it's possible to access mainframe files stored in tape trough filename ftp?

PAzevedo
Fluorite | Level 6

I found information in the following article, regarding to reading data from mainframe tapes trough filename ftp, and it states that it cannot be done.

http://www.google.com.br/url?q=http://www.bassettconsulting.com/PhilaSUG_Read_Alt_Srcs.pdf&sa=U&ei=M...

I'm not sure on how old the article is so there might have been improvements afterwards.

Any ideas?

Thks in advance.

SASKiwi
PROC Star

A quick solution might be to do a manual FTP in a shell script. That will pull the file over from the mainframe and then your SAS program can just read the text file as if it were a local file.

The other possibility might be to execute a remote command only via FILENAME FTP and the RCMD option (you don't specify a file name in quotes to do this) to get the tape mounted first (don't know what the command would be though), then in a second FILENAME to try to transfer the file.

PAzevedo
Fluorite | Level 6

The first solution is what we have nowadays and what we are trying to eliminate.

Since the character encoding is different between systems (EBCDIC to ASCII) there is the need to clean all those characters that are meaningless in EBCDIC but gives us a bunch of problems when in ASCII (e.g. End of line character). This convertion is currently being made in the Mainframe spending the so precious IBM MIPS, before the file is converted to ASCII when transfered to the HP-UX SAS servers trough the FTP.

The second possibity, i've read something about it in my researches about this subject but it all seemed so complicated that i left it to last. I believe that the command you mentioned for tape mounting exists, what i'm not sure is if it will solve my problem, or even if the tape mounting is the real problem. The article i quoted just states that reading trough filename ftp from tapes is not possible, but doesn't refer if it is due to the tape mounting or something else.

From what i could realize from filename tutorial, there are a lot of specific options when reading with a TAPE as device-type. Since those options can't be combined with FTP device-type i've got a feeling that the problem might be there.

We are currently waiting for the file to be moved to a disk drive in order to test if it solves the problem.

Any developments on the original problem, even if it is just to confirm that it really is impossible to read from tapes with filename ftp, are very well welcome.

Regards.

PAzevedo
Fluorite | Level 6

I found a more up-to-date article that as some info on reading from a a tape on a remote server trough filename ftp. There is an indication on an option to be used in the filename statement wich worked for me:

 

RCMD='site rdw READTAPEFORMAT=V'

The link to the article is the following:

www.torsas.ca/attachments/File/03012008/FTP_Fileref.pdf

SASKiwi
PROC Star

Very useful reference and pleased you found a solution AND you have posted it for others to find.

Unfortunately I was unable to check anything more out for you because I don't currently have access to a mainframe.

Bobstaggert
Calcite | Level 5

I don't bother with these line commands. I've been using XCenter for years: http://www.hyunsystems.com/products . It takes care of all the SITE commands and translation.

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
  • 8 replies
  • 6054 views
  • 3 likes
  • 3 in conversation