|
View previous topic :: View next topic
|
| Author |
Message |
Jay Villaverde
New User
Joined: 08 Mar 2014 Posts: 27 Location: USA
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
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 |
|
 |
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1056 Location: Richmond, Virginia
|
|
|
|
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| 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 |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| 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 |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| 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 |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
File1:
| Code: |
ABC1
ABC1
PQR2
XYZ3 |
File2:
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|