Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


FTP from PC to get VB dataset

Posted on 2011-02-16
Medium Priority
Last Modified: 2014-04-30
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.


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


I want the downloaded file to be an exact replica of the dataset with each record on its own line. Thanks.
Question by:marknewprog
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
LVL 16

Expert Comment

ID: 34913432
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 "" /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"

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

Expert Comment

ID: 34916819
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.

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
LVL 16

Expert Comment

ID: 34916898
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.
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!


Expert Comment

ID: 34917051
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.
LVL 57

Expert Comment

ID: 34922898
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.
LVL 57

Accepted Solution

giltjr earned 1000 total points
ID: 34922927
Just tested and the quote site trailingblanks will pad to the end of the full possible record length, 1008 bytes in your case.
LVL 14

Expert Comment

ID: 40031498
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question