Groups | Search | Server Info | Login | Register


Groups > comp.lang.cobol > #12887

Re: Using one 01 in another 01?

From docdwarf@panix.com ()
Newsgroups comp.lang.cobol
Subject Re: Using one 01 in another 01?
Date 2025-02-04 04:20 +0000
Organization Public Access Networks Corp.
Message-ID <vns4j5$4rl$1@reader2.panix.com> (permalink)
References <vns0so$1j4ho$1@dont-email.me>

Show all headers | View raw


In article <vns0so$1j4ho$1@dont-email.me>,
Bruce M. Axtens <some.one@some.where> wrote:

Let me see if I understand this correctly.


>Given
>
>       IDENTIFICATION DIVISION.
>       PROGRAM-ID. rotational-cipher.
>       DATA DIVISION.
>       WORKING-STORAGE SECTION.
>       01 WS-KEY PIC 9(2).

It used to be taught that all values in WORKING-STORAGE should be defined 
with an initial VALUE.  This would not only place the burden of 
performance on the compiler but would also insure that a 
forgotten MOVE SPACES or MOVE ZEROES wouldn't result in an undefined value 
blowing something up.

What is in PIC 9(2)?  Nobody knows.  PIC 9(2) VALUE ZEROES comes out 
bright and shiny with x'3030' or X'F0F0' every time.  That said.

>       01 WS-TEXT PIC X(128).
>       01 WS-CIPHER PIC X(128).
>       01 WS-ALPHA-LOWER PIC X(26) VALUE 'abcdefghijklmnopqrstuvwxyz'.
>       01 WS-ALPHA-UPPER PIC X(26) VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
>       01 WS-DOUBLE-UPPER PIC X(52) 
>        VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'.
>
>       PROCEDURE DIVISION.
>       ROTATIONAL-CIPHER.
>        INITIALIZE WS-CIPHER.

WS-CIPHER now contains spaces (x'20' or x'40') for 128 characters.

>        INSPECT WS-TEXT CONVERTING WS-ALPHA-LOWER TO WS-ALPHA-UPPER.

WS-TEXT has no VALUE.  Nothing has been MOVEd to WS-TEXT.  What's in 
there?  Nobody knows.

>        ADD 1 TO WS-KEY.

WS-KEY was not initialized nor was anything moved to it.  It may contain 
non-numeric data and SOC-7.

>        INSPECT WS-TEXT CONVERTING WS-ALPHA-UPPER TO 
>          WS-DOUBLE-UPPER(WS-KEY:26).
>        MOVE WS-TEXT TO WS-CIPHER.
>
>is it possible to use WS-ALPHA-UPPER in WS-DOUBLE-UPPER by making WS-
>DOUBLE-UPPER an 01 with a couple of 03 FILLERs with WS-ALPHA-UPPER as the 
>values?

It might be. but a different approach could help.  If this code were to 
run as you desired what would be the result?

DD

Back to comp.lang.cobol | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Using one 01 in another 01? "Bruce M. Axtens" <some.one@some.where> - 2025-02-04 03:17 +0000
  Re: Using one 01 in another 01? docdwarf@panix.com () - 2025-02-04 04:20 +0000
    Re: Using one 01 in another 01? Bruce Axtens <snetxa@hotmail.com> - 2025-02-05 21:54 +0800
      Re: Using one 01 in another 01? docdwarf@panix.com () - 2025-02-05 18:51 +0000

csiph-web