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
 

 

Need to Remove the repeated values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Tue Aug 12, 2008 10:19 am    Post subject: Need to Remove the repeated values
Reply with quote

Hi All,
I Need to remove the repeated values, will explain you with an example


Example :

input File

PrNo Duplicates

3839 Duplicates of 3841 3856 3879
3840 No Duplicates
3841 Duplicates of 3839 3856 3879
3842 Duplicates of 3853 3865
3843 No Duplicates
......
3853 Duplicates of 3842 3865
3854 Duplicates of 3855
3855 Duplicates of 3854
3856 Duplicates of 3839 3841 3879
......
3865 Duplicates of 3842 3853
..........

Need an output file like this

Output File

PrNo Duplicates

3839 Duplicates of 3841 3856 3879
3840 No Duplicates
3842 Duplicates of 3853 3865
3843 No Duplicates
3854 Duplicates of 3855


The Record length of the file is 105 and Format FB

Size:

PrNo - length 5
Duplicates - length 34 (Txt(Duplicates of and No duplicates) is 14, Remaining 20 (it can hold max of 4 Duplicate PrNo))
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 Aug 12, 2008 7:40 pm    Post subject:
Reply with quote

Hello,

Please clarify why this was considered a duplicate?

3841 Duplicates of 3839 3856 3879

I'd recommend a better description of the rules to go with the example files.
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Tue Aug 12, 2008 8:13 pm    Post subject: Reply to: Need to Remove the repeated values
Reply with quote

Hi Dick,

The remaing fields in the input file has the same value, so it is considered as duplicates
example:

PrNO PoNo StoreNo Duplicates
3839 1234 9898 Duplicates of 3841 3856 3879
3841 1234 9898 Duplicates of 3839 3856 3879
3856 1234 9898 Duplicates of 3839 3841 3879
3879 1234 9898 Duplicates of 3839 3841 3856

so the PrNo which has the same PoNo and StoreNo are considered as duplicate one to other.
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 Aug 12, 2008 10:05 pm    Post subject:
Reply with quote

Hello,

How did PoNo and StoreNo come into the equation?

You need to provide a much more clear definition of the "rules" you want implemented.

SOmeone may make a lucky guess, but it would be better to have a more clear descriptoin of what you want to do.
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Thu Aug 14, 2008 6:26 pm    Post subject: Reply to: Need to Remove the repeated values
Reply with quote

Hi Dick,
sorry for late reply...

I am retrieving details from a table and if the set of PoNo StoreNo is present for more than one PrNo then in oputput i will write that one PrNo is duplicate to another, finally my output file is like below, in that i don't need a repeated values,


PrNO PoNo StoreNo Duplicates
3839 1234 9898 Duplicates of 3841 3856 3879
3841 1234 9898 Duplicates of 3839 3856 3879
3856 1234 9898 Duplicates of 3839 3841 3879
3879 1234 9898 Duplicates of 3839 3841 3856
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 14, 2008 7:23 pm    Post subject:
Reply with quote

Hello,

Quote:
if the set of PoNo StoreNo is present for more than one PrNo then in oputput i will write that one PrNo is duplicate to another


Instead of writing duplicates and then eliminating, is it possible to write only unique "PoNo StoreNo" set into the output file.?

Thanks,
Arun
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: Thu Aug 14, 2008 11:51 pm    Post subject:
Reply with quote

Hello,

I must be wearing my slow brain this week . . . icon_redface.gif

How were these records created? Why were they created? How is th output to be used?

Is it possible that the "duplicates" field need not even be used for this process? Is what is really needed the lowest PrNO of those records that all contain the same PoNo and StoreNo?
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Mon Aug 18, 2008 6:56 pm    Post subject:
Reply with quote

Hi,

I will explain what my program does,

Table 1
Pr No
3839
3840
3841
3842
3853
3856
3865
3879

Table 2
Pr No PoNo StoreNo
3839 1234 9898
3840 1222 9899
3841 1234 9898
3842 2233 5566
3853 2233 5566
3856 1234 9898
3865 2233 5566
3879 1234 9898


