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
 

 

Compare two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon Jun 27, 2011 3:33 pm    Post subject: Compare two files
Reply with quote

Hello,

Can you please suggest how can we do this

File1 is FB of length 240
File2 is FB of length 240

File1
Code:
1 ABCD                                             1234567890
1 ABCDE                                            1234567890
1 ABCDEF                                           1234567890
1 ABCDEFG                                          1234567890
1 ABCDK                                            1234567890
1 ABCDL                                            1234567890

FILE2
Code:
1   ABCD 
2   MNOP
3   XYZX
1   ABCDE
2   MNOP
3   XYZX
4   MAZA
1   ABCDEF
2   MNOP
3   XYZX
4   MAZA
10 PAWA
1 ABCDEFG
2   MNOP
3   XYZX
4   MAZA
10 PAWA
1 ABCDK
2   MNOP
3   XYZX
5   MAZA
1 ABCDL
4   MNOP
5   XYZX
6   MAZA


Output should be
Code:
1 ABCD                                             1234567890
1   ABCD 
2   MNOP
3   XYZX
1 ABCDE                                            1234567890
1   ABCDE
2   MNOP
3   XYZX
4   MAZA
1 ABCDEF                                           1234567890
1   ABCDEF
2   MNOP
3   XYZX
4   MAZA
10 PAWA
1 ABCDEFG                                          1234567890
1 ABCDEFG
2   MNOP
3   XYZX
4   MAZA
10 PAWA
1 ABCDK                                            1234567890
1 ABCDK
2   MNOP
3   XYZX
5   MAZA
1 ABCDL                                            1234567890
1 ABCDL
4   MNOP
5   XYZX
6   MAZA


* We are nothing but comparing two files and copying data from file2 to output file by merging records from file1
* File1 and file2 records which starts with record type 1 needs to be compared for first 100 bytes, if file1 recordtype 1 first 100 bytes are equal to file2 record type1 first 100 bytes we need to copy file 1 record with type1 to output file before copying records of file2
* there wont be any dublicates in file1 and file2, there will be only one match for record type1

please suggest
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 27, 2011 4:53 pm    Post subject:
Reply with quote

Mazhar,
Can there be orphan records in either files? If yes, please show sample records and expected output.

Also, refer to below post and provide your dfsort function level.

http://ibmmainframes.com/viewtopic.php?t=33389

Thanks,
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon Jun 27, 2011 5:13 pm    Post subject:
Reply with quote

Quote:
Can there be orphan records in either files? If yes, please show sample records and expected output.

No there wont be any orphan records, there will be a corresponding record type 1 of file1 in file2

Quote:
refer to below post and provide your dfsort function level.


2008 DFSORT functions will support[/quote]
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 27, 2011 6:01 pm    Post subject:
Reply with quote

Mazahar,
I am not trying to be picky but...
Quote:
No there wont be any orphan records, there will be a corresponding record type 1 of file1 in file2
and vice-versa?

Also based on your sample input, your first 100 bytes doesn't match for 2 files, For example, "1 ABCD" has 1 space between 1 and A and file2 record is "1 ABCD" has 3 spaces!!!

Please explain this rule.

Thanks,
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon Jun 27, 2011 6:04 pm    Post subject:
Reply with quote

Sqlcode,

Thanks for the responce, Yes, its vice-versa

Record format is record type starts at first byte in both the files and then two bytes spaces then actual data starts.

Thank You
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 27, 2011 7:12 pm    Post subject:
Reply with quote

Mazahar,
Assuming 2 byte record type starting at 1st position (Record "10 PAWA"). If your record type is 1 byte, then change BEGIN condition to use 1,1,zd...
Code:
//STEP0001     EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DISP=SHR,DSN=TEST.FB25001                         
//         DD DISP=SHR,DSN=TEST.FB25002                         
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,1),PUSH=(252:1,100))
 SORT FIELDS=(252,100,CH,A),EQUALS                             
 OUTFIL BUILD=(1,250)                                           
/*                                                             

Thanks,
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon Jun 27, 2011 7:29 pm    Post subject:
Reply with quote

SQL CODE

I am getting below error can you please suggest if push increases the size of record

Sortin : RECFM FB ; LRECL=240
INREC record length 351
potentially in sufficient use of inrec
sortout recfm=fb,lrecl=240

Please suggest
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Jun 27, 2011 8:09 pm    Post subject:
Reply with quote

Mazahar,
When posting error messages, make sure you post message id to identify your sort product. Looks like you have Syncsort installed.
Code:
WER238I  POTENTIALLY INEFFICIENT USE OF INREC

Just my 2 cents. If you have DCB parameters coded for output file, remove them and rerun the same job.

Quote:
I am getting below error can you please suggest if push increases the size of record
Yes, refer to your product manual.

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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 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
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
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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