CASE syntax

Greetings,
Whilst using a CASE ststement can my conditions contain BEGINS, if it can what would the syntax be?
I wish to do along the lines of this,
case cust_num:
when cust_num Begins 013
do
block to execute
end

when cust_num begins 012
do
block to execute
end
end case.
This is not exact syntax just an idea of my objective, is it possible in the 4 gl?
TIA
 
mpowell_esq said:
Greetings,
Whilst using a CASE ststement can my conditions contain BEGINS, if it can what would the syntax be?
I wish to do along the lines of this,
case cust_num:
when cust_num Begins 013
do
block to execute
end

when cust_num begins 012
do
block to execute
end
end case.
This is not exact syntax just an idea of my objective, is it possible in the 4 gl?
TIA

Maybe you could try:

Code:
case substring(cust_num,1,3):
 
when '012'.....
when '013'...
 
end case.

Or you could do it with a if then else block:

Code:
if c begins '012' then .....
else if c begins '013' then ....
else if.....

Casper.
 
Casper said:
Maybe you could try:

Code:
case substring(cust_num,1,3):
 
when '012'.....
when '013'...
 
end case.
Or you could do it with a if then else block:

Code:
if c begins '012' then .....
else if c begins '013' then ....
else if.....
Casper.
The first is better and faster. :)
 
Back
Top