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
 

 

Comparing 2 files

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

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Fri Apr 01, 2011 5:23 pm    Post subject: Comparing 2 files
Reply with quote

Hi,

I have 2 FB files of length 80 bytes. The key values are 2 fields of 6 bytes (1-6) and 4 bytes (7-10) and there can be duplicates for this in the first file. The second file will be a lookup key value file and will not have duplicates.

File1 (Bytes 16-80 are fillers)
AAAAAAYYYYTEST1
AAAAAAYYYYTEST2
AAAAAAZZZZTEST1
AAAAAAZZZZTEST2
AAAAAAZZZZTEST3
BBBBBBYYYYTEST5

File2 (Bytes 11-80 are fillers)
AAAAAAXXXX
AAAAAAYYYY

I need to create an output file that has records in file1 that are not in file2 based on key comparison of key1 and key2- but with some indicator to differentiate if key1 is present but not key2 or if key1 is not at all present in file2.

Output
AAAAAAZZZZTEST1 "Only key2"
AAAAAAZZZZTEST2 "Only key2"
AAAAAAZZZZTEST3 "Only key2"
BBBBBBYYYYTEST5 "Key1 "

This can be done by 2 separate splice/join keys comparing both keys and comparing and merging the files - can this be done in a single step/better way?

Thanks,
Aneesh
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: Sat Apr 02, 2011 12:45 am    Post subject:
Reply with quote

I think you mean in a single "pass". It could certainly be done in a single "step" using multiple ICETOOL operators.

I can't think of a way to do it in a single pass.
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Apr 02, 2011 10:43 am    Post subject: Reply to: Comparing 2 files
Reply with quote

Hi Frank,

Yes - Single pass would have been amazing.

Even a single step approach - could you please let me know if you meant the below steps when you mentioned multiple operators in a single step?

First a splice for the full key
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(01,10,CH) WITHALL WITH(01,15) -
KEEPNODUPS KEEPBASE USING(CTL3)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(51:1,9,80:X)
//CTL2CNTL DD *
OUTFIL FNAMES=T1
//CTL3CNTL DD *
OUTFIL FNAMES=T2,INCLUDE=(11,5,CH,NE,C' ')

Then repeating similar steps above for a splice using the first key (01,6) and then merging.

Thanks,
Aneesh.
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: Tue Apr 05, 2011 12:59 am    Post subject:
Reply with quote

You could use a one step DFSORT/ICETOOL job with JOINKEYS like the following to do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAAAAAYYYYTEST1
AAAAAAYYYYTEST2
AAAAAAZZZZTEST1
AAAAAAZZZZTEST2
AAAAAAZZZZTEST3
BBBBBBYYYYTEST5
/*
//IN2 DD *
AAAAAAXXXX
AAAAAAYYYY
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY JKFROM TO(T1) USING(CTL1)
COPY JKFROM TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  JOINKEYS F1=IN1,FIELDS=(1,10,A),TASKID=A1
  JOINKEYS F2=IN2,FIELDS=(1,10,A),TASKID=A1
  JOIN UNPAIRED,F1,ONLY
  REFORMAT FIELDS=(F1:1,80)
  OPTION COPY
/*
//CTL2CNTL DD *
  JOINKEYS F1=T1,FIELDS=(1,6,A),TASKID=A2
  JOINKEYS F2=IN2,FIELDS=(1,6,A),TASKID=A2
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,80,?)
  OPTION COPY
  OUTREC IFOUTLEN=80,
   IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),
    OVERLAY=(17:C'"Only key2"')),
   IFTHEN=(WHEN=NONE,OVERLAY=(17:C'"Key1"'))
/*
//A2F2CNTL DD *
  SUM FIELDS=NONE
/*
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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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