IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Eliminating a record by comparing a field using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkat.bmw
Warnings : 2

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Tue Sep 13, 2011 6:04 pm
Reply with quote

Hi,

I have input like shown below

032MOM07400648UFOR0060 000302 011250069U 011250069U A
032MOM07400648UFOR0060 000303 011250069U 011250069U B
032MOM07400648UFOR0060 000303 011250069U 011250069U C

Output should be A and C record (see last field of record i.e., A,B and C)

I need to compare three records with fields like " 011250069U" and " UFOR0060" and if it contains A , B and C .. I need to eliminate B record..

Is this possible in sort ??
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Sep 13, 2011 6:14 pm
Reply with quote

Yes, but you need to give more information. What is the RECFM and LRECL of the file? Are the two fields in fixed positions? Can the " 011250069U" and " UFOR0060" be in either position, if fixed? Do both fields have to exist in the record for the 'B' record to be eliminated?

Garry.
Back to top
View user's profile Send private message
venkat.bmw
Warnings : 2

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Tue Sep 13, 2011 6:27 pm
Reply with quote

Record length is 80 and Fixed and also both fields will exist for 'B' record

See below set of record

Code:
032MOM07400648UFOR0060  000302    011250069U   011250069U  A
032MOM07400648UFOR0060  000303    011250069U   011250069U  B
032MOM07400648UFOR0060  000303    011250069U   011250069U  C
032MOM07400648UFOR0070  012903    46242EL010   46242EL010  A
032MOM07400648UFOR0070  012904    46242EL010   46242EL010  B
032MOM07400648UFOR0080  013002    46242EM05A   46242EM05A  A
032MOM07400648UFOR0080  013003    46242EM05A   46242EM05A  B
"Code'd"

i shd compare the field "011250069U" and "UFOR0060" . IF A,B,C records are same then B shd elimate

if i compare the field "46242EL010" and " UFOR0070" ..only A,B are present ..so no elimination.. same procedure for "46242EM05A" and "UFOR0080"
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 13, 2011 8:18 pm
Reply with quote

Hello,

You need to lose the kiddie chat-speak. . .
Back to top
View user's profile Send private message
venkat.bmw
Warnings : 2

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Tue Sep 13, 2011 8:40 pm
Reply with quote

Hi,

Consider below input dateset with fixed length of 80
Code:

name | number | empcode |empgrade
jim      1          122         x
jim      1          122         y
jim      1          122         z
sam      2          133         x
sam      2          133         y
kimby    3          144         x
kimby    3          144         y   
kimby    3          144         z


i need to compare records by name & empcode and if it matches and contains x,y,z empgrades then i have to remove record with empgrade "y"

Output should be
Code:

name | number | empcode |empgrade
jim      1          122         x
jim      1          122         y
sam      2          133         x
sam      2          133         y
kimby    3          144         x
kimby    3          144         y   

Any ideas ??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 13, 2011 8:56 pm
Reply with quote

any reason to repost exactly the same question ? icon_evil.gif
the data is different but the concept is the same...

to make the most out of the questions You ask and to forecast the comments You might receive
it would be wise for You to read and meditate on
how to ask questions the smart way
here catb.org/~esr/faqs/smart-questions.html
or .. for a more PC language
here support.microsoft.com/kb/555375
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Sep 13, 2011 11:16 pm
Reply with quote

Eagar,

You haven't really given a complete explanation of what you're trying to do.

Is the key just the name, or is it the name, number and empcode?
For example, if the second jim record had 4 as the number instead of 1, what would you want for output?

Do you always have three or less records for each key? Can the empgrade field only be x, y or z? Can you only have 0 or 1 x per key? Can you only have 0 or 1 y per key? Can you only have 0 or 1 z per key?

If you do a better job of explaining the rules for what you want to do and showing a complete example of the various posssible input cases and expected output, then I can try to help you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top