I like stem based solutions. However assuming both file are sorted on Userid you can try :
min_l2 = 1
Do l1 = 1 to list1.0
userid1 = word(list1.l1,3)
seen = ""
Do l2 = min_l2 to list2.0 while seen = ""
userid2 = word(list2.l2,2)
Select
When userid2 > userid1 then seen = "N"
When userid2 = userid1 then seen = "Y"
Otherwise nop
End
End l2
If seen = "N" then
say userid1 "not found in list2"
min_l2 = l2 – 1 /* Already incremented ! */
End
If seen = "Y" then
min_l2 = min(l2,list2.0)
End l1
Jérôme
> Message du 08/12/09 16:58
> De : "Lizette Koehler"
> A :
> Copie à :
> Objet : How to select all by exculded info
>
>
> I have a request to take two lists and to select only those entries that do not appear in both lists.
>
> So list one contains 3 fields, the third field has a userid.
> The second list contains one field, the userid, which needs to be used against the first list.
>
> The result should only be those records that do not match the userid in the second list.
>
> I could use a double do loop but list one could be very large; so that might make it too much of a hog. I would like to run this in either BATCH or TSO Foreground.
>
> Is there a simpler way of doing a match-exclude for this process?
>
> A sample do loop might be:
>
> Do i = 1 to list1.0
> Do j = 1 to list2.0
> If userid.i = userid.j Then exit
> Else Say "USERID " userid.i " Has no match"
> End j
> End i
>
> Or I was contemplating using SAS SQL and do it that way.
>
> Any thoughts?
>
> Lizette
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
>
>
Laposte.net vous souhaite de Joyeuses Fêtes de fin d'année.
Je crée ma boîte mail www.laposte.net
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX