Would be possible that would help me understand the following situation:
DEFINE DATA LOCAL
TAB # 1 (A10 / 1:50)
END-DEFINE
MOVE '1111 'TO # TAB (5)
IF # TAB (*) = ’ ’
WRITE ‘XXXX’
ELSE
WRITE ‘YYYY’
END-IF
END
HE ALWAYS WRITE XXXX.
as there is an occurrence should be filled out by yyyy
If I put IF # TAB (5) works normally. He leaves to write yyyy
IF #TAB (*) = ' '
means “if any occurrence of #TAB is blank.”
Arrays can be tricky. Be very careful with negative logic:
IF #TAB(*) NE '1111'
means "If ANY occurrence of #TAB is NOT ‘1111’. In your example this would return TRUE.
IF #TAB(*) NE ' '
This would also return TRUE because occurrence 5 is not blank.
thanks for the help. problem solved
Just a warning:
As noted by Ralph
IF #TAB (*) = ’ ’ is shorthand for IF #TAB (1) = ’ ’ OR #TAB (2) = ’ ’ OR #TAB (3) = ’ ’ etc
in other words, an OR condition
HOWEVER
IF #TAB () = #OTHER-TAB () is shorthand for IF #TAB (1) = #OTHER-TAB (1)
AND #TAB (2) = #OTHER-TAB (2)
AND #TAB (3) = #OTHER-TAB (3) etc
in other words, an AND condition
And, as noted by Jerome, if you use negatives, it gets very tricky, for example
define data local
1 #a (a1/1:10)
1 #b (a1/10)
end-define
*** move ‘q’ to #a (3)
if #a () ne #b()
write ‘not equal satisfied’
else
write ‘noooooo’
end-if
end
Run as is; the answer is noooooo
now get rid of the asterisks before the MOVE.
The answer is still noooooo
For the IF to be TRUE, all a-b pairs must be not equal.
in other words it is:
IF #TAB () NE #OTHER-TAB () is shorthand for IF #TAB (1) NE #OTHER-TAB (1)
AND #TAB (2) NE #OTHER-TAB (2)
AND #TAB (3) NE #OTHER-TAB (3) etc