Posted: Mon Jun 11, 2012 2:05 pm Post subject: Load a table after removing Dups
I have a load file say 'TAFE' which I have to use to load a prod table NVDLINA. The TAFE file has Employee numbers which are unique.
I cannot load it directly since the TAFE file has employee numbers which were already there in the prod table NVDLINA. so I have to remove the Emp numbers from the load file which were already there in the NVDLINA table.
Below are the steps I will be following to resolve it.
Step1: Unload the production table NVDLINA.
Step2: Concatenate the unload file and TAFE dropping the duplicates that are in the TAFE file (note: I don't want to delete the rows from the unload file)
Step3: load replace the table NVDXTDN with the new concatenate file.
Tafe File:(first 9 digit is the emp number)
Code:
********************************* Top of Data *********************************
000000000Y0001-01-01-00.00.00.000001
000000001Y0001-01-01-00.00.00.000001
000000007Y0001-01-01-00.00.00.000001
000000015Y0001-01-01-00.00.00.000001
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Jun 11, 2012 2:57 pm Post subject: Re: Load a table after removing Dups
vak255 wrote:
any better way to do this?
Vak255,
You don't need 3 steps. You can use "ENFORCE CONSTRAINTS" keyword on your LOAD card so that the duplicates will be rejected and go to the SYSDISC dataset.
ex:
Code:
LOAD DATA INDDN(SYSREC) RESUME YES
ENFORCE CONSTRAINTS
INTO TABLE your_table_name
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Jun 12, 2012 11:35 am Post subject:
vak255,
You need to see the expanded version of the PROC DS51PTLT. In the proc it should be executing PGM=DSNUTILB in there. You need to check the SYSIN DD for that statement which contains the LOAD card.
Thanks for the quick response.
I checked with my SME. He want to do this by the steps I mentioned, as we need to generate some reports as well. so I am going to use the below JCL. Below is the JCL. Like I said I want to concatenate the unload file and TAFE file. If there are any duplicates then it should choose the record from the unload file and ignore the record in TAFE file. please let me know of any corrections in the below JCL.
Code:
//STEP EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SORTJNF1 DD unload file of the table
//SORTJNF2 DD TAFE
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,09,A)
JOINKEYS FILE=F2,FIELDS=(1,09,A)
REFORMAT FIELDS=(F1:01,09,F1:10,36) (need to check the LRECL)
SORT FIELDS=COPY
SUM FIELDS=None
//
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Jun 12, 2012 12:20 pm Post subject:
vak255 wrote:
Thanks for the quick response.
I checked with my SME. He want to do this by the steps I mentioned, as we need to generate some reports as well. so I am going to use the below JCL. Below is the JCL. Like I said I want to concatenate the unload file and TAFE file. If there are any duplicates then it should choose the record from the unload file and ignore the record in TAFE file. please let me know of any corrections in the below JCL.
Vak255,
Use CODE tags instead of Quote tags. I can't be editing every post of yours.
Hmm My way or the Highway SME ? Why do you need to concatenate? if you insist the 3 step procedure.
1. Unload just the key from the table with an ORDER by on the key so that it is sorted.
2. Match it against TAFE file using Joinkeys (if your tafe file is also pre-sorted on the key , then add SORTED,NOSEQCK to INA also)
INA = your tafe file
INB = your db2 key unload file.
.
Before the info you want "Coded" enter left-bracket code right-bracket and after the data you want coded enter left-bracket /code right-bracket
(like: [codx] the info to be coded [/codx] - spelling code correctly) .
Here is what this would produce
Code:
the info to be coded
Or click the Code tag. . . in the full editor (if you access to this), not the Quick Reply _________________ All the best,
That's from your JCL checker nosing about without knowing enough about control cards. Just toss the job in and see if there are any real problems. I can't see any
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Jun 12, 2012 5:14 pm Post subject:
vak255 wrote:
I am getting the below error messages.
Vak255,
The JSCAN messages you show are NOT DFSORT messages and it is the JCL checker software which is way beyond keeping up with the latest features of DFSORT. _________________ Kolusu
www.linkedin.com/in/kolusu
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