beginner question regarding a bug. 
Author Message
 beginner question regarding a bug.

   I found a strange bug. I fixed it by doing something silly but I want
to know why it worked.

   definition in working storage

           BLANK-LINE PIC X VALUE SPACES  

   code that does not work:

           WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed

           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
           WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

    code that does work:

           WRITE PRINT-LINE FROM BLANK-LINE <--but this is printed
           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
           WRITE PRINT-LINE FROM INV-FOOTING-LINE
           write print-line from blank-line BEFORE ADVANCING PAGE <-silly

    The problem appears wherever I try to print a blank line and then
write something else in the following statement with a BEFORE ADVANCING
PAGE.
    I should probably mention that Malaspina College runs a DEC Cobol
compiler.  This bug is not a big deal, The next step is to convert this
program to work with report writer anyway...but not knowing annoys me.  
Any Ideas????

                                                        Thank-you in advance....



Mon, 17 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.

Quote:
You wrote...

>   I found a strange bug. I fixed it by doing something silly but I want
>to know why it worked.

>   definition in working storage

>           BLANK-LINE PIC X VALUE SPACES  

>   code that does not work:

>           WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed

>           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>           WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

>    code that does work:

>           WRITE PRINT-LINE FROM BLANK-LINE <--but this is printed
>           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>           WRITE PRINT-LINE FROM INV-FOOTING-LINE
>           write print-line from blank-line BEFORE ADVANCING PAGE <-silly

>    The problem appears wherever I try to print a blank line and then
>write something else in the following statement with a BEFORE ADVANCING
>PAGE.
>    I should probably mention that Malaspina College runs a DEC Cobol
>compiler.  This bug is not a big deal, The next step is to convert this
>program to work with report writer anyway...but not knowing annoys me.  
>Any Ideas????

>                                                    Thank-you in
advance....

It probably did work, but only printed one character. If you want to print an
entire blank line, you must define the entirr line as spaces in WS. as in.....

Pic x(80) or Pic X(132) value spaces. (depends on your printer spacing chart)

Good luck

Bosun


http://members.aol.com/bbello5778/bosun.htm
Programmer/Analyst. Bloomington, IL



Tue, 18 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.

:    code that does not work:
:        
:            WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed
:            MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
:            WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

I think your problem is from mixing pre-spacing and post-spacing.
I don't know about DEC COBOL, but in Standard COBOL, a WRITE statement
without the ADVANCING phrase behaves as though you had specified
AFTER ADVANCING 1 LINE.  So you are advancing a line, then printing a
blank line, then printing the footing line, then advancing to the
next page.  It's not that the blank line isn't printed; it's just
that it is immediately overwritten by the footing line.

Walter Murray



Tue, 18 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.


Quote:

>     BLANK-LINE PIC X VALUE SPACES
[...]
>     WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed

>     MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>     WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

OK, go over this in your mind.  The first write has the default AFTER
ADVANCING 1 LINE.  The second write has BEFORE ADVANCING PAGE.  So:

    o  The carriage is advanced one line
    o  BLANK-LINE is printed
    o  INV-FOOTING-LINE is printed in the same spot
    o  The carriage is advanced to the next page.

You can see this by temporarily changing SPACES to e.g. "*".  You don't
want to be printing blank lines anyway.  What you want is, say,

    WRITE PRINT-LINE FROM INV-FOOTING-LINE AFTER ADVANCING 2 LINES.

and then print the first line on the next page AFTER ADVANCING PAGE.

[...]

Quote:
>     WRITE PRINT-LINE FROM BLANK-LINE <--but this is printed
>     MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>     WRITE PRINT-LINE FROM INV-FOOTING-LINE
>     write print-line from blank-line BEFORE ADVANCING PAGE <-silly

OK, go over this in your mind.  The first write has the default AFTER
ADVANCING 1 LINE.  The second write has the default AFTER ADVANCING 1
LINE.  The third write has BEFORE ADVANCING PAGE.  So:

    o  The carriage is advanced one line
    o  BLANK-LINE is printed
    o  The carriage is advanced one line
    o  INV-FOOTING-LINE is printed
    o  BLANK-LINE is printed in the same spot
    o  The carriage is advanced to the next page.

Quote:
> The problem appears wherever I try to print a blank line and then
> write something else in the following statement with a BEFORE ADVANCING
> PAGE.

The "problem" occurs whenever you switch between AFTER and BEFORE.

