Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing FTP mainframe Datasets into MS Access

Status
Not open for further replies.

Tript99

Programmer
Dec 4, 2001
13
US
Hello,
I wrote a small Perl job to FTP datasets from the mainframe and save them on the user's C drive as a text file. I was then going to have a process to load the text files into an MS Access 97 database. When I go to import the text files it does not recognize the end of line character and it tries to import the text file as one continuous record. Does anyone know why or how I can format the downloaded file so it can be imported into access? Here is my code:


$Class = <I1Detail>;
chomp $Class;
$Class =~ s/^\s+//; #Removes Leading spaces
$Class =~ s/\s+$//; #Removes Trailing spaces

$Class_Local = $DownloadPath . &quot;Classes11.txt&quot;;
$Class = &quot;'&quot; . $Class . &quot;'&quot;;
close(I1Detail);


$ftp->get($Class, $Class_Local)
or die &quot;Get failed\n&quot;;
print &quot;FTP of Class file to local drive successfull...\n&quot;;


$ftp->quit;


Any help would be greatly appreciated.
Thanks!
Tript99.

 
Sounds like the old CRLF gotcha. You don't say which library your ftp comes from but I suspect that you need a way to set the transfer mode to ASCII rather than binary so that your record seperators get translated properly. It's probably as simple as
[tt]$ftp->ascii();[/tt]
or
[tt]$ftp->mode('ascii');[/tt]


HTH,

yours,


fish


&quot;As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.&quot;
--Maurice Wilkes
 
It's been years since I worked with any Mainframe stuff but as I recall, Mainframes used EBCDIC rather than ASCII and the carriage returns wher different animals. You may have to get an &quot;interpreter&quot; to do this. I used Monarch but like I said, that was a long time ago.

There's always a better way...
 

If its the case that EBCDIC is the problem

search.cpan.org -> use Convert::EBCDIC;

HTH
--Paul


It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top