Subject: | |
From: | |
Reply To: | |
Date: | Fri, 12 Dec 2003 17:03:52 -0600 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
"Brian Donaldson" <[log in to unmask]> wrote:
>
> Moving "X" type fields straight into COMP fields doesn't work !
>
Actually, it's perfectly legal in COBOL to move an alphanumeric data item to
a numeric data item with COMP format. The necessary conversion from DISPLAY
format to COMP format takes place. Data is moved as if the sending operand
were described as an unsigned numeric integer. If the content of the
sending operand is not an unsigned numeric integer, the result is undefined.
So, for example, the following is legal COBOL. It displays "12,345,678".
IDENTIFICATION DIVISION.
PROGRAM-ID. COBTEST.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC X(8).
01 B PIC S9(8) COMP.
01 C PIC ZZZ,ZZZ,ZZ9.
PROCEDURE DIVISION.
BEGIN.
MOVE "12345678" TO A
MOVE A TO B
MOVE B TO C
DISPLAY C
STOP RUN.
END PROGRAM COBTEST.
Walter
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|