Post
by ChinoBernardo » Thu Mar 01, 2012 9:19 pm
One way of doing it could be:
EXAMPLE CSECT
********************
* OUTPUT should contain:
* TOM DICK HARRY
********************
USING *,R15
LA R2,DATA
LOOP1 CLC 0(3,R2),KTOM
BE DONE1
LA R2,1(R2)
CLI 0(R2),C'$'
BE SKIP1
B LOOP1
DONE1 EQU *
MVC OUTPUT(3),0(R2)
SKIP1 LA R2,DATA
LOOP2 CLC 0(4,R2),KDICK
BE DONE2
LA R2,1(R2)
CLI 0(R2),C'$'
BE SKIP2
B LOOP2
DONE2 EQU *
MVC OUTPUT+10(4),0(R2)
SKIP2 LA R2,DATA
LOOP3 CLC 0(5,R2),KHARRY
BE DONE3
LA R2,1(R2)
CLI 0(R2),C'$'
BE SKIP3
B LOOP3
DONE3 EQU *
MVC OUTPUT+20(5),0(R2)
SKIP3 EQU *
LA R2,OUTPUT
SVC 209 WRITE CONSOLE MESSAGE
BR R14 EXIT
DATA DC C'AAABBBTOMCCCCDICKDDDDHARRYEEEE'
DC C'$' DELIMITER FOR COMPARE LOOP
KTOM DC CL5'TOM'
KDICK DC CL5'DICK'
KHARRY DC CL5'HARRY'
OUTPUT DC CL80' '
DC C'$' DELIMITER FOR SVC 209
R2 EQU 2
R3 EQU 3
R14 EQU 14
R15 EQU 15
END