JCL : removing duplicates
Moderators: Frank Yaeger, DikDude, Moderator Group
JCL : removing duplicates
Hi All,
My job has an GDG input file and fails due to duplicate records.
Now i need to delete all the duplicate records and then has to run job again.
if primary key = roll no
then roll no = 10 has 5 records total in my latest GDG. then removing duplicates means remove 4 records and leave that one record but i want all the 5 records to be deleted then again that 5 records must be added to other file.
now run my job with remaining records.
Thi all have to be run thru JCL.
Please let me know how to do this.
My job has an GDG input file and fails due to duplicate records.
Now i need to delete all the duplicate records and then has to run job again.
if primary key = roll no
then roll no = 10 has 5 records total in my latest GDG. then removing duplicates means remove 4 records and leave that one record but i want all the 5 records to be deleted then again that 5 records must be added to other file.
now run my job with remaining records.
Thi all have to be run thru JCL.
Please let me know how to do this.
No - it will Not be "run thru jcl" . . .
You Will submit some JCL to execute a program (most likely your sort product) to eliminate duplicates. Far too many people have the misunderstanding that JCL can actually "do things".
In your Sort documentation, read about SUM FIELDS=NONE, which is useful to eliminate duplicates.
You Will submit some JCL to execute a program (most likely your sort product) to eliminate duplicates. Far too many people have the misunderstanding that JCL can actually "do things".
In your Sort documentation, read about SUM FIELDS=NONE, which is useful to eliminate duplicates.
Have a good one
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Thanks a lor for ur reply DIkdude and also nicC...
YEs , I know abt sort=none ,xsum here this will not work as i need to delete all the duplicate records includng the mein record..
@nicC : yes ur rite , i need to omit all that particular records which is causing problem.
CAn u giv me example jcl in wirtten how to omit the recrds and then run my program next.
pls suggest
YEs , I know abt sort=none ,xsum here this will not work as i need to delete all the duplicate records includng the mein record..
@nicC : yes ur rite , i need to omit all that particular records which is causing problem.
CAn u giv me example jcl in wirtten how to omit the recrds and then run my program next.
pls suggest
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Well, if you are not allowed to use PGM=SYNCTOOL and it is not "aliased" to PGM=ICETOOL, then:
You need to append/prepend a sequence number which restarts per key, either with RESTART= or with WHEN=GROUP.
This you do on INREC. You then sort on the "normal" key, followed by the sequence number, descending.
On OUTREC, with WHEN=GROUP for the main key, PUSH the sequence number of the group-defining record to all records of the group.
On OUTFIL, INCLUDE all records which have sequence number of 1.
You need to append/prepend a sequence number which restarts per key, either with RESTART= or with WHEN=GROUP.
This you do on INREC. You then sort on the "normal" key, followed by the sequence number, descending.
On OUTREC, with WHEN=GROUP for the main key, PUSH the sequence number of the group-defining record to all records of the group.
On OUTFIL, INCLUDE all records which have sequence number of 1.
A) I can give you JCL but that is not what you need - you seem to be asking for SORT control cards.
B) What I provided earlier was enough for your originl requirement
C) Does your shop use SYNCSORT or DFSort?
D) If you were looking for help on sort then why did you not post in the DFSort section - read carefully the description of the JCL forum and the DFSort forum.
E) Whichever sort product you have you will have the TOOL (SYNCTOOOL or ICETOOL) available. Note that not all keywords are available in both products and those that are do not necessarily have the same name.
B) What I provided earlier was enough for your originl requirement
C) Does your shop use SYNCSORT or DFSort?
D) If you were looking for help on sort then why did you not post in the DFSort section - read carefully the description of the JCL forum and the DFSort forum.
E) Whichever sort product you have you will have the TOOL (SYNCTOOOL or ICETOOL) available. Note that not all keywords are available in both products and those that are do not necessarily have the same name.
Regards
Nic
Nic
Do not ask for other users' email addresses. If they are willing to continue the dialog, they will do so via the forum - where others can learn also. You do not need a personal service.
I missed the part about the "other 5". Yes, SUM FIELDS will not create both files.
How much data is in the original input file? If the volume is not large, you can easily do this in 2 sort steps.
When you post what you try, we can offer suggestions if needed. You are expected to do the work and use us for reference, not doing the work.
I missed the part about the "other 5". Yes, SUM FIELDS will not create both files.
How much data is in the original input file? If the volume is not large, you can easily do this in 2 sort steps.
When you post what you try, we can offer suggestions if needed. You are expected to do the work and use us for reference, not doing the work.
Have a good one
As NicC suggested can use sort with imit statement..
v have total 6 steps in my JCL.. 4th step will create a gdg... and 5 th step execute the job...
so v can insert a new JCL step here as...
1.create a new flat file...copy gdg into that....not using sort and imit keyywords...
v can delte those records....
if am rite... but how to omit 5 records..
thanks a lot ! if iam wrong pls let me know...
v have total 6 steps in my JCL.. 4th step will create a gdg... and 5 th step execute the job...
so v can insert a new JCL step here as...
1.create a new flat file...copy gdg into that....not using sort and imit keyywords...
v can delte those records....
if am rite... but how to omit 5 records..
thanks a lot ! if iam wrong pls let me know...
Suggest you also do not create your gdg until end of job. Also use OMIT not 'imit' and what is all this 'v'? Do you mean 'we' because if you do then use 'we'. You are supposed to be a professional so be professional and use proper English (to the best of your ability as it is quite possible that English is not your first language).
Why not be professional and look up the OMIT syntax in the manual as, from what you have posted, it seems to do what you want. If it does not do what you want then explain why.
Why not be professional and look up the OMIT syntax in the manual as, from what you have posted, it seems to do what you want. If it does not do what you want then explain why.
Regards
Nic
Nic
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page