Date: Wed, 7 May 2003 11:57:31 -0400
Reply-To: Ed Heaton <EdHeaton@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ed Heaton <EdHeaton@WESTAT.COM>
Subject: Re: Keep leading blanks and blank lines
Content-Type: text/plain
Ben,
It's actually the PUT statement that's dropping the blanks. There are two
solutions: one is to use the $CHAR80. format on the PUT; the other to stick
with _inFile_. Under version 8, the input buffer can be modified in place.
data _null_;
infile mysource shareBuffers ;
_inFile_ = tranwrd(_infile_,"dsn","DSNT");
file mypds(member);
put _inFile_ ;
run;
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1600 Research Boulevard, Room RW-3541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 610-5128
mailto:EdHeaton@westat.com http://www.westat.com
-----Original Message-----
From: Krone, Ben --- Manager - Operations Systems --- GO
[mailto:Ben.Krone@FREIGHT.FEDEX.COM]
Sent: Wednesday, May 07, 2003 11:49 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Keep leading blanks and blank lines
Greetings,
I have a likely simple question. I am working on a program to perform a
simple "find-and-replace" on members of a PDS using V8.1 on OS/390. It
works fine on replacing the string, however I am losing the leading
spaces in each line of text and blank lines are being removed. For the
most part it simply makes the code ugly, but where I have comments like
/* */, they are now in the first postition and causing the job to fail.
Here is an example:
proc source indd = mypds oudd = mysource;
select member;
run;
This prints to the log the code read from the member which looks like
this:
<snip>
/* Get data from DB2 */
proc sql;
connect to db2 (ssid = dsn);
create table wrk1 as
select * from connection to db2
(
</snip>
Now when a try to replace the target string:
data _null_;
length x $80;
infile mysource;
x = tranwrd(_infile_,"dsn","DSNT");
file mypds(member);
put x;
run;
The member in the PDS looks like this:
<snip>
/* Get data from DB2 */
proc sql;
connect to db2 (ssid = DSNT);
create table wrk1 as
select * from connection to db2
(
</snip>
I assume it is TRANWRD that is dropping the blanks. Any way to resolve
this?
Thanks
Ben
**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************