MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SORT sets of records of which only first meets criteria

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
djh
Beginner


Joined: 25 Jul 2006
Posts: 3
Topics: 1

PostPosted: Wed Aug 11, 2010 7:52 am    Post subject: SORT sets of records of which only first meets criteria Reply with quote

Hi

it's been a while since I did more complicated sorts and I'd be obliged for some help. (While I could write a program to get the job done, I feel this should be also possible with a SORT/SPLICE operation. Just can't figure out how.)

My infile is already sorted by
1. personnel-id (cols. 4-9) and
2. record identifier (cols. 1-3)

For every personnel-id there is just one record of type 101, plus n records of other types. Information on the department is only contained in the type 101 records (cols 10-14). Other recordtypes for that same employee might contain other kinds of information in cols 10-14.

Now if this is the infile:


    101 000001 12345
    102 000001 xyz
    103 000001 xyz
    104 000001 xyz
    105 000001 xyz

    101 000002 99999
    102 000002 xyz
    102 000002 xyz
    102 000002 xyz
    105 000002 xyz
    106 000002 xyz

    101 000003 12345
    102 000003 xyz

    101 000004 99999
    104 000004 xyz
    105 000004 xyz
    105 000004 xyz

    101 000005 12345
    103 000005 xyz
    104 000005 xyz
    109 000005 xyz
    110 000005 xyz



I want all records for each employee in department 12345, not just the 101-record. Thus giving


    101 000001 12345
    102 000001 xyz
    103 000001 xyz
    104 000001 xyz
    105 000001 xyz
    101 000003 12345
    102 000003 xyz
    101 000005 12345
    103 000005 xyz
    104 000005 xyz
    109 000005 xyz
    110 000005 xyz




as outfile.

It's easy enough to skim the infile for 101-records which belong to dpt. 12345. That would give me a list of all the personnel-ids in that department. But then what?

Any help appreciated, thx very much in advance

Dirk
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Aug 11, 2010 9:22 am    Post subject: Reply with quote

djh,


See the Smart DFSORT trick "Include or omit groups of records" which does exactly what you want.

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
djh
Beginner


Joined: 25 Jul 2006
Posts: 3
Topics: 1

PostPosted: Thu Aug 12, 2010 2:00 am    Post subject: Reply with quote

Thanks a lot, Kolusu! That was what I was looking for!
Best greetings, Dirk
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group