Re: EOF location?
- From: "Pete Dashwood" <dashwood@xxxxxxxxxxxxxx>
- Date: Mon, 29 May 2006 02:58:37 +1200
Thanks Michael,
A very concise and accurate summation of the points discussed.
Pete.
TOP POST nothing new below...
"Michael Mattias" <michael.mattias@xxxxxxx> wrote in message
news:3gieg.714$VE1.70@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:e5c8aa$8k6$00$1@xxxxxxxxxxxxxxxxxxxx
Sorry PD, CR/LF has never, and will never indicate EOF.
CR/LF indicates end-of-line (EOL)(in a text file); period.
The extra end-of-file (EOF) byte comes from MSDOS which indeed
inserted an ASCII 26 (control-z) at end of file.
Modern windows "command window" do NOT insert
this EOF anymore although they will read/interpret it.
We seem to have reached a point where the difference between the
computer's
operating system and the application has become blurred.
What characters are written to disk, and how they are read back, is a
function of the application which writes or reads. The Windows and its
predecessor MS-DOS operating systems are totally ignorant of any special
meanings for any character.
"By convention" CRLF means "end of record when the application considers
the
file a text file" and this convention is respected by all applications
which
consider themselves "text editor/viewer" applications. (FWIW, the
definition
of a "text" file as a "collection of carriage-return-line-feed delimited
logical records" is about as universal a definition as exists).
Also "by convention" a "text file" is terminated by Ctrl-Z (0x1A), but
this
is nowhere near as widely recognized; or more accurately, is no longer as
widely recognized as it used to be.
Type at a prompt "1,2,3,4,5,6,<enter>?" The application reading the
keystrokes (in this case the command shell) arbitrarily decides that
<Enter>
means "add CR LF to the file".
Need 0x1A? Type 1,2,3,4,5,6,<Ctrl-z> using the same application, the
command shell - you got it. Type <Ctrl-z> in another 'text editor'
application such as Notepad - you get nada; or maybe a beep; or maybe "The
quick brown fox jumped over the lazy white dog <CRLF>." Hit the "F6"
key?
The command shell application decides this means "append a single 0x1A to
the file."
Bottom line is, on the MS-DOS and WIndows operating systems all files are
but a stream of bytes; there are no end-of-record markers, there is no
end-of-file marker; all characaters stored in the file are equally
considered valid 'data' characters. (Not necessarily true of other
operating
systems.).
Only by understanding this and your application requirements can you
select
the proper COBOL tool for the task at hand.. shall I use what my compiler
application calls a LINE SEQUENTIAL file organization? Or shall I treat
the
file as a stream of bytes and locate the logical records myself by finding
the CRLF (or other record-delimiting ) characters? And what should my
application do if it finds a byte which is a 0x1A character?
Yes, Ye Olde Bane of 'application-specific' strikes again!
MCM
.
- References:
- EOF location?
- From: HeyBub
- Re: EOF location?
- From: Pete Dashwood
- Re: EOF location?
- From: Rick Smith
- Re: EOF location?
- From: Pete Dashwood
- Re: EOF location?
- From: Rick Smith
- Re: EOF location?
- From: Pete Dashwood
- Re: EOF location?
- From: Roger While
- Re: EOF location?
- From: Michael Mattias
- EOF location?
- Prev by Date: Re: EOF location?
- Next by Date: Re: Is a career switch to the mainframe/cobol world responsible?
- Previous by thread: Re: EOF location?
- Next by thread: Re: EOF location?
- Index(es):
Relevant Pages
|
|