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 records from 2'nd file that doesn't have matching key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Select records from 2'nd file that doesn't have matching key
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Wed Oct 10, 2007 5:26 pm    Post subject: Reply to: Select records from 2'nd file that doesn't have ma
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: 1288
Location: Chennai, India

PostPosted: Wed Oct 10, 2007 5:43 pm    Post subject: Reply to: Select records from 2'nd file that doesn't have ma
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    Post subject:
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 Moderator


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

PostPosted: Wed Oct 10, 2007 9:58 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Thu Oct 11, 2007 3:28 pm    Post subject: Reply to: Select records from 2'nd file that doesn't have ma
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    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