--
Christopher Westbury, Midtown Associates, 15 Fallon Place, Cambridge, MA 02138



Tue, 18 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.



Quote:
>    I found a strange bug. I fixed it by doing something silly but I want
> to know why it worked.

>    definition in working storage

>            BLANK-LINE PIC X VALUE SPACES  

>    code that does not work:

>            WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed

>            MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>            WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

>     code that does work:

>            WRITE PRINT-LINE FROM BLANK-LINE <--but this is printed
>            MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>            WRITE PRINT-LINE FROM INV-FOOTING-LINE
>            write print-line from blank-line BEFORE ADVANCING PAGE <-silly

>     The problem appears wherever I try to print a blank line and then
> write something else in the following statement with a BEFORE ADVANCING
> PAGE.
>     I should probably mention that Malaspina College runs a DEC Cobol
> compiler.  This bug is not a big deal, The next step is to convert this
> program to work with report writer anyway...but not knowing annoys me.  
> Any Ideas????

>                                                    Thank-you in advance....



Tue, 18 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.

WRITE statements that do not have an ADVANCING do have two problems, because of the
default in the COBOL language standard.
First the default: thats easy: AFTER ADVANCING 1 LINE is assumed on WRITEs without
an ADVANCING when for the same file also WRITEs with an ADV are written.
Second the problems:
Problem 1 is that you can get a mix of AFTER and BEFORE this way. Very confusing and
silly looking output has made my life interesting. Nowadays I stick to AFTER only
(lots of discussion possible about that choice) and I have a red light automatically
switching on when I see a WRITE. (Dear PAvlov).
Problem 2. I know at least one compiler that does not produce code conforming the
default rule. That comiler does not insert printer carriage control characters when
it sees a WRITE without. This comiler, on a PC working in ASCII, does insert a CR
(carriage return) character allright, but no appropriate line feeds.

You've got problem 1, Perhaps even problem 2, according to me.

Success de{*filter*}!
Huib Klink

Quote:



> >    I found a strange bug. I fixed it by doing something silly but I want
> > to know why it worked.

> >    definition in working storage

> >            BLANK-LINE PIC X VALUE SPACES

> >    code that does not work:

> >            WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed

> >            MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
> >            WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE

8< Rest snipped


Sun, 23 Jul 2000 03:00:00 GMT  
 beginner question regarding a bug.

Quote:

>   I found a strange bug. I fixed it by doing something silly but I want
>to know why it worked.
>   definition in working storage
>           BLANK-LINE PIC X VALUE SPACES  

>   code that does not work:

>           WRITE PRINT-LINE FROM BLANK-LINE <--this line is not printed
>           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>           WRITE PRINT-LINE FROM INV-FOOTING-LINE BEFORE ADVANCING PAGE
>    code that does work:
>           WRITE PRINT-LINE FROM BLANK-LINE <--but this is printed
>           MOVE TOTAL TO INV-FOOTING-LINE-TOTAL
>           WRITE PRINT-LINE FROM INV-FOOTING-LINE
>           write print-line from blank-line BEFORE ADVANCING PAGE <-silly
>    The problem appears wherever I try to print a blank line and then
>write something else in the following statement with a BEFORE ADVANCING
>PAGE.
>    I should probably mention that Malaspina College runs a DEC Cobol
>compiler.  This bug is not a big deal, The next step is to convert this
>program to work with report writer anyway...but not knowing annoys me.  
>Any Ideas????
>                                                    Thank-you in advance....

I think what you want to do is write print line after advancing 1 line
.. or.. after advancing page.. before means you won't advance to the
next line.. and will write on the SAME line as your previous write...


Fri, 28 Jul 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Beginner question regarding multiple definitions for 1 register.

2. Newbie question regarding SmallEiffel (potential compiler bug?)

3. Beginner's Question (or bug in python?)

4. Bug in latest snapshot, regarding Float#to_s

5. Regarding MAJOR FPU bug in Pentium II

6. bug in to_f90 regarding INTENT

7. Possible bug in tkMain regarding argv0

8. BUG: unknown (and therefore all autoloading routines) broken regarding namespace

9. Tcl8.0 bug regarding booleans

10. BUG: Tk4.0b3 Text Search regarding indices

11. button question (not a beginner question?)

12. BUGS, BUGS, BUGS, BUGS, C4 BUGS

 

 
Powered by phpBB® Forum Software