As usual, things are a "little" complicated <G>
First and foremost, "line sequential" is NOT ANSI or ISO conforming ('85
or
'02 Standards - or any other Standard). Therefore, there is NOTHING in
any
Standard telling you what to do with WRITE or anything else of LINE
sequential files.
In fact, the current N/E V4 Micro Focus LRM gives different rules for
"line
sequential" (marked with an "MF" bubble) and record (ANSI conforming)
sequential files. They are:
GR(10) (line sequential) - If the ADVANCING phrase is not used, automatic
advancing of one line is provided to act in accordance with the convention
of your operating system text editor (usually as if you had specified
BEFORE
ADVANCING 1 LINE).
***
GR(15 (record sequential) - If the ADVANCING phrase is not used, automatic
advancing is provided when output is directed to a list device (PRINTER or
PRINTER-1), to act as if you had specified AFTER ADVANCING 1 LINE.
***
Now the '02 Standard (tried to) clarify what "print type" files and
devices
are/were - but it is pretty clear
GR(21) - "If the ADVANCING phrase is not used, automatic advancing
shall
be provided by the implementor to act as if the user has specified AFTER
ADVANCING 1 LINE."
***
Given all of this, I think it is "reasonable" to treat LINE SEQUENTIAL
files
with "BEFORE ADVANCING" and RECORD SEQUENTIAL files with "AFTER
ADVANCING".
Now what to do with output sent directly to a "printer-type" device is not
nearly so clear. On the other hand, I think that using the Select/Assign
"organization" to determine BEFORE/AFTER advancing is reasonable - even
for
these.
Does this help?
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Roger While
> Sent: Sunday, February 27, 2005 2:33 PM
> To: address@hidden
> Subject: [open-cobol-list] Clarification requested (LINAGE - LS - NL)
>
> After preparing most of the code for implementation of
> LINAGE, I noticed the following and would appreciate comments :
> (Bill ?)
> 1) A WRITE to a (LINE) SEQUENTIAL file without an ADVANCING is
> a) 2002 says it is AFTER ADVANCING 1
> b) MF and OpenCobol says it is BEFORE ADVANCING 1
>
> Given (1) and (a), if this is the first line to be printed,
> should the first line to be produced consist of only a
> "new line" character ? Or is "top of page" special ?
> (MF produces a single newline)
> (And with LINAGE MF still produces (IMHO wrongly) a
> newline)
> What about WRITE AFTER PAGE ?
> Should the LINAGE clause affect this behaviour ?
>
> If we do a "WRITE AFTER" as the last statement before closing
> the file, we produce (also MF):
> "<NL>text"
> and then close the file, we end up with a non-newline terminated
> output.
> Should a CLOSE detect this and write a terminating newline ?
>
> Should it be possible to "concatenate" a print line by
> doing a WRITE AFTER followed by a WRITE BEFORE ?
>
> (Before you ask Bill, yes, LINAGE-COUNTER will be implemented per
> file :-) )
>
> Roger