If it's because you have a lot of possibilities
Setup index of possible conversions and then test?
Such as
MIXED.CONV=''
MIXED.CONV<1>='N':@VM:'Y':@VM:'E'
MIXED.CONV<2>='MD2':@VM:"":@VM:'MD3'
LOCATE(REC<5>,MIXED.CONV,1;MIXED.VM) THEN
CONV=MIXED.CONV<2,MIXED.VM>
END ELSE
CONV=''
END
IF CONV='' THEN
PRINT REC<6>
END ELSE
PRINT OCONV(REC<6>,CONV)
END
Mark Johnson wrote:
I'm not looking for a programming alternate or suggestions. Just a null
conversion.
I didn't invent this situation. It's just one of the zillions of examples
that I inherit with my client's systems.
Under certain circumstances, a single data field contains multiple types of
data. This may be dependent on another field.
Thus, code like this exists:
IF REC<5>="N" THEN
PRINT OCONV(REC<6>,"MD2")
END ELSE
PRINT REC<6>
END
Sometimes both have a conversion and I do this to save typing lines:
IF REC<5>="N" THEN CONV="MD2" ELSE CONV="D2/"
PRINT OCONV(REC<6>,CONV)
So I was wondering if this 2 line example could apply to the first example.
Thanks in advance.
(P.S. I wonder how off-topic or deviated this thread will go. I'm just
looking for a null conversion)
OK, I'll bite.
How does one find a situation where one wants this?
From: Mark Johnson
Is there an OCONV method that does nothing, ie IF
X=OCONV(X,CONV) THEN TRUE.
I've had a situation where I could use this before and one
crept up today.
How does one find MORE THAN ONE situation where one wants this?
How about if YOUR CONV variable is an empty string?
I *think* that for all X, ( X EQ OCONV( X, '' ) ) will evaluate to
true.
If that isn't the case, you could write your own "user exit":
SUB DONOTHING( STR.OUT, STATUS.OUT, STR.IN, I.OR.O.IGNORE )
STATUS.OUT = 0
STR.OUT = STR.IN
RETURN
CATALOG BP $DONOTHING (ideal-flavor cataloguing, not pick-flavor)
( X EQ OCONV( X, 'UDONOTHING' ) ) will always be true.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/