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

Select only records in FileB


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Fri Oct 17, 2008 11:36 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top