DFSORT——前三位不等于0(COMP-3, COMP)

来源:互联网 发布:有赞微商城 源码 编辑:程序博客网 时间:2024/06/08 00:53

Requirement: The first 3 not equal to 0


(1) 01 WS-A PIC S9(09) COMP-3.
Analysis:
S9(09) COMP-3, X'000000', range is 999999999- and 999999999+
Check the 3 leftmost digits, then the range will be 000000999- and 000000999+

There are 2 solutions here:
1. COND=(1,5,PD,LT,-000000999,OR,1,5,PD,GT,+000000999)
2. COND=(1,2,PD,NE,0,AND,3,2,PD,NE,0,AND,5,2,PD,NE,0)

(2) 01 WS-B PIC S9(09) COMP.
Analysis:
S9(09) COMP, X'F0F0F0'

1. COND=(1,2,EQ,X'F0',AND,3,2,EQ,X'F0',AND,5,2,EQ,X'F0')