First i will take first PrNo from Table 1 and check if it is present in Table 2 or not, If it is present then i'll take the corresponding PoNo, StoreNo of that PrNo from Table 2 and search if that pair of PoNo and Store no is present for any other PrNo (in table @ itself), if so i'll write that PrNo is duplicate of the first one (which i taken from Table 1), so this will continyue for all Prno present in Table 1.

for ex:

first i take 3839 from table 1 and search it in Table 2 and take corresponding PoNo and StoreNo and search if it is present for any other PrNo, same is present for 3856 and 3879, in the output i will write 3856 and 3879 are duplicates of 3839.

like wise for 3856 i'll write 3839 and 3879 are duplicates of 3856..



thanks
balukanna
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Aug 18, 2008 7:16 pm    Post subject:
Reply with quote

balukanna,

Are you using the file written in the above manner anywhere else?

If not, you could slightly change the logic of the code to write only the first PrNo,PoNo,StoreNo always if you have duplicates. Are the tables mentioned DB2 tables?

Thanks,
Arun
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Mon Aug 18, 2008 7:23 pm    Post subject:
Reply with quote

Hi Arun,

The tables are DB2 tables only, i found difficult on changing the code to write only the first PrNo, PoNo, StoreNo when there is duplicates,
So i thought it will be done through sort.

Thanks
balukanna
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Aug 18, 2008 7:49 pm    Post subject:
Reply with quote

balukanna,

Quote:
if so i'll write that PrNo is duplicate of the first one (which i taken from Table 1)


In stead of writing into output, you could save these values in some ws-table. Every time if you find a match in the two DB2 tables, you can search this ws-table and skip the PrNo if present.

Thanks,
Arun
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Mon Aug 18, 2008 7:56 pm    Post subject:
Reply with quote

Arun,

Your solution is possible, but the table consist of morethan a lakh of records,
if i found first duplicate and moved it to a WS_TABLE (ex:PrNo 31000) and i may get duplicate of that in (Prno 98000), there may be many combination of duplicate reside in between this, thats why i told i found difficult on changing the code.


Thanks
balukanna
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Aug 18, 2008 8:13 pm    Post subject:
Reply with quote

Code:
PrNO PoNo StoreNo Duplicates
3839 1234 9898 Duplicates of 3841 3856 3879


Can you post here the layout of the input records?

Thanks,
Arun
Back to top
View user's profile Send private message
Garry Carroll

Active Member


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

PostPosted: Mon Aug 18, 2008 8:48 pm    Post subject:
Reply with quote

From what I think I'm seeing, how about....


Code:

//SORT1 EXEC PGM=SORT                                   
//SYSOUT DD SYSOUT=*                                   
//SORTIN DD DSN=your.input.file,DISP=SHR
//SORTOUT DD DSN=&&interim,disp=(,pass),DCB=...
//SYSIN DD *
* Drop Duplicates of                                             
 SORT FIELDS=(6,8,ZD,A)
 SUM FIELDS=NONE                                         
/*
//*
//SORT2 EXEC PGM=SORT                                   
//SYSOUT DD SYSOUT=*                                   
//SORTIN DD DSN=&&interim,DISP=(old,pass)
//SORTOUT DD DSN=your.output.file,....
//SYSIN DD *
* Sort into ascending order                                           
 SORT FIELDS=(1,4,ZD,A)
/*                                   
                                             


... though there's probably a slicker way to do it...

Garry
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Aug 18, 2008 8:59 pm    Post subject:
Reply with quote

Check out the below ICETOOL job.

Code:
//STEP00   EXEC PGM=ICETOOL               
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG   DD SYSOUT=*                   
//IN       DD DSN=YOUR.INPUT.FILE,DISP=SHR
//OUT      DD SYSOUT=*                   
//TOOLIN DD *                             
SELECT FROM(IN) TO(OUT) ON(6,9,CH) FIRST 


(6,9,CH) is your "PoNo StoreNo" field

Thanks,
Arun
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: chennai

PostPosted: Mon Aug 18, 2008 9:28 pm    Post subject:
Reply with quote

Hi Garry/Arun,

Thanks a lot... its working fine...

As i focussed to do sorting with the datas from Duplicates column, it seems little difficult, now with your solutions, doing sorting with the datas from PoNo,StoreNo, the work is made easier and giving the desired output..

Thanks
balukanna
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 Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


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