JCL : removing duplicates

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

JCL : removing duplicates

Post by arjun0109 » Sun Mar 17, 2013 12:27 am

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.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sun Mar 17, 2013 2:53 am

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.
Have a good one

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sun Mar 17, 2013 5:22 am

Actually I think you need OMIT and one other keyword which will specify that you want to save the omitted records. The fact that the file is a GDG is irrelevant as is the fact that you will be running the solution in a batch job (JCL)
Regards
Nic

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sun Mar 17, 2013 1:37 pm

ICETOOL's SELECT can do what you want, if I have followed correctly.

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Sun Mar 17, 2013 1:42 pm

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

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Sun Mar 17, 2013 1:51 pm

if i find a duplicate , it means there is a probelm with that particular roll num. so i need to omit all the records corresponding to that primary key.
We do not have ICEtool.
any kind of suggestions

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sun Mar 17, 2013 3:43 pm

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.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sun Mar 17, 2013 9:54 pm

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.
Regards
Nic

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Sun Mar 17, 2013 10:30 pm

Thanks a lot NicC !!

Sorry am very new to this forum and also mainframes....can i have ur email id
so that i can discuss with u abt my issue

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Sun Mar 17, 2013 11:01 pm

my requirmnt is wat u have suggested before.. can u provide me the jcl

thanks in advance

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Mar 18, 2013 7:29 am

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.
Have a good one

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Mon Mar 18, 2013 9:56 am

sorry, no problem.. i nvr ask for ana email address again
I too want to learn not make others to work...
my orginal output is nearly 600 records.. its only one gdg file...
hope its a small one...

arjun0109
Member
Posts: 8
Joined: Sun Mar 17, 2013 12:18 am

Post by arjun0109 » Mon Mar 18, 2013 10:11 am

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...

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue Mar 19, 2013 8:13 am

Suggest you post some sample input data and the output you want when your process is run.
Have a good one

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Wed Mar 20, 2013 12:02 am

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.
Regards
Nic

Post Reply

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



Other References
Mainframe Tools and others