Either of the following two [effectively identical] SQL statements
requested, after issuing OVRDBF SS TOFILE(TheLib/TheFile) MBR(TheMbr)
OVRSCOPE(as_required), will perform a request to "find a line containing
X which is not followed by a line containing Y or Z."
The RRN() is used because the increment for SRCSEQ is unknown, as is
the uniqueness of SRCSEQ values. If the member were known to have been
reorganized with SRCOPT(*SEQNBR) SRCSEQ(1.00 1.00) and not since
changed, the RRN() could be replaced with SRCSEQ.
select rrn(r1),r1.*,rrn(r2),r2.*
from ss r1
inner join ss r2
on rrn(r1) = rrn(r2) - 1
and r1.srcdta like '%X%'
where r2.srcdta not like '%Y%'
and r2.srcdta not like '%Z%'
select rrn(r1),r1.*,rrn(r2),r2.*
from ss r1
inner join ss r2
on rrn(r1) = rrn(r2) - 1
and r1.srcdta like '%X%'
where locate('Y', r2.srcdta)=0
and locate('Z', r2.srcdta)=0
Invoked as a [an effective] function against each desired
file.member, the select could be adjusted to return the first RRN(R1).
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.