HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
16 user(s) are online (2 user(s) are browsing Forum)

Members: 0
Guests: 16

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
human
Posted on: 2012/6/22 14:54
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
Because of current state of OpenCOBOL CE I'd like to ask you (especially wmklein) if it should be allowed (from my personal understanding of the 20xx Draft: YES) and how it should work.

Test program
       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      prog.
       ENVIRONMENT      DIVISION.
       INPUT-OUTPUT     SECTION.
       FILE-CONTROL.
       SELECT TEST-FILE ASSIGN       "./TEST-FILE"
                        ORGANIZATION IS LINE SEQUENTIAL.
       DATA             DIVISION.
       FILE             SECTION.
       FD TEST-FILE.
       01 TEST-REC      PIC X(4).
       PROCEDURE        DIVISION.
           OPEN OUTPUT TEST-FILE.
           MOVE "a"    TO TEST-REC. WRITE TEST-REC
           END-WRITE.
           MOVE "ab"   TO TEST-REC. WRITE TEST-REC AFTER 1 LINES
           END-WRITE.
           MOVE "abc"  TO TEST-REC. WRITE TEST-REC BEFORE 2 LINES
           END-WRITE.
           MOVE "abcd" TO TEST-REC. WRITE TEST-REC
           END-WRITE.
           CLOSE TEST-FILE.
           STOP RUN.


result in OC 1.1 Feb-09:
a

ababc

abcd
- in hex
61 0a  0a 61  62 61  62 63  0a 0a  61 62  63 64  0a
 a \n  \n  a   b  a   b  c  \n \n   a  b   c  d  \n


current result in OC CE:
a

ab
abc

abcd
- in hex
61 0a  0a 61  62 0a  61 62  63 0a  0a 61  62 63  64 0a
 a \n  \n  a   b \n   a  b   c \n  \n  a   b  c   d \n


The Mainfraime does not allow this at all Quote:

PP 5655-S71 IBM Enterprise COBOL for z/OS 4.2.0 in progress ...
LineID Message code Message text
16 IGYPA3217-S "WRITE BEFORE ADVANCING" statement was specified for
"LINE SEQUENTIAL" file "TEST-FILE". The statement was
discarded.
Messages Total Informational Warning Error Severe Terminating
Printed: 1 1
End of compilation 1, program PROG, highest severity 12.
Return code 12


MF COBOL for UNIX 4.1r040 on HPUX and MF ServerExpress v2.2 on AIX give nearly the same result as current OpenCOBOL CE:
61 0a  0a 61  62 0d  61 62  63 0d  0a 0a  61 62  63 64 0a 00
 a \n  \n  a   b \r   a  b   c \r  \n \n   a  b   c  d \n


ACU COBOL 7.2.0 on UNIX
0a 61  0d 0a  61 62  0d 61  62 63  0d 0a  0a 0a  61 62  63 64  0d
\r  a  \r \n   a  b  \r  a   b  c  \r \n  \n \n   a  b   c  d  \r


Has somebody the hex dump of other compilers available or a useful opinion about what's right/wrong in this case?

Simon 'human' Sobisch
jcurrey
Posted on: 2012/6/22 19:30
Home away from home
Joined: 2009/3/19
From: Texas
Posts: 181
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
@human

I have never worked with a compiler (Wang, Burroughs, IBM [VS, OS/400, System/36, DOS], HP, MicroFocus, AccuCobol) where mixing before and after on the same printer file gave me the results I was hoping for.

Maybe the problem has been me all along

For our part we ask the programmers to use either before or after but not both in the same program.

Getting your question answered might help me to understand something that I have ignored far too long.

jimc
wmklein
Posted on: 2012/6/25 23:40
Home away from home
Joined: 2008/12/27
From:
Posts: 327
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
As far as I can tell the draft Standard (like all previous standards) has no explicit rule prohibiting the use of WRITE AFTER and WRITE BEFORE for the same file in the same program.

HOWEVER, the "behavior" of both phrases is "sort of" up to the implementor. (Cf for example, the IBM ADV/NOADV compiler option).

I am with Human, in thinking tha everytime I have seen a program that TRIED to mix these, the run-time results were not what was desired.

I thought I had seen a warning against this in the IBM manuals, but haven't been able to find one.

I would fully support OC producing a warning or informational message when both phrases were used for the same file in the same program.
vbcoen
Posted on: 2012/7/12 20:15
Not too shy to talk
Joined: 2007/2/13
From: Essex, UK
Posts: 26
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
Only just seen this sorry,

