如何在4GL中匹配一个记录?
How to match a records in progress 4GL?
我在两个临时文件中存储了两个字符值table
CREATE tt_test1 NO-UNDO
FIELD Value_1 AS CHARACTER.
CREATE tt_test1.
ASSIGN tt_test1.Value_1 = "SBCL---DS----A3".
CREATE tt_test2 NO-UNDO
FIELD Value_2 AS CHARACTER.
CREATE tt_test2 NO-UNDO
ASSIGN tt_test2.Value_2 = "4+7+9+14,L-SA".
如果您看到 tt_test2.Value_2 是基于 tt_test1.Value_1。
即
4 = L(tt_test1.Value_1 的第 4 个字符)
7 = -(tt_test1.Value_1 的第 7 个字符)
9 = S(tt_test1.Value_1的第9个字符)
14 = A(tt_test1.Value_1的第14个字符)
所以现在我的问题是如何比较 tt_test1.Value_1 和 tt_test1.Value_2 是否匹配正确?
如果它匹配,那么我需要分配一个变量。请帮助这个案例。
您可以使用 SUBSTRING() 函数比较第 4、7、9 和 14 个字符。
类似于:
IF SUBSTRING( field1, 4, 1 ) = SUBSTRING( field2, 4, 1) and
SUBSTRING( field1, 7, 1 ) = SUBSTRING( field2, 7, 1 ) and
SUBSTRING( field1, 9, 1 ) = SUBSTRING( field2, 9, 1 ) and
SUBSTRING( field1, 14, 1 ) = SUBSTRING( field2, 14, 1 ) THEN ...
我在两个临时文件中存储了两个字符值table
CREATE tt_test1 NO-UNDO
FIELD Value_1 AS CHARACTER.
CREATE tt_test1.
ASSIGN tt_test1.Value_1 = "SBCL---DS----A3".
CREATE tt_test2 NO-UNDO
FIELD Value_2 AS CHARACTER.
CREATE tt_test2 NO-UNDO
ASSIGN tt_test2.Value_2 = "4+7+9+14,L-SA".
如果您看到 tt_test2.Value_2 是基于 tt_test1.Value_1。
即
4 = L(tt_test1.Value_1 的第 4 个字符)
7 = -(tt_test1.Value_1 的第 7 个字符)
9 = S(tt_test1.Value_1的第9个字符)
14 = A(tt_test1.Value_1的第14个字符)
所以现在我的问题是如何比较 tt_test1.Value_1 和 tt_test1.Value_2 是否匹配正确?
如果它匹配,那么我需要分配一个变量。请帮助这个案例。
您可以使用 SUBSTRING() 函数比较第 4、7、9 和 14 个字符。
类似于:
IF SUBSTRING( field1, 4, 1 ) = SUBSTRING( field2, 4, 1) and
SUBSTRING( field1, 7, 1 ) = SUBSTRING( field2, 7, 1 ) and
SUBSTRING( field1, 9, 1 ) = SUBSTRING( field2, 9, 1 ) and
SUBSTRING( field1, 14, 1 ) = SUBSTRING( field2, 14, 1 ) THEN ...