Discussion Locked

Reading fileFTPd from mainframe using VB

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am trying to read a file that has been FTPd from an IBM mainframe to my PC. The file on the mainframe has some text and some "packed" data. When this file is FTPd and converted from EBCDIC to ASCII, about 6 bytes of this "packed" data throughout the file are coverted to the ASCII equivalent code for the EOF (end of file). Therefore, when I try to read this file using VB, I prematurely encounter end of file due to these characters that have been converted. Is there anyway that I can read past these quasi end of file markers and reach the real end of file using VB.

9 replies

by mark_t

Can you send on a sample file and the few lines of code you're using to open/read in the lines.

I'll have a go if you'd like.

by rrv

There are 2 options. If you ftp from mainframe you'll have option to convert to ASCII. Easy is to use ftpgetfile API from VB and use ASCII as format parameter and get the file from mainframe to your PC and after than use filesystem object in VB to read the file line by line or character by charater.

RV

by mwest

I tried this also. However, each record has binary and non-binary data. I could not get this to work.

by david.kolb

I have encountered the same problem before where accented names translated fromEBCDIC to an EOF mark. I assume that you are using the standard file open with input or line input. I got around the problem by using a binary read to read the text files. If the records are fixed length it is no problem but if they are variable length you will need to read the entire file into a string variable and then use the Instr function to locate the CRLF characters, if you need to navigate and extract information from the file.

by mwest

This seemed to point me in the right direction. The records are not fixed length, so the comment about reading the entire file into a string variable and parse it helped.

This discussion is closed to new replies.