Trailing spaces chopped off - MF to Unix FTP.

We receive fixed width ASCII (not EBCIDIC) file from MF to UNIX server. We have trailing spaces in the file.

What happens during FTP transmission, those trailing spaces gets chopped off. Is there any option in FTP when to transfer file from mainframes to unix not to chop off those spaces?

transfer as 'binary'.

Porter

Do you mean transfer mode should be used as 'bin'? If we do that, we will receive data in EBCDIC format.

Data file originally on the mainframe is in EBCDIC format during FTP transmission we choose 'ascii' option.

Ok - I am not a mainframe programmer. At least, not IBM.

We had a similar issue at a previous company. Required them to put an X in the last column, to force the spaces to be maintained.

Just a thought.

videsh,

This is based on my experience.

If the Record Format of your file on Mainframe is 'VB' (Variable Block) then during FTP transmission (ascii mode) the trailing spaces will be removed.

If the Record Format of your file on Mainframe is 'FB' (Fixed Block) then during FTP transmission (ascii mode) the trailing spaces of the line will be displayed on unix.

:slight_smile:

Use 'dd' to convert from EBCDIC to ASCII.

Hemang, the transmission team told me they are sending file in Fixed Block format in ascii transmission mode.
Is it possible for you to provide the command from your transmission team please?

awk,
At moment we are using the approach you have suggested as a temporary fix. In the long run we are asked not to use this temporary solution.

You could try using "newform" to restore trailing spaces.

Kahuna,

What this 'newform' stands for?

Is it an option with form?

man newform

NAME
newform - change the format of a text file

SYNOPSIS
newform [-s] [-itabspec] [-otabspec] [-bn] [-en] [-pn] [-an] [-f] [-cchar] [-ln] [filename...]

Thinking about it, this will only work if you have fixed length records. But your posting indicated that VB records were being sent.

Kahuna

This command is applicable to make file in say fixed width upon its arrival. For this I have solution using 'awk'.

awk ' { printf("%-100s\n",$0) } ' fname1 > fname2

I need to know, during transmission from mainframes to Unix, is there anyway we can stop chopping off of trailing spaces.

Is the requirement that the transmission not truncate spaces or that you end up with a file with the right length records? Or are you saying that you have variable length records and so you can't restore the right number of trailing spaces?

If the requirement is for the transmission to not truncate spaces, Porter has already suggested transmitting in Binary and then translating to ascii using dd.

Hemangjani also suggested about FB vs VB. (I'm unfamiliar with this but assume it is a viable appoach)

I was simply suggesting an alternative way to approach the problem. If that failed to meet your requirments, I'm sorry I wasted your time and mine.

See if this helps.
MAINFRAME FORUM: FTP question from Mainframe to PC

We have found solution for this.

If we use 'record' keyword before 'put' in FTP transmission, then record truncation problem is not observed.

Your solution was helpful to me today.

Thanks.