Inserting CRLF in mainframe FTP program

Tags:
CICS
CRLF
FTP
Intel
Mainframe FTP Program
The following question was posted by another person on Feb. 19, 2007. I am having a problem with FTP'ing a file that does not contain CRLF to the mainframe. Because the source file does not contain a CRLF to signify the end of line, only the data up to the LRECL of the file will be transferred. The remainder of the data is truncated and discarded. I have tried binary and ASCII file transfers without success, and ebcdiic isn't supported. Please let me know if there are other parameters that I might try. I have the same problem with a company FTPing me a file to an Intel machine without CRLF on a regular basis. I have a scheduled mainframe job that FTPs this file from the Intel machine to the mainframe and the resulting file contains only one record. I was told this file was created in Unix. My temporary solution is to manually FTP the file to a desktop, use Textpad to read and save it with file format = 'PC' instead of 'UNIX,' and then FTP it to mainframe manually. Using this method means that I cannot automate the mainframe job. Is there any parameter(s) that I can use to insert CRLF in the mainframe FTP program? Thank you for the help.
ASKED: January 5, 2009  8:05 PM
UPDATED: January 7, 2009  4:59 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you’re FTPing from the host, you can use the “site” subcommand to set the attributes for the file that is to receive the data. The site subcommand allows you to specify just about any data set attribute available in JCL. For instance, if you wanted the FTPed file to look like a card image, you could enter:

<pre>site lrecl=80 blksize=3120

To which FTP will respond:
>>> SITE lrecl=80 blksize=3120
200 SITE command was accepted</pre>

After you’ve entered the proper data set attributes you may use the “stat” subcommand to check:

<pre>stat
211-Record format FB, Lrecl: 80, Blocksize: 3120</pre>

Note that the line above is a snippet of stat output. Normally the command produces several screens of data.
You can still use stat if you initiate the FTP from another platform, you just prefix it with “quote,” as shown below:

<pre>quote site lrecl=80 blksize=3120</pre>

Here, “quote” command is kind of an escape verb that directs the text following it to be processed by the host FTP server.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Indoubt88
    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
    45 pointsBadges:
    report
  • petkoa
    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
    3,120 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following