Link to home
Start Free TrialLog in
Avatar of marknewprog
marknewprog

asked on

FTP from PC to get VB dataset

I need to download a variable block dataset from the mainframe to my windows PC. I need to download the VB dataset as a text file with each record in a separate line and with the trailing blanks/spaces intact. For example, if the VB dataset has a LRECL of 1008 bytes, I need the downloaded file to have record #1 on t he first line with 1008 bytes, record #2 on the second line with 1008 bytes and so on. For simplicity, lets assume that there are ten records in the VB dataset. Please give me the FTP commands to download the VB dataset maintaining the LRECL as defined(1008 in our case). I'm connecting from a windows PC on the command line to a mainframe computer. I'm new to both FTP and mainframe computers. Thanks.

Example:

VB dataset on Mainframe:  LRECL=1008 and RECFM=VB

RECORD1: ABCDXXXXXXXXXXXXXXXXXXXX BLANKS/SPACES
RECORD2: ATRCDEXXXXXXXXXXXX BLANKS/SPACES

I want the downloaded file to be an exact replica of the dataset with each record on its own line. Thanks.
Avatar of AlexPace
AlexPace
Flag of United States of America image

One problem that happens pulling a text file from an IBM FTP server is that some of them use the EBCDIC character set instead of ASCII.  If this happens the data you downloaded will appear to be corrupt.  Sometimes you get an "almost perfect" translation but there will be a problem with control characters like Line Feed, Tab, or Carriage Return.  Sometimes everything looks good except the "~" tilde character.

Here is an easy way to test.  Download and install the eval version of Robo-FTP client (it supports EBCDIC translation.)  Open the main console window and do this:  (except with your server's address and your real username and password)
FTPLOGON "127.0.0.1" /user="myuserid" /pw="mypassword" /ibm
RCVFILE "FileName" /as "FileName_B" /type="ASCII"
RCVFILE "FileName" /as "FileName_A" /type="BIN"
RCVFILE "FileName" /as "FileName_E" /type="EBCDIC"
FTPLOGOFF

Open in new window

So you are downloading the same file 3 different times using  ASCII, BIN, and EBCDIC modes.  

Actually on those RCVFILE lines you want to change where it says "FileName" to your actual file name except in the part after the /as so each download version gets a different name so you can tell them apart.  

Anyway, now all you have to do is open those 3 versions of the same file and see which one is in the proper format
I have a couple of questions -- you say Mainframe, do you mean AS400 or 390 Series Mainframe. It does make a difference. But since this is in the AS400 queue here I will assume 400.

Why FTP?? Why not use VB to access the 400 directly and pull the data into your set. You can get to it via SQL with ODBC,ADO or directly. It's much much simpler than downloading the data. What version of VB are you using - .NET? There are specific drivers in iSeries Access to use that will allow you to access data directly. Another option would be to use the built in data transfer routine in iSeries access to download to a CSV or Text FIle, or even directly to an Excel file format.  In addition you can use Access to Link a database and access it that way, or you can use Excel and Microsoft Query/ODBC to access it. I have done all of these numerous times.

http://lmgtfy.com/?q=VBA+access+to+IBM+AS+400+Data

Hit this link and let it run. you will find numerous articles about access 400 data via VB ... that would seem a much better way to accomplish what you want to do.

Mike Cody
I think when he wrote VB he was talking about the records stored in Variable Block format on the server instead of Visual Basic.  Please clarify.
I see that now, shows I spend to much time with Visual Basic ... However he should still be able to use numerous tools to access the data, FTP would most likely be my last choice to xfer data like this.. Extracting it via a program would seem best.
Avatar of giltjr
I will have to do some testing, but I'm not sure you can do that.

What you can try is after you logon to the FTP server issue the command:

     quote site trailingblanks

This tells the mainframe to leave the trailing blanks on the end of the record, but I'm not sure if it will fill out variable records to the full possible length with blanks.
ASKER CERTIFIED SOLUTION
Avatar of giltjr
giltjr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.