gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [open-cobol-list] Clarification requested (LINAGE - LS - NL)


From: Roger While
Subject: RE: [open-cobol-list] Clarification requested (LINAGE - LS - NL)
Date: Tue Mar 1 23:31:12 2005

Thanks Bill, That helps a little.
Yes, I know that LS is an MF extension. IMHO, it should
have been adopted into the standard. It makes a lot of sense.
This is what I am going to do :
If the file is (LINE) SEQUENTIAL and has LINAGE,
(it is checked that the LINAGE applies to a SEQ file)
it will internally operate as LINE SEQ.

 Another question which I think is logically clear but not
specifically answered in any doc although I think it may be
implied :
Assume -
LINAGE data-item = <some number>
FOOT data-item = 0
TOP data-item = 0
BOTTOM data-item = 0

We OPEN OUTPUT the file and start WRITE'ing.
At some point we MOVE 1 to TOP and BOTTOM.
We now get an END-OF-PAGE condition on
a WRITE BEFORE/AFTER 3.
At this point we reread the 4 values above.
It's pretty obvious that we should use the previous
value of BOTTOM (plus previous LINAGE minus previous
LINAGE-COUNTER) to finish off the current page.
But I assume that TOP value (for the next page)
to be used should be the new value.
Correct ?

Roger

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]