Indoubt88
45 pts. | Jan 7 2009 2:03AM GMT
I don’t believe the answer from Wiki will do what you are looking for. There is a parameter in the system stettings for FTP on the mainframe that control whether the data wraps to a new line or follows the value of the TRUNCATE FTP setting:
WRAPRECORD FALSE ; (S) Specify what to do if no new-line
; is encountered before reaching
; the MVS data set record length
; limit as defined by LRECL when
; transferring data to MVS.
; TRUE = Wrap data to new record
; FALSE (D) = Defer to the TRUNCATE
; setting to determine if the
; record is truncated or the file
; transfer fails
If the above FTP system parameter is changed to TRUE instead of FALSE, the data will wrap at the record length of the receiving file. This will only work out right if all of the ‘records’ on the distributed end are the same length as the file length of the mainframe file. There will also be more work to do on the file once transferred if there are any extra characters inserted by the distributed end after the end of each ‘line’ of data (I am not that familiar with UNIX so I do know for sure how it differentiates lines). If characters are added you may have to increase the record length so they all fall at the end of the file and then deal with them on the mainframe (ignore them if you control the program reading the file or strip them off with another program to get to the originally desired file length before processing it with the current program).
If you are initiating the transfer from the mainframe in a batch job, you can over-ride the system defaults setup for your system for this one job by coding (or over-riding) the SYSFTPD DD statement to point to a copy of your FTP parms with just the WRAPRECORD value changed. If you don’t know where to find the parameters being used on your system or how to add/over-ride the DD statement, discuss this with the person supporting FTP on your mainframe.
As a side note, I would not run with the default for TRUNCATE set to TRUE like the system you are using appears to be because I would rather the FTP fail than succeed with partial data but that is more of a preference as both have advantages.
HTH,
Greg
Petkoa
1235 pts. | Jan 7 2009 4:59PM GMT
Well, if it’s possible to open the file in the textpad and save it in PC format without damaging it, why don’t you do the same on the unix machine? GNU nano can save files in unix, pc, mac formats. You can accomplish this with sed :
sed -i.bak ’s/$/^M/’ test.txt
This command will work “in-place”, creating a backup file test.txt.bak ( -i.bak ) and put before the unix end-of-line LF ($) a CR character ( ^M = ctrl-M = CR ). To put ^M in the command line you’ll have to use escaped-input-sequence ( ctrl-V in bash, csh, tcsh, so if you use another one, start a subshell - any unix will have csh).
Hope this helps,
BR,
Petko






