DATA Step, Macro, Functions and more

How to add carriage return at the end of a put statement ?

Reply
Contributor
Posts: 56

How to add carriage return at the end of a put statement ?

We are trying to write a SAS dataset in MVS to a PC txt file through the filename ftp
method as follows:

FILENAME OUTIT FTP "FILE.TXT" HOST='xxx-xxx-xxx' CD="\PATH" USER='ANONYMOUS' PASS= "&PASS" RECFM=FB LRECL=240 ENCODING=ASCII ;

DATA _NULL_ ;

SET SASDATA ;
FILE OUTIT ENCODING=ASCII LINESIZE=240 ;

PUT
...... ;
RUN;

The process works and the log shows the correct line output to the pc file. But when I browse the output with word pad, it concatenate the file into 1 long line. Looks like the carriage return is missing from each line. Does anybody have any idea how to write out a carriage return at the each line ?

I realized there are other ways to skin this cat but this is part of a macro that is writing out to different platforms and we are trying to avoid another JCL or data step.

Thanks for all your help.

Kwok
Super Contributor
Super Contributor
Posts: 3,174

Re: How to add carriage return at the end of a put statement ?

As I understand it, this is a Windows NotePad problem. The data structure is correct. As a circumvention, open the file with WordPad, and if you save the file once, then you can open it with NotePad after.

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 56

Re: How to add carriage return at the end of a put statement ?

Hello Scott,

Thanks for your info. But my problem is with word pad. The word pad put all the line without carriage return. Note pad looks aweful too. Any other idea ?

Thanks
Kwok
Super Contributor
Super Contributor
Posts: 3,174

Re: How to add carriage return at the end of a put statement ?

Review the SAS Companion for z/OS documentation -- refer to the TERMSTR and ENCODING discussions (there are multiple references). Also, I recommend coding as few parameters as required, letting SAS defaults take unless absolutely required. I have no problem doing FTPs (EBCDIC-to-ASCII) from SAS FILENAME with FTP engine to Windows/Unix, except for the Windows NotePad/WordPad behavior differences.

Scott Barry
SBBWorks, Inc.

SAS support website:

http://support.sas.com/


SAS 9.1.3 for z/OS Companion Guide
http://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/base_zoscom_8406.pdf
Respected Advisor
Posts: 3,799

Re: How to add carriage return at the end of a put statement ?

You are telling SAS to create the file without record terminators the F in the record format.

RECFM=FB F means fixed, no record termination strings.
LRECL=240 is logical record length.

So the records do not have termination strings as in "regular" windows files. I can't test it but I think if you change RECFM=V then you will get the proper records.
Contributor
Posts: 56

Re: How to add carriage return at the end of a put statement ?

Posted in reply to data_null__
Thanks very much for your recommendation. It works !
Ask a Question
Discussion stats
  • 5 replies
  • 4166 views
  • 0 likes
  • 3 in conversation