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

Search for duplicates in the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Andrew Shinkarev

New User


Joined: 10 Jan 2008
Posts: 22
Location: Belarus

PostPosted: Thu Jan 10, 2008 7:36 pm
Reply with quote

Hi everyone!

There is a file (VB/80) containing the list of names for replacement. The name to be replaced is written in first 20 positions. After semicolon in the next 20 positions there is the "name-to-replace":

Name1;Name2; <could be some comments>
Name3;Name4;
......................
Name1;Name5;
......................
Name3;Name4;
......................

The requirement is to create 2 lists - 1 for full duplicates of both names and 1 for partial duplicates (just the first Name is duplicated). Every list should contain the line number of the duplicated string in the source file. Also any group of duplicates should be separated by the blank line.

I have written the next job:
Code:

//*
//* FULL DUPLICATE LIST                                               
//*
//STEP10  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//INP      DD DSN=<source file>,                       
//            DISP=SHR                                               
//TEMP1    DD DSN=&&TMPOUT1,                                         
//            DISP=(NEW,PASS),                                       
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)                   
//TEMP2    DD DSN=&&TMPOUT2,                                         
//            DISP=(NEW,PASS),                                       
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)                   
//OUT      DD DSN=<full duplicates list>,               
//            DISP=(NEW,CATLG,DELETE),                               
//            UNIT=SYSDA,SPACE=(TRK,(50,20),RLSE)                     
//TOOLIN   DD *                                                       
  SELECT FROM(INP) TO(TEMP1) ON(5,41,CH) LOWER(2) DISCARD(TEMP2) -   
  USING(CTL1)                                                         
  COPY FROM(TEMP2) USING(CTL2)                                       
/*                                                                   
//CTL1CNTL DD *                                                       
  OPTION VLSCMP,VLSHRT                                               
  INREC OVERLAY=(69:SEQNUM,8,ZD)                                     
/*                                                                   
//CTL2CNTL DD *                                                       
  OUTFIL FNAMES=OUT,                                                 
         SECTIONS=(5,41,SKIP=L)                                       
//*
//* PARTIAL DUPLICATE LIST                                           
//*
//STEP20  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//INP      DD DSN=&&TMPOUT1,                                         
//            DISP=(OLD,PASS)                                         
//TEMP     DD DSN=&&TMPOUT3,                                         
//            DISP=(NEW,PASS),                                       
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)                   
//OUT      DD DSN=<partial duplicates list>,               
//            DISP=(NEW,CATLG,DELETE),                               
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)                   
//TOOLIN   DD *                                                       
  SELECT FROM(INP) ON(5,20,CH) LOWER(2) DISCARD(TEMP) USING(CTL3)     
  COPY FROM(TEMP) USING(CTL4)                                         
/*                                                                   
//CTL3CNTL DD *                                                       
  OPTION VLSCMP,VLSHRT                                               
  SORT FIELDS=(5,20,CH,A,69,8,CH,A)                                   
/*                                                                   
//CTL4CNTL DD *                                                       
  OUTFIL FNAMES=OUT,                                                 
         SECTIONS=(5,20,SKIP=L)                                       
/*                                                                   
//                                                                   


But there are two questions:

1. Is it possible to combine SELECT and OUTFIL...SECTIONS in ICETOOL(without usage of COPY)?

2. Sometimes some blank lines (at least one) in <partial duplicates list> are omitted:

....................
Name1;Name2;
Name1;Name3; <blank line should be after this one>
Name4;Name5;
Name4;Name6;
......................

Is it caused by any mistake in the job?
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 Jan 10, 2008 10:05 pm
Reply with quote

1. Yes.

2. I'm getting a blank line for the data I tried, but I don't know what your data looks like.

I believe you can do what you want more easily with a DFSORT/ICETOOL job like this:

Code:

//STEP10  EXEC PGM=ICETOOL
//* FULL DUPLICATE LIST
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//INP      DD DSN=<source file>,
//            DISP=SHR
//TEMP1    DD DSN=&&TMPOUT1,DISP=(,PASS),
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)
//FULL     DD DSN=<full duplicates list>,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,SPACE=(TRK,(50,20),RLSE)
//PARTIAL  DD DSN=<partial duplicates list>,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,SPACE=(TRK,(100,50),RLSE)
//TOOLIN   DD *
SELECT FROM(INP) TO(FULL) ON(5,41,CH) ALLDUPS DISCARD(TEMP1) -
  USING(CTL1)
SELECT FROM(TEMP1) TO(PARTIAL) ON(5,20,CH) ALLDUPS USING(CTL2)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(69:SEQNUM,8,ZD)
  OUTFIL FNAMES=FULL,
         SECTIONS=(5,41,SKIP=L)
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=PARTIAL,
         SECTIONS=(5,20,SKIP=L)
/*


I used the following example records for INP:

Code:

Name1111111111111111;Name2222222222222222;1<comments>
Name1111111111111111;Name3333333333333333;2
Name3333333333333333;Name4444444444444444;3
Name8888888888888888;Name2222222222222222;4<comments>
Name4444444444444444;Name5555555555555555;5
Name4444444444444444;Name6666666666666666;6
Name1111111111111111;Name5555555555555555;7
Name3333333333333333;Name4444444444444444;8
Name8888888888888888;Name2222222222222222;9


The job produced the following records for FULL:

Code:

Name3333333333333333;Name4444444444444444;3                     00000003
Name3333333333333333;Name4444444444444444;8                     00000008

Name8888888888888888;Name2222222222222222;4<comments>           00000004
Name8888888888888888;Name2222222222222222;9                     00000009


The job produced the following records for PARTIAL:

Code:

Name1111111111111111;Name2222222222222222;1<comments>           00000001
Name1111111111111111;Name3333333333333333;2                     00000002
Name1111111111111111;Name5555555555555555;7                     00000007

Name4444444444444444;Name5555555555555555;5                     00000005
Name4444444444444444;Name6666666666666666;6                     00000006


If that's not what you want, then please describe more clearly what you do want using input and output examples.
Back to top
View user's profile Send private message
Andrew Shinkarev

New User


Joined: 10 Jan 2008
Posts: 22
Location: Belarus

PostPosted: Fri Jan 11, 2008 5:28 pm
Reply with quote

Thank you very much, Frank.

I just have added a sorting by line numbers for partial list:

Code:

//CTL2CNTL DD *                   
  SORT FIELDS=(5,20,CH,A,69,8,CH,A)
  OUTFIL FNAMES=PARTIAL,           


and the job works fine.
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 0
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top