Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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
 
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us