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

Write out NODUPS but just from one file


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

New User


Joined: 08 Mar 2014
Posts: 27
Location: USA

PostPosted: Fri Jul 14, 2017 12:44 am
Reply with quote

Hi. I have two files and I need to write out just the unique records from one of the files.

This is current my code which if I run as is will give me the uniques from both files:

Code:

//DUPECHK2 JOB (31000,G5),'JAY',CLASS=F,MSGCLASS=2,                     
//         NOTIFY=&SYSUID TYPRUN=HOLD                                   
//S1SORT   EXEC PGM=SORT,REGION=3072K                                   
//**********************************************************************
//SORTIN   DD DISP=SHR,DSN=TST.WAY.H6541.JUL171X                       
//**********************************************************************
//SORTOUT DD DISP=(NEW,PASS),DSN=&&FILE1,                               
//           SPACE=(CYL,(500,100),RLSE,,ROUND),UNIT=SYSDA,             
//           DCB=(RECFM=FB,LRECL=441,BLKSIZE=27783)                     
//*           DCB=*.SORTIN                                             
//SYSOUT  DD SYSOUT=6                                                   
//SYSIN   DD *                                                         
*                                                                       
*INCLUDE COND=(364,002,CH,EQ,C'PR')                                     
*                                                                       
*OMIT COND=(023,04,CH,EQ,C'1311')                                       
*                                                                       
*SORT FIELDS=COPY                                                       
 SORT FIELDS=(01,441,CH,A)                                             
*SUM FIELDS=NONE                                                       
 OPTION DYNALLOC                                                       
/*                                                                     
//S2SORT   EXEC PGM=SORT,REGION=3072K                                   
//**********************************************************************
//SORTIN   DD DISP=SHR,DSN=ATR.DDW.H6541.JUL171                         
//**********************************************************************
//SORTOUT DD DISP=(NEW,PASS),DSN=&&FILE2,                               
//           SPACE=(CYL,(500,100),RLSE,,ROUND),UNIT=SYSDA,             
//           DCB=(RECFM=FB,LRECL=441,BLKSIZE=27783)                     
//*           DCB=*.SORTIN                                             
//SYSOUT  DD SYSOUT=6                                                   
//SYSIN   DD *                                                         
*                                                                       
*INCLUDE COND=(364,002,CH,EQ,C'PR')                                     
*                                                                       
*OMIT COND=(023,04,CH,EQ,C'1311')                                       
*                                                                       
*SORT FIELDS=COPY                                                       
 SORT FIELDS=(01,441,CH,A)                                             
*SUM FIELDS=NONE                                                       
 OPTION DYNALLOC                                                       
/*                                                                     
//**********************************************************************
//*****   S2ICE: OUTPUT ALL OR NO DUPES ON SUPPLIED CRITERIA       *****
//**********************************************************************
//S2ICE EXEC PGM=ICETOOL                                               
//TOOLMSG DD SYSOUT=*                                                   
//DFSMSG DD SYSOUT=*                                                   
//IN      DD DISP=SHR,DSN=&&FILE1                                       
//        DD DISP=SHR,DSN=&&FILE2                                       
//OUT     DD DISP=(NEW,CATLG,DELETE),                                   
//           DSN=TST.WAY.X6541.NODUPES,                                 
//           SPACE=(CYL,(500,100),RLSE,,ROUND),UNIT=TEST,               
//           DCB=(RECFM=FB,LRECL=441,BLKSIZE=27783)                     
//*           DCB=*.IN                                                 
//TOOLIN DD *                                                           
  SELECT FROM(IN) TO(OUT) -       
  ON(01,441,CH) NODUPS           
//                               


Thanks
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 967
Location: Maryland

PostPosted: Fri Jul 14, 2017 2:44 am
Reply with quote

If you need "just the unique records from one of the files" then you don't need the second dataset at all. Eliminate duplicates from the first dataset, and forget about the second one, that's it.

I guess you do not understand your task yet? Or cannot explain it to the public?

Your question as it is now doesn't make sense, at all.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1016
Location: Richmond, Virginia

PostPosted: Fri Jul 14, 2017 9:03 am
Reply with quote

I recommend that when posting your code, first remove the commented and other extraneous lines so that others need not wade through them to see what you are doing.

Make it as easy as possible for folks to help you.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 14, 2017 6:15 pm
Reply with quote

Jay - Is there anything within the data by which you can identify the source data set? If yes, concatenate both the original data sets and assign a sequence number ONLY for records from one of the data sets (the one you don't want to eliminate dups from). Make sure you have blanks (or some default value) in this field for records from the other data set. Then include the sequence number field in your SORT FIELDS and then eliminate duplicates.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2591
Location: NYC,USA

PostPosted: Fri Jul 14, 2017 8:28 pm
Reply with quote

Jay, Sergeyken is right. Understand the task first and then start working on it otherwise its a waste of time.
Arun Raj, Why even involved the other dataset at first place? Just get rid of the dups from one dataset and concatenate later with other dataset .
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 14, 2017 9:18 pm
Reply with quote

Rohit Umarjikar wrote:
Arun Raj, Why even involved the other dataset at first place? Just get rid of the dups from one dataset and concatenate later with other dataset .
Rohit Umarjikar,

Because from the OP's control statements above, he does sort the other data set as well on the key. Concatenation will not help if this is what the OP wants to do.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2591
Location: NYC,USA

PostPosted: Fri Jul 14, 2017 10:09 pm
Reply with quote

Quote:
Because from the OP's control statements above, he does sort the other data set as well on the key. Concatenation will not help if this is what the OP wants to do.
Sort keys are still same and can be done independently, if I understand the OP's question.
1.Eliminate dups from Dataset 1
2.Concate Dataset from step1, and dataset 2 with SORT ( same key for both).
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Jul 14, 2017 10:24 pm
Reply with quote

File1:
Code:
ABC1
ABC1
PQR2
XYZ3

File2:
Code:
BCD1
PQR2
MNO3

Will PQR2 be considered as a Unique record?

Since Sort key is same as record length, the whole record has to be a duplicate. If PQR2 needs to be removed then, it doesn't mean anything if it is removed from file1 or file2.

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

Moderator


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

PostPosted: Fri Jul 14, 2017 10:25 pm
Reply with quote

Rohit Umarjikar wrote:
Sort keys are still same and can be done independently

Rohit Umarjikar,

You can do it in a single pass with concatenated original input data sets and a single output data set, provided the given conditions satisfy. You don't really need to 'separate' the processing and do it 'independently' if that is the case.
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
This topic is locked: you cannot edit posts or make replies. Writng matched records into output fi... DFSORT/ICETOOL 11
No new posts Compare the file record count percent... DFSORT/ICETOOL 4
No new posts compare two file to find position/dat... SYNCSORT 2
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
Search our Forums:

Back to Top