Re: Data Name = to more than one number
From: Howard Brazee (howard_at_brazee.net)
Date: 02/10/04
- Next message: Howard Brazee: "Re: Data Name = to more than one number"
- Previous message: Chuck Stevens: "Re: Data Name = to more than one number"
- In reply to: KL: "Data Name = to more than one number"
- Next in thread: James: "Re: Data Name = to more than one number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 10 Feb 2004 15:36:33 GMT
On 9-Feb-2004, klbjornme@aol.com (KL) wrote:
> I need to know how to code when I have a data name that I want to use
> in an IF statement, but make it equal to more than one number. Is
> there an easier way to do this, other than the way I have in the
> following?
>
> IF ORDER-ITEM-SERIES = '1' OR ORDER-ITEM-SERIES ='2'
> PERFORM FIRST-DISC
> ELSE
> IF ORDER-ITEM-SERIES = '3' OR ORDER-ITEM-SERIES = '4'
> ORDER-ITEM-SERIES = '5'
I don't know what you mean by "easier".
I typically format that code (If I were to write it) as follows:
IF ORDER-ITEM-SERIES = '1'
OR ORDER-ITEM-SERIES ='2'
PERFORM FIRST-DISC
ELSE
IF ORDER-ITEM-SERIES = '3'
OR ORDER-ITEM-SERIES = '4'
OR ORDER-ITEM-SERIES = '5'
PERFORM SECOND-DISC
END-IF
END-IF.
The reason I do what I do is to facilitate adding conditions, commenting out
conditions, un-commenting out conditions, etc. It is also easy to see parallel
conditions.
Some people do this:
IF ORDER-ITEM-SERIES="1' or '2'
This requires less typing, and is pretty clear. It doesn't allow me to comment
out a condition.
Some people do this:
IF ORDER-ITEM-SERIES='1' OR
ORDER-ITEM-SERIES='2'
This appears parallel, but commenting out conditions is a bit more work than
putting the OR parallel with the IF.
That said - for this particular coding need, I would have used an EVALUATE
statement. I'm assuming your code was illustrative rather than real -
otherwise I don't know why anybody wouldn't use EVALUATE here.
- Next message: Howard Brazee: "Re: Data Name = to more than one number"
- Previous message: Chuck Stevens: "Re: Data Name = to more than one number"
- In reply to: KL: "Data Name = to more than one number"
- Next in thread: James: "Re: Data Name = to more than one number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|