Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
There was a topic, here, which started out with wrong results from an Easytrieve program and looked for a DFSORT solution, which was duly provided.
Here is an Easytrieve solution.
There is some confusion over exactly the sequence that is to be checked, but this is code for three-character-alphanumeric. The sequce is A-Z then 0-9 in three positions.
The "instream table" can be readily amended for numeric-only, alpha-only, groups of letters, or various mixtures, even "special characters" as long as they are in "collating" sequence - depending on the requirement,
I've typed as carefully as I can. Unfortunately I have no current access to Easytrieve, so can't test the program (it is desk-checked) or confirm that it compiles.
Code:
FILE MSSB FB (80 , 0)
MS-BRCH 03 03 A
MS-BRCH-CHAR-1 MS-BRCH 1 A
MS-BRCH-CHAR-2 +1 MS-BRCH 1 A
MS-BRCH-CHAR-3 +2 MS-BRCH 1 A
FILE REP1 FB (50 , 0)
REP-START-BR 02 03 A
REP-END-BR 12 03 A
*
FILE NXTCHAR TABLE INSTREAM
ARG 1 1 A
DESC 3 1 A
A B
B C
C D
D E
E F
F G
G H
H I
I J
J K
K L
L M
M N
N O
O P
P Q
Q R
R S
S T
T U
U V
V W
W X
X Y
Y Z
Z 0
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 A
ENDTABLE
W-FIRST-BRANCH-IN-SEQUENCE W 3 A
W-NEXT-BRANCH-VALUE W 3 A
W-NBV-CHAR-1 W-NEXT-BRANCH-VALUE 1 A
W-NBV-CHAR-2 W-NEXT-BRANCH-VALUE +1 1 A
W-NBV-CHAR-3 W-NEXT-BRANCH-VALUE +2 1 A
W-LAST-BRANCH-IN-SEQUENCE W 3 A
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hi Bill,
New Year is quite a slow time on the forum. . .
It is several minutes before midnight here and i've put myself at the keyboard with the phone in reach. Usually, several calls come in between now and 12:15-12:30.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Now even, even, prettier and desck-checked again.
The program can be easily arranged without the "GO TO JOB"s. The proc-numbering doesn't have much benefit in small programs (but nor in Cobol, either).
The program could even be adjusted for arbitrary, non-collating, sequences without enormous effort.
Code:
FILE MSSB FB (80 , 0)
MS-BRCH 03 03 A
MS-BRCH-CHAR-1 MS-BRCH 1 A
MS-BRCH-CHAR-2 +1 MS-BRCH 1 A
MS-BRCH-CHAR-3 +2 MS-BRCH 1 A
FILE REP1 FB (50 , 0)
REP-START-BR 02 03 A
REP-END-BR 12 03 A
*
FILE NXTCHAR TABLE INSTREAM
ARG 1 1 A
DESC 3 1 A
A B
B C
C D
D E
E F
F G
G H
H I
I J
J K
K L
L M
M N
N O
O P
P Q
Q R
R S
S T
T U
U V
V W
W X
X Y
Y Z
Z 0
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 A
ENDTABLE
W-FIRST-BRANCH-IN-SEQUENCE W 3 A
W-NEXT-BRANCH-VALUE W 3 A
W-NBV-CHAR-1 W-NEXT-BRANCH-VALUE 1 A
W-NBV-CHAR-2 W-NEXT-BRANCH-VALUE +1 1 A
W-NBV-CHAR-3 W-NEXT-BRANCH-VALUE +2 1 A
W-LAST-BRANCH-IN-SEQUENCE W 3 A