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
 

 

Extract records of one file based on input in second file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sachina2z

New User


Joined: 03 May 2006
Posts: 8
Location: Pune, India

PostPosted: Fri Sep 27, 2013 8:46 pm    Post subject: Extract records of one file based on input in second file
Reply with quote

Hi,

I have two datasets. First dataset contains many records:-

A102121SACHIN2013-01-12
A103524DEEPAK2013-02-01
A107458NAVEEN2013-05-28
A108965SATISH2013-03-18
...
...

Here, first 7 characters are account number.

I have second dataset containing only Account numbers:-

A102121
A108526
A107584
A108965

Now, I want to use SORT, to extract the records of the first dataset whose account number is found in the second dataset.

Is it possible with sort. Please provide solution.

Thanks,
Sachin
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1771
Location: Bloomington, IL

PostPosted: Fri Sep 27, 2013 9:03 pm    Post subject:
Reply with quote

Read about JOINKEYS.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 27, 2013 9:11 pm    Post subject:
Reply with quote

Hello,

And there are many examples here in the forum.
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Mon Sep 30, 2013 4:29 pm    Post subject:
Reply with quote

Try this

//SORTJNF1 DD DSN=File1,DISP=SHR
//SORTJNF2 DD DSN=File2,DISP=SHR
//SORTOUT DD DSN=Ooutputfile,
// DISP=(NEW,CATLG,DELETE),
//*
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,7,A)
JOINKEYS FILES=F2,FIELDS=(1,7,A)
REFORMAT FIELDS=(F1:1,080)

Both input files should be sorted
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 01, 2013 1:12 am    Post subject:
Reply with quote

trushant.w wrote:
Both input files should be sorted


what do you mean both files should be sorted. Joinkeys Automatically SORTS the files based on the fields specified on the Joinkeys statement. A Copy/Merge is ONLY done when you specify SORTED keyword on the joinkeys statement.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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