Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Eliminating a record by comparing a field using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Eliminating a record by comparing a field using sort
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

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Sep 13, 2011 6:14 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Sep 13, 2011 8:18 pm    Post subject:
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    Post subject: See other example
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Tue Sep 13, 2011 8:56 pm    Post subject: Reply to: Eliminating a record by comparing a field using so
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 http://catb.org/~esr/faqs/smart-questions.html
or .. for a more PC language
here http://support.microsoft.com/kb/555375
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Sep 13, 2011 11:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us