Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

IF NUMERIC - 2002 Standard (was: In answer to RW - again (was: Sorts (revised)
"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
news:40f39e89.131187942@news.optonline.net...
> "Chuck Stevens" <charles.stevens@unisys.com> wrote:
>
<snip>
> 
>
> That must be about packed decimal. Everything is valid in binary.
>

Not true.

The 2002 Standard *defines* the IF NUMERIC class test against a BINARY (or
COMPUTATIONAL - or PACKED-DECIMAL) field as *only* passing when the data
*matches* the PICTURE (and usage).   Therefore, an IF NUMERIC class test aga
inst
a BINARY-CHAR (new USAGE) field will (always?) pass as any bit combination
matches the USAGE (and there is NO picture clause), for a
02 Num-Field  Pic S99  Binary.

field if it as an "algebraic" (using the term loosely) value of 100 - even i
f it
"fits" in the field, it would FAIL an IF NUMERIC class test.

Personally, I was never certain this was the right way for the definition to
 be
made, but it IS what the Standard says.  Of course any compiler that support
s a
"NOTRUNC" compiler option (as most? many? do) is already running in NON-Stan
dard
mode - and can do whatever it wants with the "new" IF NUMERIC class test in 
that
environment.  It only needs to "match" the Standard when "standard  conformi
ng"
options are in effect.

--
Bill Klein
wmklein <at> ix.netcom.com



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
07-13-04 08:55 PM


Re: IF NUMERIC - 2002 Standard (was: In answer to RW - again (was: Sorts (revised)
"William M. Klein" <wmklein@nospam.netcom.com> wrote:

>The 2002 Standard *defines* the IF NUMERIC class test against a BINARY (or
>COMPUTATIONAL - or PACKED-DECIMAL) field as *only* passing when the data
>*matches* the PICTURE (and usage).   Therefore, an IF NUMERIC class test
against
>a BINARY-CHAR (new USAGE) field will (always?) pass as any bit combination
>matches the USAGE (and there is NO picture clause), for a
>     02 Num-Field  Pic S99  Binary.
>
>field if it as an "algebraic" (using the term loosely) value of 100 - even if[/colo
r]
it
>"fits" in the field, it would FAIL an IF NUMERIC class test.

Can a conforming program compare Num-Field to an out-of-range value?

If Num-Field less than 100 and greater than -100
Perform Good-Number
End-If

Would an optimizer discard the following condition and make the Perform
unconditional?

If Num-Field not greater than 99 and not less than -99
Perform Good-Number
End-If

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
07-13-04 08:55 PM


Re: IF NUMERIC - 2002 Standard (was: In answer to RW - again (was: Sorts (revised)
A conforming compiler must allow the comparisons; it could (but is not requi
red
to) allow its optimizer to make the loop unconditional WHEN running in "Stan
dard
conforming mode".  (Again, many/most compilers have a NOTRUNC - or equivalen
t
option for which these statements are NOT true).

FYI,
Also of semi-relevance are the new
HIGHEST-ALGEBRAIC
and
LOWEST-ALGEBRAIC

intrinsic functions which you may want to look at in the 2002 Standard.

--
Bill Klein
wmklein <at> ix.netcom.com
"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
news:40f40a02.158705113@news.optonline.net...
> "William M. Klein" <wmklein@nospam.netcom.com> wrote:
> 
> against 
> it 
>
> Can a conforming program compare Num-Field to an out-of-range value?
>
> If Num-Field less than 100 and greater than -100
>    Perform Good-Number
> End-If
>
> Would an optimizer discard the following condition and make the Perform
> unconditional?
>
> If Num-Field not greater than 99 and not less than -99
>    Perform Good-Number
> End-If



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
07-13-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:06 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.