For Programmers: Free Programming Magazines  


Home > Archive > Cobol > July 2004 > IF NUMERIC (was: In answer to RW - again (was: Sorts (revised)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IF NUMERIC (was: In answer to RW - again (was: Sorts (revised)
William M. Klein

2004-07-09, 3:55 am

"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
news:40edfdf6.13861341@news.optonline.net...
> "William M. Klein" <wmklein@nospam.netcom.com> wrote:
>

<snip>
>
> Yes, it's a copy.
>
>
> My code is _more_ portable. It will work on both ASCII and EBCDIC when

expanded
> beyond the digits 0 through 9. It took some detective work to determine the
> seminal posting was asking about EBCDIC. Had it been cast as INSPECT ..
> CONVERTING, the difference wouldn't have mattered.
>


The IF NUMERIC class test is totally portable across EBCDIC, ASCII, and any
other Standard conforming environment. If you can provide an example of a
standard conforming compiler where it is NOT portable (for standard conforming
syntax), I would be most interested.

The only recent thread (that I can remember) which showed a NON-portable "class
test" was one where they used the SPECIAL-NAMES paragraph to create a user
defined class *and* they used the THRU phrase in the defintiion.

I will certainly agree that isn't portable. However, I believe that even any
user-defined class test that uses alphanumeric literals (rather than alphabet
ordinal positions) will be portable - as long as it didn't use a THRU phrase -
and would not require the creation of termporary copies of the fields to be
tested.



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


Robert Wagner

2004-07-09, 3:55 am

"William M. Klein" <wmklein@nospam.netcom.com> wrote:

>"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
>news:40edfdf6.13861341@news.optonline.net...
><snip>
test.[color=darkred]
its[color=darkred]
>expanded
>
>The IF NUMERIC class test is totally portable across EBCDIC, ASCII, and any
>other Standard conforming environment. If you can provide an example of a
>standard conforming compiler where it is NOT portable (for standard conforming
>syntax), I would be most interested.
>
>The only recent thread (that I can remember) which showed a NON-portable "class
>test" was one where they used the SPECIAL-NAMES paragraph to create a user
>defined class *and* they used the THRU phrase in the defintiion.


Yep, that's the one.

>I will certainly agree that isn't portable.


It would have been portable if it had used INSPECT. CONVERTING.


Howard Brazee

2004-07-09, 3:55 pm


On 8-Jul-2004, robert.deletethis@wagner.net (Robert Wagner) wrote:

>
> It would have been portable if it had used INSPECT. CONVERTING.


Well, there are compilers that won't do this.
William M. Klein

2004-07-09, 3:55 pm

None that are '85 conforming

--
Bill Klein
wmklein <at> ix.netcom.com
"Howard Brazee" <howard@brazee.net> wrote in message
news:ccm823$dhe$1@peabody.colorado.edu...
>
> On 8-Jul-2004, robert.deletethis@wagner.net (Robert Wagner) wrote:
>
>
> Well, there are compilers that won't do this.



William M. Klein

2004-07-09, 3:55 pm

INSPECT CONVERTING is portable - but so is a user-defined class test - that
doesn't use the THRU phrase.

As the specific case wanted to allow BOTH alphabetic and numeric items, IF
NUMERIC simply wasn't appropriate (nor would your INSPECT CONVERTING be).
Either solution would require a complete list of the individual characters to be
allowed. The class test would still avoid the problem of creating a temporary
item to inspect - which could be a problem if multiple items of different sizes
were to be tested in the same program.

--
Bill Klein
wmklein <at> ix.netcom.com
"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
news:40ee19df.21007217@news.optonline.net...
> "William M. Klein" <wmklein@nospam.netcom.com> wrote:
>
NUMERIC'?[color=darkred]
> test.
> its
code:[color=darkred]
conforming[color=darkred]
"class[color=darkred]
>
> Yep, that's the one.
>
>
> It would have been portable if it had used INSPECT. CONVERTING.
>
>



Howard Brazee

2004-07-09, 3:55 pm


On 9-Jul-2004, "William M. Klein" <wmklein@nospam.netcom.com> wrote:

[color=darkred]
> None that are '85 conforming


There are compilers that aren't '85 conforming. We got rid of our last such
program as part of Y2K, but I have had EXAMINE/INSPECT/TRANSFORM conversions.
Robert Wagner

2004-07-10, 3:56 am

"Howard Brazee" <howard@brazee.net> wrote:

>
>On 8-Jul-2004, robert.deletethis@wagner.net (Robert Wagner) wrote:
>
>
>Well, there are compilers that won't do this.


Your IBM mainframe will. Just change the syntax to TRANSFORM. It's the same
mechanism.-- the TR instruction.

Robert Wagner

2004-07-10, 3:56 am

"William M. Klein" <wmklein@nospam.netcom.com> wrote:

>INSPECT CONVERTING is portable - but so is a user-defined class test - that
>doesn't use the THRU phrase.
>
>As the specific case wanted to allow BOTH alphabetic and numeric items, IF
>NUMERIC simply wasn't appropriate (nor would your INSPECT CONVERTING be).
>Either solution would require a complete list of the individual characters to

be
>allowed.


Yes. Why is that so hard?

> The class test would still avoid the problem of creating a temporary
>item to inspect - which could be a problem if multiple items of different sizes
>were to be tested in the same program.


It could be done with ODO, but I concede your solution is more convenient -- IF
the class test works as expected. I'm skeptical of class tests. Once burned,
twice shy.

>
>--
>Bill Klein
> wmklein <at> ix.netcom.com
>"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
>news:40ee19df.21007217@news.optonline.net...
>NUMERIC'?
>code:
the[color=darkred]
>conforming
>"class
>
>


William M. Klein

2004-07-10, 3:56 pm

Again, please provide an example of any class test failing to work "as
documented" in a currently supported compiler.

I would be particularly interested if you ever reported the "problem" to the
vendor - and if so what their response was.

--
Bill Klein
wmklein <at> ix.netcom.com
"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
news:40ef2689.89796103@news.optonline.net...
> "William M. Klein" <wmklein@nospam.netcom.com> wrote:
>
> be
>
> Yes. Why is that so hard?
>
sizes[color=darkred]
>
> It could be done with ODO, but I concede your solution is more convenient --

IF
> the class test works as expected. I'm skeptical of class tests. Once burned,
> twice shy.
>
distroyed[color=darkred]
> the
any[color=darkred]
>



Howard Brazee

2004-07-12, 3:56 pm


On 9-Jul-2004, robert.deletethis@wagner.net (Robert Wagner) wrote:

>
> Your IBM mainframe will. Just change the syntax to TRANSFORM. It's the same
> mechanism.-- the TR instruction.


Actually, I did this almost 20 years ago, thinking that would solve my
portability problem for all time. I was wrong.
Howard Brazee

2004-07-12, 3:56 pm


On 12-Jul-2004, "Howard Brazee" <howard@brazee.net> wrote:

>
> Actually, I did this almost 20 years ago, thinking that would solve my
> portability problem for all time. I was wrong.


(I was actually using a Univac 9030)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com