Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Pull only multiple records from a flat file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Pull only multiple records from a flat file.
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: 1452
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:17 pm    Post subject: Re: Pull only multiple records from a flat file.
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    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:37 pm    Post subject: Re: Pull only multiple records from a flat file.
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 Moderator


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

PostPosted: Fri Jul 08, 2005 8:48 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Jul 08, 2005 8:53 pm    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 8:59 pm    Post subject: Re: Pull only multiple records from a flat file.
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us