I'm trying to load the address of a table entry into a register and then compare the first 2 positions of the table entry to a field in the input file and do further processing from there.
However, I can't seem to load the address of the table entry into the register successfully, like my textbook and different websites show. I'm not sure where to go from here, any direction would be helpful. Anything I try goes into an infinite loop, or just displays the NOTFOUND message.
Below are parts of the code.
GETREC EQU *
GET TAPEIN,MHOMEOWN
AP INCOUNT,=P'1'
AP CNT100,=P'1'
CP CNT100,=P'100'
BNE GETREC
PUT DISKOUT,MHOMEOWN
BAL R10,MNPRCS
AP OTCOUNT,=P'1'
ZAP CNT100,=P'0'
B GETREC
SPACE 1
.....
NOTFOUND EQU *
MVC P+10(40),=CL40'PAR XX - NOT FOUND IN PARDTAB'
MVC P+14(2),MPARISH
BAL R8,PRINT
DC X'FFFF'
EJECT
MNPRCS EQU *
LA R8,PARDTAB
CLC MPARISH,0(R8)
BE COUNT
BNE NOTFOUND
LA R8,3(R8)
B MNPRCS
table excerpt:
PARDTAB EQU *
DC CL2'01',CL1'3'
DC CL2'03',CL1'2'
DC CL2'04',CL1'5'
I figured out the answer to my own question. The second LA instruction in the MNPRCS loop is supposed to advance to the next line in the table in order to find a match. However, when I loop back to start the process the first LA instruction loads the table from the beginning again. So it was causing and endless loop. I changed my code to the following:
MNLOAD EQU *
LA R8,PARDTAB
MNPRCS CLC 0(2,R8),MPARISH
BE COUNT
CLC 0(2,R8),=C'..'
BE NOTFOUND
LA R8,3(R8)
B MNPRCS