MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove duplicates

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Thu May 06, 2010 6:50 pm    Post subject: Remove duplicates Reply with quote

I have 2 input files with duplicate records among them

File 1

Z01
Z02
Z03
Z06 *
Z08 *

File 2

Z05
Z06 *
Z07
Z08 *
Z09

I want to get rid of the duplicates from File 1. I want to retain records in File 2. How do I achieve this using SORT?
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Thu May 06, 2010 7:57 pm    Post subject: Reply with quote

It will help if you show the output you want from those input files.

Which sort is used on your system?
_________________
All the best,

di
Back to top
View user's profile Send private message
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Fri May 07, 2010 11:32 am    Post subject: Reply with quote

Output as below

File 1

Z01
Z02
Z03


File 2

Z05
Z06
Z07
Z08
Z09

You notice that the duplicates got removed from File 1. We use PGM=SORT in all our jcls.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 07, 2010 11:59 am    Post subject: Reply with quote

lacoe1 wrote:
You notice that the duplicates got removed from File 1. We use PGM=SORT in all our jcls.


lacoe1,

*sigh* Are you updating the original File 1 itself? or are you creating an output file removing the matching keys from file2 ?

Please be clear on your requirements , Please do NOT make people guess.

What is the LRECL and RECFM of file 1 and file 2

What is the position and key to be matched in both files.

Just because you use PGM=SORT in your JCL doesn't mean every solution posted here will work. Run the following job and show us the entire sysout which would help us determine the level of DFSORT you have.
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
A
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
lacoe1
Beginner


Joined: 24 Feb 2005
Posts: 33
Topics: 17

PostPosted: Fri May 07, 2010 12:42 pm    Post subject: Reply with quote

Sorry about not being more clear.
Whatever is easier - 2 new output files by removing the matching keys.
Below is the sysout. The LRECL=935, RECFM=FB. The position is 1, for length of 3.

Here is the DFSORT version.
Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 10:12 ON FRI MAY
            SORT FIELDS=COPY                                                   
ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K42135 E9-K90013 C9-BASE   E5-K35433
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED   
ICE088I 0 CONAXCT .STEP0100.        , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)                                 
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)                           
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO   ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE    ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
ICE235I 0 OPTIONS: NULLOUT=RC0                                                 
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT                                   
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN                                   
ICE751I 1 EF-K10929 F0-K30362 E8-K90013                                         
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB                           
ICE055I 0 INSERT 0, DELETE 0                                                   
ICE054I 0 RECORDS - IN: 1, OUT: 1                                               
ICE052I 0 END OF DFSORT                                                         
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 07, 2010 1:00 pm    Post subject: Reply with quote

Lacoe1,

Use the following DFSORT JCL. OUT1 will have the matching keys removed from file 1 and out2 will have all the records from file 2

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
//SORTOUT  DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  OUTFIL REMOVECC,NODETAIL,BUILD=(935X),HEADER1=('$$$')     
//*                                                         
//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=Your input file 2,DISP=SHR
//         DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=your input file 1,DISP=SHR
//OUT1     DD SYSOUT=*                                           
//OUT2     DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(936:ID=1)) 
  SORT FIELDS=(1,3,CH,A),EQUALS                                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(938:SEQNUM,8,ZD,RESTART=(1,3))), 
  IFTHEN=(WHEN=GROUP,BEGIN=(938,8,ZD,EQ,1),PUSH=(937:936,1))         
  OUTFIL FNAMES=OUT1,INCLUDE=(936,2,ZD,EQ,22),BUILD=(1,935)           
  OUTFIL FNAMES=OUT2,BUILD=(1,935),                                   
  INCLUDE=(936,2,ZD,EQ,11,AND,1,3,CH,NE,C'$$$')                       
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group