Menu

Program Guide typo

2025-06-15
2025-06-30
  • Michael F Gleason

    Where did the Programmers' Guide forum go?
    I wanted to submit a typo correction but don't know where to post it. So, here it is.

    Attached files are about a minor issue with the otherwise GREAT document.
    PG-ERRORS-12.TXT is about the typo and my observations.
    TEST78.COB is the sample program converted to FIXED format. (I mostly use fixed format because
    errors from the compiler display the sequence numbers of the error. You can find the problem code faster with them. Same with runtime errors).

    Can you tell I have time on my hands. No projects except compiling things with Chucks' GnuCOBOL
    Michael :-)

     
  • Vincent (Bryan) Coen

    I wil pick this up but if you have any more issue a bug report for the PG along with suggested fixes or better still a copy of the source document with the fix already done.

    You will have to download the manual sources to do this.

     
  • Vincent (Bryan) Coen

    I wil pick this up but if you have any more issue a bug report for the PG along with suggested fixes or better still a copy of the source document with the fix already done.

    You will have to download the manual sources to do this.

    1. Fixed missing 't'. Thanks.
    2. I ran the PG test78 example and compiles with no issues using cobc -x test78.cbl and keeping to single qoutes.
      In my case thhis is the char to the right of L + 1 - your kbrd might differ. Hmm I checked three kbrds and all the same diff. brands and models.)

    4.Ran it, producing >

    AAA= 199
    BBB= 5
    CCC= 4
    DDD= 2
    EEE= 9
    FFF= 0
    GGG= 47
    HHH= 0

    Compiler is 3.2 final under Linux.

     
  • Vincent (Bryan) Coen

    Sorry that shoul;d have been L + 2 right as in L ; '

     
  • Michael F Gleason

    I did a copy of the program from the PG.
    I get the following. I did a compile with free format and every line with what should have been an apostrophe had an error.

    ID DIVISION.
    PROGRAM-ID. TEST78.
    DATA DIVISION.
    WORKING-STORAGE SECTION.
    78 AAA VALUE (100 -1) + 100.
    01 K PIC X(19).
    01 A EXTERNAL PIC X(05) VALUE SPACE.
    01 R EXTERNAL PIC X(08) VALUE SPACE.
    78 BBB VALUE LENGTH OF A.
    78 CCC VALUE LENGTH OF ’1234’.
    78 DDD VALUE LENGTH OF ’1234567890’ / LENGTH OF A.
    78 EEE VALUE LENGTH OF ’123’ * 3.
    78 FFF VALUE START OF R.
    01 B EXTERNAL.
    05 C PIC X(26) VALUE ’A’.
    05 D PIC X(21) VALUE ’A’.
    78 GGG VALUE NEXT.
    78 HHH VALUE START OF A.
    05 M PIC X(23) VALUE ’B’.
    PROCEDURE DIVISION.
    DISPLAY ’AAA= ’ AAA
    DISPLAY ’BBB= ’ BBB
    DISPLAY ’CCC= ’ CCC
    DISPLAY ’DDD= ’ DDD
    DISPLAY ’EEE= ’ EEE
    DISPLAY ’FFF= ’ FFF
    DISPLAY ’GGG= ’ GGG
    DISPLAY ’HHH= ’ HHH
    STOP RUN.

     
  • Vincent (Bryan) Coen

    At aguess I would guess that your system char set clashes with that used in the manual but mine is utf-8 under Linux.

    What is the chrcter you see in your text editor when posting it from thr guide ?

    Now I am just curious :)
    but saying that char sets between systems has always lifted its head up.

    PS next is double then single quote
    " '

     
  • Michael F Gleason

    I can't tell what that character is.
    I tried to put it in a program and display the hex-of value for it, but the compiler does not like that particular character. I can not reproduce the character from my keyboard.
    What I know is it is not a double or single quote.

     
  • Vincent (Bryan) Coen

    Well if you cannot see or utilise the 2 characters I sent in prev. msg you are not using Linux and/or UTF-8 char set. So guessing it is windoz.

    Check what char set you are using.

     
  • Michael F Gleason

    I'm on a vanilla Windows 11.
    utf-8 crlf
    I see " & ' as double & single quotes
    The issue is with the character that is in the PG pdf file. It is not a quote or apostrophe.

     

    Last edit: Michael F Gleason 2025-06-16
    • Arnold Trembley

      Arnold Trembley - 2025-06-16

      I tend to see this problem when using Word Processors. Looking at the code page for ISO Latin-1:
      https://www.charset.org/charsets/iso-8859-1

      It appears that the single quote/apostrophe might be X'27', but the left single quote for word processors is x'60' and the closing right single quote is x'B4'. The compiler is probably expecting either x'27' for a single quote or x'22' for a double-quote.

      So the solution would be to somehow force the quote or apostrophe character expected by the compiler into the word processing document.

       
      • Vincent (Bryan) Coen

        I do not know what the texi process uses BUT when trying to grab code
        from a pdf or any other process only use a text editor, ever.

        On 16/06/2025 06:39, Arnold Trembley wrote:

        I tend to see this problem when using Word Processors. Looking at the
        code page for ISO Latin-1:
        https://www.charset.org/charsets/iso-8859-1

        It appears that the single quote/apostrophe might be X'27', but the
        left single quote for word processors is x'60' and the closing right
        single quote is x'B4'. The compiler is probably expecting either x'27'
        for a single quote or x'22' for a double-quote.

        So the solution would be to somehow force the quote or apostrophe
        character expected by the compiler into the word processing document.

         
  • Michael F Gleason

    I am using NOTEPAD for an editor. Both the Windows 10 & 11 versions.
    I did a select and copy of the program from the PG and pasted into NOTEPAD.
    NOTEPAD sees the character as just any other character. Just as one character. But cobc sees it as three characters.

    000150     05  CHAR-X                  PIC X(01) VALUE "’".
    000160     05  CHAR-Y                  PIC X(01) VALUE '’'.
    

    Look at the attached program. Notice that when compiled, the CHAR-X PIC X(01) gets a warning because cobc thinks the single character is three characters. I got the character from the PG using copy and paste into NOTEPAD.
    compile DISPLAY0.COB with these options.

    cobc -x -fec=all -lpdcurses -Xref -Wall -ftsymbols -t DISPLAY0.LST DISPLAY0.COB
    

    Take notice that the cobc warning message show 3 strange characters between the quotes (both single and double quotes). Compare this to the compile listing DISPLAY0.LST which shows one character but thinks it is three characters. In the attached program DISPLAY0.COB, when edited with NOTEPAD, the character appears between the quotes as coded but cobc sees three characters.

    Question. Have you tried to download the PG pdf and find the program TEST78 and edit it with NOTEPAD? I suspect you are using a pdf editor to look at the text of the PG. Somewhere between your side and my side of the parm seems to differ. What I have noticed about sample/example programs is some use quotes (both single & double) and some use the strange character instead of a quote character.

    Suprise! I found how to enter the strange character. it is a single right quote.
    Hold down alt key and type 0146 on the keypad. When you release the alt key, the character appears. Works in NOTEPAD but not in SourceForge.
    There are four alternate quotes.
    alt 0145 is single left quote
    alt 0146 is single right quote
    alt 0147 is double left quote
    alt 0148 is double right quote

    COBC does not like these when used in place of single or double quote.

     
    • Mickey White

      Mickey White - 2025-06-17

      for single quote
      inspect line1 converting x'60' to x'27'
      inspect line1 converting x'B4' to x'27'

       
  • Michael F Gleason

    I found something that may be relative the quotes. My computer region is set to UNITED STATES.
    I was reading about quotes and found that they are treated differently by region. The more I read, the more I get confused.

     
    • Paul McNary

      Paul McNary - 2025-06-16

      You need to only use quotes from the ascii base and not unicode.
      [ https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.ascii-code.com/&ved=2ahUKEwjh9PeugPeNAxV55ckDHdEcMmAQFnoECBgQAQ&usg=AOvVaw242y6KpEyu9mubRCG6jaVE | https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.ascii-code.com/&ved=2ahUKEwjh9PeugPeNAxV55ckDHdEcMmAQFnoECBgQAQ&usg=AOvVaw242y6KpEyu9mubRCG6jaVE ]

      which are 1 byte 001 decimal to 255 decimal
      Most characters you will need to use is in the 1-128 range
      Typographical characters like the fancy start and end quotes are from programs that recognize extended character sets ie. word processing and typesetting type programs.
      I think the COBOL standard still only recognizes the original 8-bit character set actually the ASCII character set which is the 7-bit 128 set of characters.
      [ https://www.w3schools.com/charsets/ref_html_ascii.asp | https://www.w3schools.com/charsets/ref_html_ascii.asp ]

      You can use the extended ASCII set (8 bit) of 256 in COBOL if character set support things such as line drawing, limited special characters in the ASCII set, etc.
      So a program editor is important to use and not a word processor.
      Notepad on Windows works.
      I use vi(m) on windows. I come from 1970's am 80's UNIX world.Everybody has their own favorite.
      Their are many Windows/Linux test/program editors including Microsoft's VScode.
      I don't remember if gnucobol automatically handles the difference in line ending or not between os/windows an the *NIX world.
      Use the above links as guidance.
      I have been a COBOL for over 50 years now but I currently do not have gnuCOBOL on-lineatthe moment..
      I have used gnuCOBOL and before that OpenCOBOL but usually on non-IBM mainframes I use MicroFocus until they price themselves out of my market.
      In the 70'san 80's I worked with many small town newspapers to make the conversion to microcomputers.
      So use only pure text files (ASCII 1-128) as input to gnuCOBOL. Or in special cases that are understood (ASCII 1-255).

      From: "Michael F Gleason" mustangmichael@users.sourceforge.net
      To: "gnucobol" help@discussion.gnucobol.p.re.sourceforge.net
      Sent: Monday, June 16, 2025 4:06:03 PM
      Subject: [gnucobol:discussion] Program Guide typo

      I found something that may be relative the quotes. My computer region is set to UNITED STATES.
      I was reading about quotes and found that they are treated differently by region. The more I read, the more I get confused.

      [ https://sourceforge.net/p/gnucobol/discussion/help/thread/5b411f5725/?limit=25#544a | Program Guide typo ]

      Sent from sourceforge.net because you indicated interest in [ https://sourceforge.net/p/gnucobol/discussion/help/ | https://sourceforge.net/p/gnucobol/discussion/help/ ]

      To unsubscribe from further messages, please visit [ https://sourceforge.net/auth/subscriptions/ | https://sourceforge.net/auth/subscriptions/ ]

      [p;;;-*+;

       
    • Vincent (Bryan) Coen

      On 16/06/2025 22:06, Michael F Gleason wrote:

      I found something that may be relative the quotes. My computer region
      is set to UNITED STATES.
      I was reading about quotes and found that they are treated differently
      by region. The more I read, the more I get confused.

      Looking at my old MF Cobol pocket guide and the IBM PC char sets I see -

      Hex    char                   Alt code

      22       " (double)          034
      27       ' (single)            039
      2C      '  (single)            044

      I can't do the alt keys under Linux using Thunderbird (my email editor)
      nor via terminal program, so cannot help any more.

      Clearly there are differences between Windows and *nix  as the windows
      uses its own default but you can change it to say UTF-8 but you being in
      Nth America would not have a need to.

      I have used UTF-8 for some years with Linux.

      So looks like you will have to remember to change any quote, double
      quote plus any others that are a problem to one's used on your keyboard.

      My suggestion would be to use fix and replace All, having selected the
      source char with one from keyboard.

      A pain I know but do not know of any other way.

      You could ask in the discussion forums and see if someone has a better
      solution.

      Vince

       
  • Michael F Gleason

    Thanks Vince.
    I do not copy many of the example/sample programs from the PG, but now I know not to complain about the single right quote being where a single quote/apostrophe and just replace it with a quote/apostrophe.

    I don't know what time it is on your side of the pond, but it 11:30 here.
    Thanks, and good night.

    Michael :-)

     
  • Simon Sobisch

    Simon Sobisch - 2025-06-30

    Rechecked with the latest PDFs and texinfo code in svn - the PDF versions have the apostrophe contained in the texi files (in this case 6.texi) changed to "textual" ones, which are invalid for COBOL.

    @vcoen How do you produce the PDFs? I guess the distributed makefile is not involved?

    As I currently can't create the PDFs... can you please check if it is different when using @verbatim / @end verbatim in 6.texi for TEST78 (instead of @example)?

    It seems that at least the recursion-text example in 5.texi has the quotes unchanged (which also uses @example), so we may just search-and-destroy each ' by " (in the @examples).

    Note: there are some usages of @example (which should only get the code) a bit mixed up.

    Here are two fixes for 5.texi (search for actual text, then move the @example and add the line break @* instead.

    Another more full example taken from the FAQs:
    @example,cobolfree
    

    and 6.texi:

    @item
    NEXT gives the integer value representing the offset at which the next byte of storage that follows the previous data declaration. @*
    
    The following sample program shows some definitions
    @example,cobolfree
    

    Side note: the identifier cobolfree is useful especially in HTML, in other places it would be cobol (fixed-form only) or c or sh, maybe even cmd. I don't think this was used before but would be useful to be started with (instead of comma you may also use a space as separator, whatever seems better for you)

     
    • Vincent (Bryan) Coen

      On 30/06/2025 17:42, Simon Sobisch wrote:

      Rechecked with the latest PDFs and texinfo code in svn - the PDF
      versions have the apostrophe contained in the texi files (in this case
      6.texi) changed to "textual" ones, which are invalid for COBOL.

      ??    This file (as upper-case)  is  6.TEXI

      there is no apostrophe but there is a period.

      @vcoen https://sourceforge.net/u/vcoen/profile/ How do you produce
      the PDFs? I guess the distributed makefile is not involved?

      I use supplied script build-manuals.sh in svn distro.

      There again I use Linux with texlive fully installed, all 3 Gb of it.
      .

      As I currently can't create the PDFs... can you please check if it is
      different when using |@verbatim| / |@end verbatim| in 6.texi for
      TEST78 (instead of |@example|)?

      It seems that at least the recursion-text example in 5.texi has the
      quotes unchanged (which also uses |@example|), so we may just
      search-and-destroy each ' by " (in the |@example|s).

      Note: there are some usages of |@example| (which should only get the
      code) a bit mixed up.

      Here are two fixes for 5.texi (search for actual text, then move the
      |@example| and add the line break |@*| instead.

      |AnothermorefullexampletakenfromtheFAQs: @example,cobolfree |

      and 6.texi:

      |@item
      NEXTgivestheintegervaluerepresentingtheoffsetatwhichthenextbyteofstoragethatfollowsthepreviousdatadeclaration.@*
      Thefollowingsampleprogramshowssomedefinitions @example,cobolfree |

      Side note: the identifier cobolfree is useful especially in HTML, in
      other places it would be |cobol| (fixed-form only) or |c| or |sh|,
      maybe even |cmd|. I don't think this was used before but would be
      useful to be started with (instead of comma you may also use a space
      as separator, whatever seems better for you)

      the word cobolfree is NOT found in 5.texi  using the kate text editor.

      I cannot see any @example  with extra text after it but there again the
      manual build would have failed.


      Program Guide typo
      https://sourceforge.net/p/gnucobol/discussion/help/thread/5b411f5725/?limit=50#7eac


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gnucobol/discussion/help/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

Anonymous
Anonymous

Add attachments
Cancel