IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Pull only multiple records from a flat file.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sameer

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Fri Jul 08, 2005 8:12 pm
Reply with quote

icon_question.gif

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:17 pm
Reply with quote

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
View user's profile Send private message
sameer

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Fri Jul 08, 2005 8:30 pm
Reply with quote

Priyesh,

This is simply superb. Appriciate your dynamic and extrordinary knoledge in Mainframes.

Thanks for your immediate help.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:37 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 08, 2005 8:48 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 08, 2005 8:53 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:59 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top