View previous topic :: View next topic
|
Author |
Message |
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to lose the kiddie chat-speak. . . |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
any reason to repost exactly the same question ?
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|