Question: In my web application, I have files on unix in specific formats each being variable length. I want to ftp those files to a mainframe. Could you tell me an elegant way to do this. I get broken pipe error messages while ftping to the mainframe using command ftp from unix. The final goal of this is that all of the files from unix should be appended to one dataset on the mainframe having a fixed length of 2000 columns.
Answer: The way that I would tackle this problem is to first create the dataset on the mainframe with fixed length records 2000 bytes long and large enough to hold all of the data that is likely to be sent to it. Doing this directly on the mainframe avoids any complications with trying to create the it using ftp which is probably the point where you are having the problem. If you don't have access to do this yourself then there is almost certainly someone available who will be able to do this for you.
You should then be able to use the ftp append command to add each of the unix files onto the end of the already existing mainframe dataset. If you first set the type to ascii mode then the ftp should take care of blank (or low value) filling the records out to the 2000 record length and you should get the desired result.
The only other point where you might have problems is if you ever have a record which (excluding the trailing linefeed record separator) is over 2000 bytes long. If you ever expect this to occur then you might want to define the mainframe dataset with a longer fixed record length. Alternatively you might consider defining the mainframe dataset with a variable record length instead which if the record lengths vary significantly will reduce the space required to hold the same data.
This article written by Stephen Chapman, Felgall Pty Ltd.