0

Every time I'm writing to an output file, there will always be an end-of-proof symbol ().

Consider the program below:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. HEY.
   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.
       SELECT OUTFILE ASSIGN TO "alpha.txt".
   DATA DIVISION.
   FILE SECTION.
   FD  OUTFILE.
   01  OUTREC       PIC X(10).
   PROCEDURE DIVISION.
       OPEN OUTPUT OUTFILE
       MOVE "ABCDEFGHIJ" TO OUTREC
       WRITE OUTREC
       CLOSE OUTFILE
       STOP RUN.

The contents of alpha.txt is

ABCDEFJHIJ
□

I'm using Realia because that is what our school requires us to use. I'm also aware that if I run the same code above using some other compiler such as OpenCobol, the output is just fine, i.e., without the the end-of-proof symbol.

So, how do I remove the end-of-proof symbol?

Satellite Sage
  • 440
  • 1
  • 4
  • 13
  • "I'm using Realia because that is what our school requires us to use." I *highly* suggest to talk to the instructors as Realia is (as far as I know) very outdated and GnuCOBOL should work on any system Realia works on. – Simon Sobisch Aug 12 '19 at 13:51

2 Answers2

0

It is almost certainly an end-of-file mark (Cntl-Z or 0x1A). On my system (Win 10) the symbol is displayed as elongated (tall) rather than square. Pasted to this post it is square.

ABCDEFJHIJ

[The square shows in preview and edit; but later disappears.]

See also this answer and this Wikipedia article, End-of-file, for more information.

How to remove end-of-proof symbol?

Reading files in Realia COBOL is not a problem. It may not be a problem with GNUCobol. However, a character by character copy of the file, stopping at the eof-of-file mark, can be done in COBOL or any other language.

Rick Smith
  • 3,962
  • 6
  • 13
  • 24
0

There is likely no end-of-proof symbol in the file, instead the symbol you see is used for the non-printable character which is in there (or a character without a symbol in the used font; or, as Rick pointed out the end-of-file marker).

From the "txt" extension it looks like you want a text file but as you did not specify anything you end up with a sequential file. I'm not 100% sure about the support for the (up to COBOL 202x non-standard) ORGANIZATION IS LINE SEQUENTIAL in Realia COBOL, but I suggest to give it a try:

       SELECT OUTFILE ASSIGN TO "alpha.txt"
              ORGANIZATION IS LINE SEQUENTIAL.
Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38