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
 

 

Input file that also contains duplicates based on a key

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

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Tue Mar 16, 2010 1:42 am    Post subject: Input file that also contains duplicates based on a key
Reply with quote

Hi,

I have an input file that also contains duplicates based on a key. The output should include

a) records having no duplicates
b) 1st record of the duplicate having an identifier

INP FILE

234
123a
234a
343
123

key starts from pos 1 and length = 3
identifier starts from pos 4 and value is 'a' always

OUTPUT FILE

123a
234a
343

How can this be achieved using icetool?
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 Mar 16, 2010 1:56 am    Post subject:
Reply with quote

Your "rules" are not clear and you haven't shown enough input record cases to make it clear.

What is the RECFM and LRECL of the input file?

Here's a better set of input records - show your expected output records and explain the rules for getting from input to output more completely.

Code:

234
123a
234a
343
123
111
111a
111
222
333a
444a
444
555
666
666a
666
777
777a
777a
888a
888a
999
999
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Wed Mar 17, 2010 8:01 pm    Post subject:
Reply with quote

Sorry about the delay

output should look something like this
111a
234a
343
123a
222
333a
444a
555
666a
777a
888a
999

Rule 1- If there are more than 1 record for the key (first 3 characters), write only that record which does not have spaces.
Rule 2 - it should be in the same order as the input file
Lets say LRECL = 4 bytes and its FB.

I think I have figured it out as to how to get the records but in sorted order. It goes something like this

Code:

//SORT03   EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD  DSN=INFILE,                         
//             DISP=SHR                                         
//OUT      DD  DSN=OUTFILE,                         
//             DISP=(NEW,CATLG,DELETE),
...............   
//XSUM     DD  DSN=XSUM,                   
//             DISP=(NEW,CATLG,DELETE),
....................     
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(OUT) ON(01,03,CH) -                       
  FIRST USING(CTL1) DISCARD(XSUM)
//CTL1CNTL  DD *                         
  SORT FIELDS=(01,03,CH,A,04,01,CH,D)     
  OUTFIL FNAMES=OUT,BUILD=(01:01,04)     
  OUTFIL FNAMES=XSUM,BUILD=(01:01,04)   
/*
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Thu Mar 18, 2010 12:32 am    Post subject:
Reply with quote

Not sure how to get it in the same order as the input file
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: Thu Mar 18, 2010 1:10 am    Post subject:
Reply with quote

What is "it"? The OUT file? The XSUM file? Both?

Please show the EXACT output you want for the input records I showed.
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Fri Mar 19, 2010 6:57 pm    Post subject:
Reply with quote

it = OUT file
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Fri Mar 19, 2010 6:58 pm    Post subject:
Reply with quote

and the output showed for your input is the way I would like to have the output data(OUT)
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: Fri Mar 19, 2010 10:37 pm    Post subject:
Reply with quote

Still not clear. For my input example of:

Code:

234
123a
234a
343
123
111
111a
111
222
333a
444a
444
555
666
666a
666
777
777a
777a
888a
888a
999
999


Show the exact output you want for the OUT and XSUM data sets.

(I don't have time to guess what you want.)
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Fri Mar 19, 2010 11:51 pm    Post subject:
Reply with quote

OUT:

234a
123a
343
111a
222
333a
444a
555
666a
777a
888a
999


I know you are really busy and I do appreciate the fact you are helping me out. Infact you & this forum has helped me a lot.

Hope this helps!!!!!
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: Sat Mar 20, 2010 1:24 am    Post subject:
Reply with quote

Let me make sure I understand. You want the output in the original order of the input keys, not the input records ... right?

234
123a
234a

The two output records you want are 234a and 123a which are in the order of the keys (234, 123), not the order of the input records (123a, 234a). That could be tricky.

Would you settle for this output order instead (the order of the input records kept for output):

Code:

123a     
234a     
343       
111a     
222       
333a     
444a     
555       
666a     
777a     
888a     
999       


That would be easier.

Also, you don't show what you want for XSUM. Do you actually want XSUM?
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Sun Mar 21, 2010 8:35 am    Post subject:
Reply with quote

Nope I am not concerned about XSUM. Well if you could show me how one can get the output as you shown, it will be great
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: Mon Mar 22, 2010 10:38 pm    Post subject:
Reply with quote

Quote:
if you could show me how one can get the output as you shown, it will be great


Here's a DFSORT/ICETOOL job for that:

Code:

//SORT03   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD  DSN=...  input file (FB/4)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT      DD  DSN=...  output file (FB/4)
//TOOLIN   DD *
  SELECT FROM(IN) TO(T1) ON(01,03,CH) -
   FIRST USING(CTL1)
  SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL  DD *
  INREC OVERLAY=(5:SEQNUM,8,ZD)
  SORT FIELDS=(01,03,CH,A,04,01,CH,D)
/*
//CTL2CNTL  DD *
  SORT FIELDS=(5,8,ZD,A)
  OUTREC BUILD=(1,4)
/*
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Tue Mar 23, 2010 8:06 pm    Post subject:
Reply with quote

Thanks Frank!!!!
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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