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

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


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


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

PostPosted: Sun Dec 30, 2007 6:27 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top