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
 

 

Select only records in FileB

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

New User


Joined: 27 Sep 2007
Posts: 5
Location: rotterdam

PostPosted: Fri Oct 17, 2008 7:53 pm    Post subject: Select only records in FileB
Reply with quote

Hi,

I want select only records in FileB if the accountnumber in FileA existst in FileB.

FileB: FB, reclen 354. Accountnbr in positions 23 to 29 as PD. Key is first 17 chars.
FileA: FB, reclen 15. Accountnbr in positions 1 to 11 as ZD.

FileA:
<accountnbr1><text>
<accountnbr3><text>

FileB:
<key1><data1a><accountnbr1><data1b>
<key2><data2a><accountnbr2><data2b>
<key3><data3a><accountnbr3><data3b>
<key4><data4a><accountnbr4><data4b>
<key5><data5a><accountnbr5><data5b>

Sortout:
<key1><data1a><accountnbr1><data1b>
<key3><data3a><accountnbr3><data3b>
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 Oct 17, 2008 11:36 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed there are no duplicate account numbers within fileA, or within fileB. If there are, show an example of input and output for that (it will require a different solution).

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=... input fileA (FB/15)
//FILEB DD DSN=... input fileB (FB/354)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/354)
//TOOLIN DD *
COPY FROM(FILEB) TO(T1)
COPY FROM(FILEA) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(23,7,PD) FIRSTDUP
/*
//CTL1CNTL DD *
  INREC BUILD=(23:1,11,ZD,TO=PD,LENGTH=7,354:X)
/*
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
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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