For Programmers: Free Programming Magazines  


Home > Archive > Cobol > January 2008 > Re: checking if NUMERIC









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 Re: checking if NUMERIC
Clark F Morris

2008-01-27, 9:57 pm

On Sun, 27 Jan 2008 13:34:41 +1300, "Pete Dashwood"
<dashwood@removethis.enternet.co.nz> wrote:

>
>
>"Clark F Morris" <cfmpublic@ns.sympatico.ca> wrote in message
> news:5phnp39cnk3nd7vc4nsi2flb4psm9emmco@
4ax.com...
>
>I started with COBOL 61 as well :-) You forgot to mention that, prior to the
>introduction of PICTURE, data was defined with SIZE, CLASS, and *USAGE*
>clauses.


I forgot about USAGE or the RCA 301 compiler didn't have it since
everything was 6 bit characters.
>
>
>Yep, me too... and it very often was :-)
>
>
>Well, I did it similarly, ensuring the input record was defined with what
>was required, but then testing each supposedly numeric field in an AN field.
>If they all passed, it was safe to proceed. My programs did this stuff in a
>VALIDATE-INPUT SECTION. It worked pretty well and I seldom had 0c7 crashes
>caused by bad input (usually it was bad programming... Ah, happy days, when
>we were learning...:-))


I used the numeric descriptions because the results would be different
depending on whether the field could be signed. The expectations are
different and thus the description of the field as expected is needed.
This would be true even with sign is separate.
>
>
>Maybe. The problem was that with packed fields as soon as you tried to use
>them, you'd crash with 0c7. It therefore was better to ensure that what you
>stored there was valid...


Actually with the 360 DOS COBOL (or one of its successors) the move
could bomb out because they generated a gratuitous Zero Add Packed for
at least some signed fields and I seem to recall some moves to
unsigned fields generated Zero Add Packed, Or Immediate.
>
>
>Pete.

Sponsored Links







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

Copyright 2008 codecomments.com