Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to know the sample code for FTP TYPE command

Status
Not open for further replies.

dearjay

Programmer
Dec 19, 2007
35
IN
Hi There,

I am putting file from Mainframe to Unix. I want to carry the same data format on unix server. Kindly provide me the TYPE subcommand sample code, so that i can achive the same,
I am using following control card on mainframe but getting error. please suggest.
IP ADDRESS
Userid
Password
CD /directory
DIR
TYPE E
PUT //DD:DDFIL file1
QUIT

Regards,
Nits

 
Assume type E is ebcdic?

Type would be "binary" and then use some unix tool to translate.

eugene
 
Dear Eugene,

Yes assume type is EBCDIC. so you mean it will not possible to transfer the file in EBCDIC format to unix server?

Please suggest,
Nits
 
Yes, it will be possible if you transfer it in binary mode, but if you want to actually read and/or process the data on the Unix server you may need to convert it (using a tool such as dd perhaps) to ASCII.

Annihilannic.
 
Dear Annihilannic,

I am doing FTP for the VB file from mainframe to UNIX. But there are 4 dots .... are appearing at the end of the trailer of the file. I don' know why. Is that because of having Mainframe file format as variable length?

please suggest,
Regards,
nits
 
Sorry, I have no experience of IBM mainframes, so I'm not sure. It's possible that it uses some kind of record based file-format, and those dots are some kind of record terminator.

I think TYPE I is equivalent to binary, perhaps you should try that?

Annihilannic.
 
How TYPE I is going to help me? can you please elaborate your view ? ( will that remove the terminator dots?)

Regards
Nits
 
I really don't know, but worth a try I guess to see if the file arrives in a different format.

Annihilannic.
 
So that is the only error? (after binary and dd)

dd can do blocking, but . isn't one of the pad characters. (I believe it can do NUL, space).
 
During Putting files, spaces ares till appearing at the end. How can we remove that? can somebody please suggest?

regards,
Nits
 
So this is formatted? Is only the last record short?

So the last record unpadded, options in dd will pad null.

eugene
 
Dear Eugene,

Thank you very much for your suggestion, but i am just wondering, whether mainframe FTP supports the dd command.... can you please give me some example... so that i can try..

Thanks and Regards,
Nits
 
Dear Eugune,

Let me explain my problem to you. I have a Variable record length file (VB=1000) on mainframe. So if i have total records in the file is upto 500 characters, then remaining 500 is nothing. In that case, if i send this file to UNIX solaris (by using FTP), the remaining 500 characters spaces are also getting created on UNIX txt file. According to my requirement, I don't want any single space after trailer.

Please let me know if you have any suggestion on this problem.

Thanks and Regards,
Nits
 
In that case, provided the data itself is plain text, I think you should transfer the file in ASCII mode. I know that used to work when transferring record-based files from Tandem mainframes to Unix, although that didn't involve any kind of character set conversion.

Try one of these commands to change to ascii mode before transferring the file:

[tt]ASCII
TYPE A
QUOTE TYPE A[/tt]

Annihilannic.
 
Dear Anni,

I tried these above mentioned commands, but

1. Spaces will not be removed at the end. and
2. As i have SWIFT messages in file, some ... characters are getting replaced by boxes. So i am not getting exactly the FTPed file in ASCII at the remote server.

Please suggest.

Regards,
Nits
 
I would suggest you change the file on the mainframe, not to be a fixed record length.
Or Ftp it with the trailing blanks, and run a sed script on Unix to remove the spaces.


Tony ... aka chgwhat

When in doubt,,, Power out...
 
If it is variable length, isn't the number of bytes in the record encoded in some field?

Of if you KNOW that trimming spaces on the end is okay, you could write a perl program (about 10 lines) that will trim off the spaces on the end of line.

Boxes sounds like control characters there might be a 1 - 1 translation depending on character set.

eugene
 
He should be using type E, mainframe is EBCDIC, but the dataset has a fixed length or lrecl is not 0, on a mainframe that will turn into spaces. VB=1000 is fixed.

Tony ... aka chgwhat

When in doubt,,, Power out...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top