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 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 Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm

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