Re: why is Display statement displaying in this way?

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

 



Am 19.09.2021 um 21:42 schrieb Roderick Clay:
Hello.  I'm new to this list, so hope my question(s) are no breach of
any protocol.

Hi Rod, welcome to GnuCOBOL and this list.
Your questions are perfectly valid here, too.

I am a long time COBOL programmer, but just started using GNUCOBOL on my
Linux Mint machine recently.

Nice choice. Last time I've checked Mint didn't ship an up-to-date
version of GnuCOBOL, do you use a recent version?
The output of `cobc -V` would be useful, if it is old then an install of
GnuCOBOL "from source" would be good - but I'd have a look at that in
any case.

This is a small thing, but it's got me puzzled!

I have a few Display statements in the program I've been working
on the last 2 days and they are displaying in a way I have NEVER
seen a Cobol Display statement display before. EVERY display spills over
onto a 2nd line. And it always spills over onto the 2nd line where a
space appears in the record I am displaying. It is NOT a control
character. I've done a hex dump to confirm that. It is always a space.
But it could be the first space in the record, or the 2nd, or the 3rd,
or the 4th, etc. And it displays sometimes just a few characters on the
first line, sometimes quite a few more than that.  There doesn't seem to
be any discernible pattern to when the display spills over onto the 2nd
line.

Well, I finally figured out that the Display statement is using the
defined maximum length (very long) of my variable length record rather
then the actual length of the record (pretty short) (and which I've
verified that it has correctly).  Why is this? Why doesn't the Display
statement display the record only up to its known length?

That sounds like a bug. Can you please try to create a minimal example
that can be executed (so I guess it will create a file, then write some
variable length records, then reads and display those) and shows the
issue? This would help rechecking it and potentially also in fixing the
issue.

Also, why is it displaying one piece of the actual record on one line,
then displaying the rest of the actual record on the 2nd line? Why
isn't it displaying the entire variable length record as is, with the
actual  content of the record first on the first line, then the rest of
the long maximum length (filled with spaces) on subsequent lines?

I'm not sure what you mean here, can you give an example with the
expected vs. actual displays (ideally a text file attached)? This seems
like a potential second issue, but it could also have something to do
with the terminal or the way the DISPLAYs are set up.

If anyone has any insight into any if this, it would be much
appreciated. (BTW, now that I've changed the definition of the record to
be a much shorter maximum length, it displays just fine on one line.)

Thank you.

Rod

Thanks for the report, I'm looking forward for those two files helping
to find the issue behind this :-)

Simon





[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux