I was wondering if anyone would be able to help me.
I have the following input file
01JOHN
02STEPHEN
03JIM
04ROBERT
05RYAN
06MARK
07GLEN
08WILLIAM
09BEN
10HARRY
11ALEX
12BRIAN
02STEPHEN
03JIM
04ROBERT
05RYAN
06MARK
07GLEN
08WILLIAM
09BEN
10HARRY
11ALEX
12BRIAN
It basically gives a month of the year and a person for that month.
So i have some code that works out previous month and it seems to be working ok. But what i want to do next it get the persons name beside that month.
So for april - month 04, i want to get the name robert.
I have this code so far:
READ INFILE.
PERFORM UNTIL (INPUT-MONTH = WS-PREVIOUS-MONTH) OR EOF
READ INFILE77
AT END SET EOF TO TRUE
END-READ
END-PERFORM.
MOVE INPUT-NAME TO WS-SELECT-NAME.
PERFORM UNTIL (INPUT-MONTH = WS-PREVIOUS-MONTH) OR EOF
READ INFILE77
AT END SET EOF TO TRUE
END-READ
END-PERFORM.
MOVE INPUT-NAME TO WS-SELECT-NAME.
When i display WS-PREVIOUS-MONTH is correctly displays the the previous month - 4.
However when i display the name is incorrectly displays the last name on the list.
Can any one see what is wrong with my code or suggest a way to fix this.
Many thanks.
DB