LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 10 Aug 2004 15:52:30 -0700
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: merging datafiles without using named datasets
Comments: To: Rune Runnestoe <rune@FASTLANE.NO>

Hi again Rune -

It's a DOS end-of-file mark (CTRL-Z or '1A'x) probably appended by your Hex editor, or DOS if you're using a copy command.

</web info> Why do text files end in Ctrl+Z? Actually, text files don't need to end in Ctrl+Z, but the convention persists in certain circles. (Though, fortunately, those circles are awfully small nowadays.)

This story requires us to go back to CP/M, the operating system that MS-DOS envisioned itself as a successor to. (Since the 8086 envisioned itself as the successor to the 8080, it was natural that the operating system for the 8086 would view itself as the successor to the primary operating system on the 8080.)

In CP/M, files were stored in "sectors" of 128 bytes each. If your file was 64 byte long, it was stored in a full sector. The kicker was that the operating system tracked the size of the file as the number of sectors. So if your file was not an exact multiple of 128 bytes in size, you needed some way to specify where the "real" end-of-file was.

That's where Ctrl+Z came in.

By convention, the unused bytes at the end of the last sector were padded with Ctrl+Z characters. According to this convention, if you had a program that read from a file, it should stop when it reads a Ctrl+Z, since that meant that it was now reading the padding.

To retain compatibility with CP/M, MS-DOS carried forward the Ctrl+Z convention. That way, when you transferred your files from your old CP/M machine to your new PC, they wouldn't have garbage at the end.

Ctrl+Z hasn't been needed for years; MS-DOS records file sizes in bytes rather than sectors. But the convention lingers in the "COPY" command, for example. </web info>

In SAS onlinedoc search for IgnoreDOSEOF option. If you want to drive a novice crazy then stick a ctrl-z in the middle of a file.

HTH

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Rune Runnestoe Sent: Tuesday, August 10, 2004 1:41 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: merging datafiles without using named datasets

> 1. from DOS: open a DOS window, go to the drive and directory (with DOS commands [drive]:, CD [dir], etc., if you know them) where your files are located and issue the DOS command: > COPY fixed_1.dat+fixed_2.dat fixed_ok.dat > (This does not use or relate to SAS.) > > 2. from SAS: X 'COPY fixed_1.dat+fixed_2.dat fixed_ok.dat'; > > 3. from SAS: CALL SYSTEM ('COPY fixed_1.dat+fixed_2.dat fixed_ok.dat'); > > 4. from SAS: %SYSEXEC COPY fixed_1.dat+fixed_2.dat fixed_ok.dat; > > I have now tested all these methods and they all works fine. There is just one little thing I wonder about, and that is why the resulting file from the concatenation (fixed_ok) end with the hexadecimal digit 1A.

Rune


Back to: Top of message | Previous page | Main SAS-L page