This may be of use, it should detect when a new member has been located.
IF SUBSTR(mydata,1,7) = "MEMBER:" THEN DO
your code here to extract member data
END
ELSE DO
your code to handle input that doesn't include a member
END
Note I don't have the means to run and check this, so treat it as a guide. Also mydata is the current line of input data
As per comment I found some Rexx. Here's one that shows EXECIO and compound variables being used to process input data (Note that this is designed to be run in batch with //INPUT01 DD inputdataset,DISP=SHR
for the input data).
Here's the Code :-
/* REXX - OPCDLYMN */0000100
/*--------------------------------------------------------------------*/0001000
/* OPC/ESA Log Monitor */0002000
/*--------------------------------------------------------------------*/0003000
OPCDLYMN: 0003100
rec_count = 0 0003200
Do Forever 0004000
"EXECIO 1 DISKR INPUT01 (STEM In.)" 0004100
If rc ¬= 0 Then Leave 0004200
rec_count = rec_count + 1 0004300
If Substr(in.1,17,8) = "EQQE007I" Then Do 0004400
eqqe007i_typ = Substr(in.1,26,4) 0004420
eqqe007i_dly = Strip(Substr(in.1,83,9)) 0004430
eqqe007i_day = Substr(in.1,2,2) 0004440
eqqe007i_mon = Substr(in.1,5,2) 0004450
eqqe007i_dat = eqqe007i_day"/"eqqe007i_mon 0004460
eqqe007i_tim = Substr(in.1,8,8) 0004470
eqqe007i_hr = Substr(eqqe007i_tim,1,2) 0004480
eqqe007i_min = Substr(eqqe007i_tim,4,2) 0004490
eqqe007i_sec = Substr(eqqe007i_tim,7,2) 0004500
If eqqe007i_typ = "ALL " Then do 0004520
Say Right(eqqe007i_dly,9)" delays on "eqqe007i_dat||, 0004540
" at "eqqe007i_tim 0004550
End 0004560
End 0004600
End 0005000
Say "End of processing "rec_count" records processed" 0006000
In. is the STEM IN.1 is a compound variable, based upon the stem.
Note you can use "EXECIO * DISKR INPUT01 (STEM in.)"
, which would read in all data (I think In.0 would then hold the count and In.1, In.2... to nn (where nn is, I think, the value held by in.0)). However, this can(could) result in memory issues. Hence, why I generally read in individual lines.
Note In If rc ¬= 0 Then Leave
the character before = (ie ¬) is not always available (mainly UK keyboards I think). Instead you can use /= (NOT EQUALS).
So this program reads in all the data line by line until there is no more (rc is set by EXECIO to non-zero. if there is an error such as end of data).
rec_count is incremented so records the number of records read.
If the 17th to 24th characters are EQQE007I then the lines is further processed, otherwise another iteration of the DO Loop is started.
The procsessing undertaken then is similar in that various parts of the input line are extracted. If ALL (with a following space) exists at character 26-29 then information is out via Say (goes to SYSOUT or SYSPRINT if I recall correctly).
If you adapt this, then you'd likely need to make a copy of the current line for comparison in the next iteration.
Final Note the 7 numerics to the right of each line aren't part of the code.