COMPUTE with negative value and unsigned destination
From: Walter Murray (wmurray_at_midtown.net)
Date: 02/10/05
- Next message: William Bub: "Re: Read and Write unknown record length? MVS"
- Previous message: James J. Gavan: "Re: Read and Write unknown record length? MVS"
- Next in thread: William M. Klein: "Re: COMPUTE with negative value and unsigned destination"
- Reply: William M. Klein: "Re: COMPUTE with negative value and unsigned destination"
- Reply: Ron: "Re: COMPUTE with negative value and unsigned destination"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 9 Feb 2005 23:16:21 -0800
2005-02-09T23:06-08:00
What does COBOL 85 (or COBOL 2002 for that matter) say about the behavior of
this program?
-----cut here-----
IDENTIFICATION DIVISION.
PROGRAM-ID. COBTEST.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 99 VALUE 23.
01 B PIC S99 VALUE -7.
PROCEDURE DIVISION.
BEGIN.
COMPUTE A = B
ON SIZE ERROR DISPLAY "SIZE ERROR"
NOT ON SIZE ERROR DISPLAY "NOT SIZE ERROR"
END-COMPUTE
DISPLAY "A = " A
STOP RUN.
END PROGRAM COBTEST.
-----cut here-----
As I read the standard, a size error condition does not exist. However, I
can't find anything that says what happens when a negative value is assigned
to an unsigned numeric data item. With a MOVE statement, it's very clear
that the absolute value is stored. I can't find where it says that for
COMPUTE.
The compiler I use displays "NOT SIZE ERROR" and "A = 07". Does the
standard actually require that? Where?
Walter
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
- Next message: William Bub: "Re: Read and Write unknown record length? MVS"
- Previous message: James J. Gavan: "Re: Read and Write unknown record length? MVS"
- Next in thread: William M. Klein: "Re: COMPUTE with negative value and unsigned destination"
- Reply: William M. Klein: "Re: COMPUTE with negative value and unsigned destination"
- Reply: Ron: "Re: COMPUTE with negative value and unsigned destination"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]