Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am trying to convert an IBM mainframe file that was ftp'ed to a Unix server to an ASCII file. File on the IBM is EBCDIC, VB, LRECL=9996, BLKSIZE=10000. A binary transfer is used to ftp the file to Unix. Have tried using the Unix dd statement to do the conversion but the output file is not coming out split correctly. I am not sure if the problem is with the blocking on the Unix server after the ftp. Is there a way of telling what the block size is of the Unix file? Anyone have any ideas on what to try. All input would be greatly appreciated.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,183
Rep:
Is it coming out garbage? Or is is some pattern you can recognize? If you had packed decimals, it could come out garbage. You would need to convert that on the IBM side before bringing it over.
I might be missing something, but I don't know what 'dd' does in the middle of the picture. dd copies raw bytes from one place to another, it doesn't understand encoding systems or whatever.
If you used ftp in binary mode, you should have exactly the same file on both places. You can always use some checksum tool or something to make sure that the original file and the one in the unix machine is the same. If they don't match, then the problem is in the transfer, so you will need to sort that out first.
Assuming it is, you just need a tool to convert ebcdic to ascii. I know there are tools to do this, and there are also perl modules for the same purpose. I haven't experience with them though so I can't give any concrete advice.
You *really* don't want to be directly ftp'ing VB files like that. It won't work. Period.
Best might be to ocopy to a [zh]fs on USS on the mainframe first.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,183
Rep:
Quote:
Originally Posted by i92guboj
I might be missing something, but I don't know what 'dd' does in the middle of the picture. dd copies raw bytes from one place to another, it doesn't understand encoding systems or whatever.
yup. you're missing something.
If you do a man on dd, you'll see "dd - convert and copy a file." It will convert ascii to ebcdic and vice versa. It will pad new line terminated records to fixed length records. It will change case. It will swap the order of byte pairs. And you can provide custom conversion tables. One of the longer running threads (with 556 posts over the last 4 years) here on linuxquestions is Learn the dd command.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,183
Rep:
I found this extremely interesting tech support article that describes what happens when you use ftp to transport a file from a mainframe to a unix system or PC -- http://support.sas.com/techsup/technote/ts642.html. Scroll down to "Moving data between platforms." Following that are some fairly detailed descriptions of possible solutions. Cool stuff.
The benefit of using ocopy is that it uses the mainframe environment (and known code pages) to create a Unix file in ASCII prior to ftp. Removes a lot of potential problem points. IEBGENER will create an EBCDIC (non *nix) file that still needs converting (by default).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.