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 logic for multirecord value checking

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


Joined: 01 Jun 2012
Posts: 18
Topics: 7

PostPosted: Tue Oct 13, 2015 3:40 am    Post subject: SORT logic for multirecord value checking Reply with quote

Hi
How to write logic checking for multiple records?

I have input file in this format with these 3 fields - EMPNO EMPTYPE Description. Each EMPNO can have 3 types of datatypes - type-1,type-2,type-3. It means it can have 3 records with 3 data types. If type-1, type-2 and type-3 records present, then write only type-1 record to output file. If type-2 and type-3 records present, then write type-2 record to output file. if type-3 record only present, then write type-3 record to output file.

Sample data is:

10 TYPE-1 TYPE-1-RECORD
10 TYPE-2 TYPE-2-RECORD
10 TYPE-3 TYPE-3-RECORD
20 TYPE-2 TYPE-2-RECORD
20 TYPE-3 TYPE-3-RECORD
30 TYPE-2 TYPE-3-RECORD
40 TYPE-1 TYPE1-RECORD

OUTPUT FILE:
10 TYPE-1 TYPE-1-RECORD
20 TYPE-2 TYPE-2-RECORD
30 TYPE-3 TYPE-3-RECORD
40 TYPE-1 TYPE-1-RECORD

Thanks
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Oct 13, 2015 5:17 am    Post subject: Reply with quote

Is is possible that there is a TYPE-2-RECORD only? What do you want then?

Have a look at ICETOOL's SELECT operator. At the moment you are asking for the first record for the key.
Back to top
View user's profile Send private message
SRI123
Beginner


Joined: 01 Jun 2012
Posts: 18
Topics: 7

PostPosted: Tue Oct 13, 2015 5:26 am    Post subject: Reply with quote

Yes only TYPE-2 record can be possible, then only TYPE-2 rec need to be written.

Is it possible thru DFSORT?
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Oct 13, 2015 5:39 am    Post subject: Reply with quote

It would be possible through DFSORT, but what is the problem with using ICETOOL (which you have if you have DFSORT)?

For DFSORT, you could look at a MERGE on your key, with a single input DD (SORTIN01) and OPTION EQUALS, then SUM FIELDS=NONE.

Or you could code that out yourself, appending a SEQNUM with a RESTART on your key, and on OUTFIL have INCLUDE= for a value of one on the sequence number and a BUILD to return the record to it's original size.
Back to top
View user's profile Send private message
SRI123
Beginner


Joined: 01 Jun 2012
Posts: 18
Topics: 7

PostPosted: Wed Oct 14, 2015 1:33 am    Post subject: Reply with quote

Thank you Got desired result
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