Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

special-names?

37 views
Skip to first unread message

Bruce Axtens

unread,
Jan 14, 2023, 4:12:24 AM1/14/23
to
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

Rick Smith

unread,
Jan 14, 2023, 7:39:29 AM1/14/23
to
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

Arnold Trembley

unread,
Jan 15, 2023, 1:53:13 AM1/15/23
to
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/

0 new messages