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
 

 

Using key values on 1 file to include/omit records on other

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

New User


Joined: 29 Dec 2007
Posts: 5
Location: UK

PostPosted: Sun Dec 30, 2007 12:59 am    Post subject: Using key values on 1 file to include/omit records on other
Reply with quote

Hi

I can't quite work out how to do the following.

File 1
xxxxxxxxxx1234xxxxxxxxx
yyyyyyyyyy2244yyyyyyyyy
vvvvvvvvvv3322vvvvvvvvv

File 2
aaaaaaaaaa1234aaaaaaaaaa
bbbbbbbbbb1234bbbbbbbbbb
gggggggggg1234gggggggggg

aaaaaaaaaa1444aaaaaaaaaa
bbbbbbbbbb1444bbbbbbbbbb
gggggggggg1444gggggggggg
aaaaaaaaaa3322aaaaaaaaaa
bbbbbbbbbb3322bbbbbbbbbb
gggggggggg3322gggggggggg

aaaaaaaaaa5555aaaaaaaaaa
bbbbbbbbbb5555bbbbbbbbbb
gggggggggg5555gggggggggg


I want to use the presence of a key in file 1 (position 11 for 4) to lift out the records in file 2 (in bold) with the same key in the same position to a file 3.

I'd also like to write out the non matching records (those not in bold) to a file 4.

I do not need to change the records that are on file 2 but just need to copy them to file 3 or 4 depending on whether or not the records have a key which is present on file 1.


I know this should be really simple but find myself stuck. I could write a program to do this quite easily but I like using sorts as they are so elegant and efficient and always reliable.

Any help is much appreciated.

Wilsy
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: Sun Dec 30, 2007 6:27 am    Post subject:
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

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)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(11,4,CH) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,81) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(81,2,CH,EQ,C'VB'),
    BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,2,CH,EQ,C'VV'),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Wilsy

New User


Joined: 29 Dec 2007
Posts: 5
Location: UK

PostPosted: Mon Dec 31, 2007 5:56 pm    Post subject:
Reply with quote

Thanks Frank
Brilliant.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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