I have used before and after since the early 60's ok, to be specific 1961 on IBM 1401 and ICL 1501's and up through 360/370 and later!

I have used it in printcbl.

I do not understand the problem as its almost mandatory when writing to a print file in OC in order not to waste paper eg, unneeded page skips at start of the report and yes some of my stuff is still being printed on m/f chain / barrel printers running at 3 - 5,000+ lines per minute and Ops do not like paper wastage or for that matter, paper breaks (slows down keeping the printer correctly feed and cleared.

Removal of this function will cause a rather large number of my programs to fail and I would really prefer not to have to change them all because of a change to the standard by OC.

As to what IBM allows in 'one' of its compilers is a total nonstarter.
What are the system setting for that specific site compiler that caused the error msg?
. and yes IBM compilers along with other m/f manufactures do/did the same eg, ICL.

The m/f support team install the compiler/s with predefined parameters that help to force site standards and no more.

If some one had a look at these setting they might well find that the option is turned off.

That said it is not difficult for a programmer to override all of the site params if needed eg, migration from a 'no longer supported' compiler for the latest one assuming the site can afford to upgrade and I don't just mean the price of it!!

Vincent, almost now retired 'sic'.

wmklein
Posted on: 2012/7/13 4:07
Home away from home
Joined: 2008/12/27
From:
Posts: 327
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
Does printcbl use a COBMINATION of
WRITE AFTER ADVANCING
and
WRITE BEFORE ADNANCING

I don't think there is any quesiton that both need to be supported. The only issue (as I understood it) was what happens when you use a combination of the two in the same program against the same (lien sequential) file.

So far, I haven't found any "documented" restriciton against it in any compiler, but I did have a "vague" memory of there being problems when the two were mixed.

I *KNOW* there are problems when you mix
BEFORE/AFTER ADVANCING
and'
BEFORE/AFTER POSITIONING

but "positioning" is an old feature (used for "card stackers" mostly) and I don't even know if OC supports "postioning"
human
Posted on: 2012/7/13 8:23
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
BEFORE/AFTER POSITIONING isn't supported (and isn't part of ISO 20xx draft, not sure if it was a part of the ANSI standard), and I guess there is no real need for that. If there is a real need and if documentation can be shared, we may have a look at it (simply integrating a submitted patch would be more likely, of course).

For sure both BEFORE/AFTER ADVANCING will be supported. The question here is how OpenCOBOL should handle the mixture. Please have a look at the differences between 1.1feb09 and current CE-version (one x'0A' in this case). I'm not sure what is "more correct", but as current CE is "nearer" to other vendors than feb09 I'd vote for the current CE one.

Any thoughts?

Simon 'human' Sobisch
jgt
Posted on: 2012/7/18 12:29
Just can't stay away
Joined: 2010/1/18
From: 44.21.48N 80.50.15W
Posts: 76
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
Micro Focus 4.1 (1999) Run on SCO 6.0.0
                                                       
0000    61 0a 0a 61 62 0d 61 62  63 0d 0a 0a 61 62 63 64   a..ab.abc...abcd    
0010    0a                                                 .                   
0011                                                        


RM Cobol 85 version 6.09 (1997) SCO 6.0.0
                                                   
0000    0a 61 0d 0a 61 62 0d 61  62 63 0d 0a 0a 0a 61 62   .a..ab.abc....ab    
0010    63 64 0d                                           cd.                 
0013                                                        



wmklein
Posted on: 2012/7/19 3:36
Home away from home
Joined: 2008/12/27
From:
Posts: 327
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
The last post makes me think that there MIGHT be an issue about what is and is not predictable with WRITE BEFORE/AFTER advancing.

It is clear from the Standard (and this has been explicitly discussed within the standards groups), that the ONLY thing that these phrases are "guaranteed" to do is impact how the output appears on a PRINTED page (with a supported printer).

For example if you WRITE AFTER ADVANCING 2,

this can be done with "two carriage control" characters, two blanks lines, or if the printer supports it, a "skip 2 lines" control character.

Furthermore, the same compiler can create DIFFERENT "physical" ways of doing the same thing depending on anything they want (up to and including the time of day!)

You need to actually "print" the output of these statements to see if the compiler (and run-time) are working as required. Just "looking at" the bytes in the file is NOT what these statements/clauses are intended to impact.
human
Posted on: 2012/9/5 13:35
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Question about WRITE BEFORE ADVANCING on LINE SEQUENTIAL files
End of story: I've changed the test suite according to the new behaviour of CE, because nearly all other compilers have a line break between ab and abc.

human
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net