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 file

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

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Fri Nov 27, 2009 10:50 pm    Post subject: comparing file
Reply with quote

1) to extract the last record from file A and compare the extracted record with records from file B, If a match is found place duplicate records in file C,
If file B also has duplicate records, they needs to be placed in file C,
2) File D to contain unique records

Files record length 2000 and Fixed block.

For example

FILE A records

AAAAAAAAAXYAA12345
BBBBBBBBBXYBB17890
CCCCCCCCCXYCC22222
CCCCCCCCCXYCC22222
DDDDDDDDDXYDD44444
EEEEEEEEEXYEE55555

FILE B

AAAAAAAAAXYAA12346
BBBBBBBBBXYBB17898
CCCCCCCCCXYCC22222
FFFFFFFFFFXYFF33333
DDDDDDDDDXYDD44444

file C output

CCCCCCCCCXYCC22222
CCCCCCCCCXYCC22222
DDDDDDDDDXYDD44444 -> from File A
DDDDDDDDDXYDD44444 -> from file B

file D output

AAAAAAAAAXYAA12345
BBBBBBBBBXYBB17890
EEEEEEEEEXYEE55555

Comparison of file A and B is done on columns 14 to 18

I am having a limitation to use SUBSET, GROUP functions and created the below jcl for this
Code:

//STEP021   EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                               
//DFSMSG    DD  SYSOUT=*                                               
//IN1 DD DSN=FILE1,DISP=SHR                                     
//IN2 DD DSN=FILE2,DISP=SHR                                     
//T1  DD DSN=FILE3,                                             
//*                                                                     
//OUT DD DSN=FILE4,                                             
//*
//OUT1 DD DSN=FILE5,                                             
//*-----------------------------------------------------------------   
//TOOLIN DD *                                                           
COPY FROM(IN2) TO(T1) USING(CTL2)                                       
COPY FROM(IN1) TO(T1) USING(CTL1)                                       
SELECT FROM(T1) TO(OUT) ON(14,4,CH) NODUPS USING(CTL3) DISCARD(OUT1)     
//CTL1CNTL DD *                                                         
  INREC OVERLAY=(2001:SEQNUM,8,ZD)                                     
  SORT FIELDS=(2001,8,ZD,D)                                             
  OUTFIL FNAMES=T1,ENDREC=01,BUILD=(1,2000)                             
/*                                                                     
//CTL2CNTL DD *                                                         
  INCLUDE COND=(10,2,CH,EQ,C'XY')                                       
  INREC OVERLAY=(2000:C'1')                                             
/*                                                                     
//CTL3CNTL DD *                                                         
     OUTFIL FNAMES=OUT,INCLUDE=(2000,1,CH,EQ,C'1'),                     
     BUILD=(1,1999,1X)                                                 
/*           

But in CTL2CNTL column 2000 is overlayed, that overtypes if data is already available in column 2000.
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: Mon Nov 30, 2009 11:38 pm    Post subject:
Reply with quote

Your description of what you want is very confusing and your example doesn't help.

Quote:
to extract the last record from file A and compare the extracted record with records from file B, ...


The last record in file A is the 55555 record - there's no match for this in File B, so I don't understand your 1) rule.

In File C, where do the two 22222 records come from (file A or file B or both)? Why do the 44444 records come from fileA and fileB?

You need to show a better example of input and expected output that makes it clear where each output record comes from. You need to do a better job of explaining the "rules" for getting from input to output.
Back to top
View user's profile Send private message
sumitmalik29
Warnings : 1

New User


Joined: 10 Feb 2008
Posts: 19
Location: bhuneswar

PostPosted: Tue Dec 08, 2009 6:10 pm    Post subject:
Reply with quote

Frank, Very Sorry for creating confusion.
Instead of writing file A , I have written file B and vice-versa

Correcting the rule 1
I have to compare the last record from file B i.e. (44444) with the records from file A.

Now the last record (44444) from file B matches with record from file A, these matching records will be placed in file C.
Also the file A has duplicate records within itself i.e. (22222) so they will also be placed in file C.

Now the records left in file A will be unique and will be put to file D

File D records:
12345
17890
55555

Thanks
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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