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

Input file that also contains duplicates based on a key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Mar 16, 2010 1:56 am
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
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
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 Developer


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

PostPosted: Thu Mar 18, 2010 1:10 am
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
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
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 Developer


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

PostPosted: Fri Mar 19, 2010 10:37 pm
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
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 Developer


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

PostPosted: Sat Mar 20, 2010 1:24 am
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
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 Developer


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

PostPosted: Mon Mar 22, 2010 10:38 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top