View previous topic :: View next topic
|
Author |
Message |
sameer
New User
Joined: 10 Mar 2005 Posts: 41 Location: United States Of America
|
|
|
|
Hi,
I have a query if anybody can helpout this.
I have an employee file having empno,name,address etc... Whenever an employee moves from one place to another his address changes and we need to create one more record for that employee with the same empno.
Ex: say empno 1234
1234 - Name1 - Address 1
1234 - Name1 - Address 2
Hence our file will have some employees having single instance and have some employees have more than once instance ( 2 or many).
I just want to pull only those employees who have transferred at least once. I mean to say those having multiple instances based on EMPNO.
It would be easy to write a cobol program and can do the elimination. But it would be great if anybody can solve this using JCL or using any TOOL which pulls multiple records ONLY.
* Make sure i don't want those records having single instances.
Appriciate if anybody can respond with a resolution.
Thanks |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Sameer,
I just short lining ur problem... You want to retrive Duplicate recs based on a field only...
Try this....
Code: |
//S030 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=RECORDS.INPUT,DISP=SHR
//OUT DD DSN=RECORDS.OUT,
// DISP=(,KEEP,DELETE),
// RECFM=FB,LRECL=80,
// SPACE=(80,(10,10),RLSE)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,4,CH) ALLDUPS
// |
Here I assumed ur LRCEL = 80 & EMP NO FIELD length = 4...
Let me know..If it works....
Regards,
Priyesh. |
|
Back to top |
|
|
sameer
New User
Joined: 10 Mar 2005 Posts: 41 Location: United States Of America
|
|
|
|
Priyesh,
This is simply superb. Appriciate your dynamic and extrordinary knoledge in Mainframes.
Thanks for your immediate help. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Sameer,
Quote: |
extrordinary knoledge in Mainframes |
Its nothing sort of EXTRA ORDINARY......You could have got the solution If gone thru the Forum ....
Well, You can also use NODUPS, FIRSTDUP, LASTDUP to extract recs respectively for...
1) When you need no duplicate.
2) When you need First Dup rec.
3) When you need Last Dup rec.
Regards,
Priyesh. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sameer,
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent
tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Priyesh,
In your DFSORT/ICETOOL job, you have the following in //OUT:
// RECFM=FB,LRECL=80,
It's best NOT to specify these attributes in the output DD statement, so DFSORT can set them automatically for you. That way, you could use this same JCL regardless of the input attributes. The way you have it set up, it will only work for an input file with RECFM=FB and LRECL=80. If you remove the attributes from the DD statement, it will work for an input file with any attributes (e.g. RECFM=FB and LRECL=500). |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
It's best NOT to specify these attributes in the output DD statement, |
Thanks a lot Frank for valuable suggestion.... I really Didn't know about that.... From now onward I'll keep in mind.......
Thanks again.....In search of corrections everytime desperately......
Regards,
Priyesh. |
|
Back to top |
|
|
|