× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



--- "Stone, Joel" <StoneJ@xxxxxxxxxxxxxxxx> wrote:
> Actually I think your RPG test is not reliable.  I think that TESTN will let
> certain non-numerics slip through, only to explode sometime later (probably
> in the middle of the night)!
> 
> In RPG it is much safer to use '0123456789' CHECK  variable_name to ensure
> numerics.
> 
> In COBOL, if you only want to test the first part of a field, try
> 
> If VNCOMPANY (1:4) is numeric
>    move VNCOMPANY to ws-vnd-company
> else
>    move zeros     to ws-vnd-company
> end-if. 

Thanks Joel.  The idea behind TESTN is that you have a value in an alpha field 
that can be safely
moved into a numeric field without triggering a DDE.  Once TESTN blesses the 
value and it is moved
into the numeric field, that's when we would test for negative values.  But I 
like your idea using
the CHECK, I'll tuck that one away for next time.

Your example using the "end-if".  Is that essentially a no-op?  Does it provide 
any more function
than if you'd just put the period at the end of the previous statement?  One of 
the things I'm
still trying to get comfortable with in Cobol is the idea that you can have 
multiple IF's in one
statement.  (As opposed to RPG, every IF has its own ENDIF.)  What about nested 
IF's?  Does Cobol
support that?  (My brief exposure to Cobol 20 years ago left me with the 
impression that the way
to accomplish that is to break it up into more sub-procedures.)

TIA, Dan

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.