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

Select records from 2'nd file that doesn't have matching key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Wed Oct 10, 2007 5:04 pm
Reply with quote

Hi All,

I have two files of LRECL=80, with key as first 8 bytes. I need to select records of first file which doesn't have a matching key in second file.

Code:

File 1:

11111111 XXX
22222222 YYY
33333333 ZZZ

File 2:

11111111 AAAAA
22222222 BBBBB

Expected Output:

33333333 ZZZ


All output records generated, needs to be inserted a constant value 'UNDEFINED' at position 50 and remaining should be spaces.
Eg: 33333333 ZZZ UNDEFINED

Can we achieve the above using ICETOOL?

Thanks in advance,
Ramanan R
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Wed Oct 10, 2007 5:09 pm
Reply with quote

U can search this in forum, it was posted here previously many times .
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 10, 2007 5:26 pm
Reply with quote

This can be done using the SELECT operator of ICETOOL. As suggested, search this forum.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 10, 2007 5:43 pm
Reply with quote

ramanan,

What should happen if there are unique values in the file2? Should we extract that or not?
Back to top
View user's profile Send private message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Wed Oct 10, 2007 6:25 pm
Reply with quote

Aaru,

Thanks for your reply, but i need unique records only from file 1 and not from File2.

Suppose, if file 1 has the below records,

11111111 XXX
22222222 YYY
33333333 ZZZ

and file 2 with below records,

11111111 AAA
22222222 BBB
44444444 CCC

For the above, the output should only contain unique record from file 1 as below,

33333333 ZZZ UNDEFINED

and not as given below

33333333 ZZZ UNDEFINED
44444444 CCC UNDEFINED

Thank you,

Regards,
Ramanan R
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: Wed Oct 10, 2007 9:58 pm
Reply with quote

Ramanan R,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,8,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),
    BUILD=(1,49,50:C'UNDEFINED',80:X)
/*
Back to top
View user's profile Send private message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Thu Oct 11, 2007 11:23 am
Reply with quote

Thanks Frank,

That was working fine, Can we build two records for every unique record of file 1. Like below,

33333333 ZZZ UNDEFINED HEADER RECORD
33333333 ZZZ UNDEFINED DETAIL RECORD

Regards,
Ramanan R
Back to top
View user's profile Send private message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Thu Oct 11, 2007 2:56 pm
Reply with quote

Thanks all,

I built two records for every unique record of file 1 using '/' in BUILD.
Like below,

Code:

BUILD=(1,49,50:C'UNDEFINED',60:'HEADER RECORD',80:X,/,
             1:1,49,50:C'UNDEFINED',60:'DETAIL RECORD',80:X)


Regards,
Ramanan R
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Oct 11, 2007 3:28 pm
Reply with quote

You are welcome. Thanks for letting us know the final solution.
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 To fetch records that has Ttamp value... DFSORT/ICETOOL 2
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
Search our Forums:

Back to Top