• special-names?

    From Bruce Axtens@21:1/5 to All on Sat Jan 14 01:12:22 2023
    IDENTIFICATION DIVISION.
    PROGRAM-ID. ISOGRAM.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    SPECIAL-NAMES.
    ALPHABET LOWERCASE IS "abcdefghijklmnopqrstuvwxyz".
    ALPHABET UPPERCASE IS "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01 WS-PHRASE PIC X(60).
    PROCEDURE DIVISION.
    ISOGRAM.
    MOVE "my dog has fleas" TO WS-PHRASE.
    INSPECT WS-PHRASE CONVERTING LOWERCASE to UPPERCASE.
    display "ws-phrase " WS-PHRASE.
    GOBACK.

    JDoodle.com gives me

    ws-phrase _ 
     
    

    whereas tutorialspoint and onecompiler give me

    main.cobc: 14: error: 'LOWERCASE' is not a field
    main.cobc: 14: error: 'UPPERCASE' is not a field

    Is it just the way it is that I have to have my upper and lowercase case alphabets declared in working-storage for the inspect converting to work?

    Bruce

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick Smith@21:1/5 to bruce....@gmail.com on Sat Jan 14 04:39:28 2023
    On Saturday, January 14, 2023 at 4:12:24 AM UTC-5, bruce....@gmail.com wrote:
    IDENTIFICATION DIVISION.
    PROGRAM-ID. ISOGRAM.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    SPECIAL-NAMES.
    ALPHABET LOWERCASE IS "abcdefghijklmnopqrstuvwxyz".
    ALPHABET UPPERCASE IS "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01 WS-PHRASE PIC X(60).
    PROCEDURE DIVISION.
    ISOGRAM.
    MOVE "my dog has fleas" TO WS-PHRASE.
    INSPECT WS-PHRASE CONVERTING LOWERCASE to UPPERCASE.
    display "ws-phrase " WS-PHRASE.
    GOBACK.

    JDoodle.com gives me

    ws-phrase _



    whereas tutorialspoint and onecompiler give me

    main.cobc: 14: error: 'LOWERCASE' is not a field
    main.cobc: 14: error: 'UPPERCASE' is not a field

    Is it just the way it is that I have to have my upper and lowercase case alphabets declared in working-storage for the inspect converting to work?

    Bruce

    The INSPECT statement requires identifiers or literals,
    but LOWERCASE and UPPERCASE are alphabet-names.

    You could copy the literals from the ALPHABET clauses
    to the INSPECT statement or use the UPPER-CASE function.

    MOVE FUNCTION UPPER-CASE (WS-PHRASE) TO WS-PHRASE

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnold Trembley@21:1/5 to Bruce Axtens on Sun Jan 15 00:53:08 2023
    On 1/14/2023 3:12 AM, Bruce Axtens wrote:
    IDENTIFICATION DIVISION.
    PROGRAM-ID. ISOGRAM.
    ENVIRONMENT DIVISION.
    CONFIGURATION SECTION.
    SPECIAL-NAMES.
    ALPHABET LOWERCASE IS "abcdefghijklmnopqrstuvwxyz".
    ALPHABET UPPERCASE IS "ABCDEFGHIJKLMNOPQRSTUVWXYZ".


    CLASS LOWERCASE IS "abcdefghijklmnopqrstuvwxyz"
    CLASS UPPERCASE IS "ABCDEFGHIJKLMNOPQRSTUVWXYX".

    Note: Only ONE period to terminate all SPECIAL-NAMES.

    To use INSPECT the way you want, you need to define CLASSes of characters.

    ALPHABET means something entirely different, and uses standard names
    like EBCDIC, ASCII, or NATIVE.

    Rick Smith's example using COBOL intrinsic functions will also work.

    Kind regards,


    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01 WS-PHRASE PIC X(60).
    PROCEDURE DIVISION.
    ISOGRAM.
    MOVE "my dog has fleas" TO WS-PHRASE.
    INSPECT WS-PHRASE CONVERTING LOWERCASE to UPPERCASE.
    display "ws-phrase " WS-PHRASE.
    GOBACK.

    JDoodle.com gives me

    ws-phrase _ 
     
    

    whereas tutorialspoint and onecompiler give me

    main.cobc: 14: error: 'LOWERCASE' is not a field
    main.cobc: 14: error: 'UPPERCASE' is not a field

    Is it just the way it is that I have to have my upper and lowercase case alphabets declared in working-storage for the inspect converting to work?

    Bruce

    --
    https://www.arnoldtrembley.com/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)