Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to compare two files

902 views
Skip to first unread message

René E. Breedveld

unread,
Oct 10, 2003, 12:09:54 PM10/10/03
to
Does anybody know a tool to identical files from different machines.

I am thinking of an RPG where the two files can be compared and
if any differences found, write the to a third file.

Or should I use embedded SQL?

First create a CL-program which copies both files via ddm, to files in
xxlib.
Then compare each record. I tried the Iseries command cmpfile but this is
useless.

Regards,
René


Ken

unread,
Oct 11, 2003, 12:10:19 AM10/11/03
to
Hi René -

On Fri, 10 Oct 2003 18:09:54 +0200, "René E. Breedveld"
<mrsc@_no_spam_xs4all.nl> wrote:

>Then compare each record. I tried the Iseries command cmpfile but this is
>useless.

I have found that the OS/400 command CMPPFM works well if the record
length is not too long and the members do not have too many records.

Ken
http://www.ke9nr.net/
Opinions expressed are my own and do not necessarily represent the views of my employer or anyone in their right mind.

René E. Breedveld

unread,
Oct 11, 2003, 12:03:16 PM10/11/03
to
Hi Ken,

We have had a system crash and had to do a reload.
Because we mirrored our production files with mimix, after the reload we
restored the files from our fallbackmachine.
After a few days we noticed some corrupted files between the restored
machine and an other production machine.
After some checking we discoverd that mimix didn't replicate the files
correctly without displaying any errors.

So now we'll have to compare the files from the two production machines to
discover corrupted files.
Because we have files with over 60000 records we must find/develope a tool
which reads two files from the production data,
compare them and write differences to a third keyed file. So that we can use
the third file for recover actions.

The CMPPFM can't handle this the correct way.
I think the only way is to use RPG comparing both files and write
differences to a third.

While I am just a hobby system (programmer) I can't figure out how to
program this in RPG or CL.
Because of the large files I think a combination of RPG and maybe SQL would
give the fastest throughput.

Two files as read, rename the fields, compare and write to outfile.
Do I have to use a datastructure or embedded SQL or .......


/René

"Ken" <ng3122@ke9nr.#nospam#.net> wrote in message
news:jj0fovci88e9v0i6s...@4ax.com...

*NONE

unread,
Oct 11, 2003, 12:21:55 PM10/11/03
to
Was the corruption caused by a bug in the Mimix software ?


"René E. Breedveld" wrote

Ken

unread,
Oct 11, 2003, 6:59:32 PM10/11/03
to
Hi René -

On Sat, 11 Oct 2003 18:03:16 +0200, "René E. Breedveld"
<mrsc@_no_spam_xs4all.nl> wrote:

>Two files as read, rename the fields, compare and write to outfile.
>Do I have to use a datastructure or embedded SQL or .......

I'm not familiar with the Mimix product, however if it works off
journal receivers like Vision, the files should be identical at a
relative record number level. To check this, you definitely want to
stay away from SQL or anything else like that which has access
optimization.

I think you could check all files with the same RPG program using
program-described files. Have file1 and file2, both with whatever the
longest record length is of any your files. Read both files in tandem
in arrival sequence. Use a file information data structure with each
file so that you can keep track of the record numbers to tell if any
deleted records were skipped. Pass in the record length as a
parameter. Compare that number of bytes of record data from the
files.

Print error messages for any records that are deleted in one file but
not the other, for any extra records that are in one file but not the
other, and anytime there is a data mismatch.

You could write all of the identical records to a program-described
output file, including or not including any differences, whatever you
need.

Before running the program, override file1 to the file from the one
system and file2 to the file from the other system.

If you want an output file, use CRTDUPOBJ to create an empty duplicate
and override your program-described output file to it.

Hopefully this gives you some ideas on how to roll your own file
compare program.

Saml

unread,
Oct 11, 2003, 7:49:11 PM10/11/03
to
Either Midrange Computing or iSeries New published a command/program pre Y2k
that compare two files and displayed the difference. As I recollect, it
would work by key or by RRN. If you can find the source you could modify it
to write out the changes. Unfortunately I can't remember the name of the
command.

TAATOOLs library has a CMPDBF command that prints difference in two files.
If you buy their product you get the source which you could probably adapt.

If you want to do your own in RPG IV, I think I'd approach it by reading the
same file twice into my program. You'll need to rename the record format.
You'll need to rename the fields using PREFIX on the F spec. Create
externally defined data structures for each of record and then you can
compare for inequality by comparing the data structures in in one statement.

Sam

"René E. Breedveld" <mrsc@_no_spam_xs4all.nl> wrote in message
news:1065888202.362684@cache2...

Saml

unread,
Oct 11, 2003, 9:07:34 PM10/11/03
to
It was a command named CMPF, from an article by Julian Monypenny back in
1993. I don't think those archives are available any more at the
http://iseriesnetwork.com/ site. If you are interested in the source I can
probably zip it up and send it to you.

Sam

"Saml" <no...@nonesuch.com> wrote in message
news:4G0ib.142$T82....@eagle.america.net...

René E. Breedveld

unread,
Oct 12, 2003, 11:19:14 AM10/12/03
to
Sam,

That would be very usefull, the thing is I do some programming myself.
But first of all I am a system manager, and I develope system management
tools.

The program I need is normally I program which should be created by an
application programmer.
I understand RPG and can enhance sources but pure creating such a tool as
this from the blank, is a bit out of my reach.

I know what should be in it but I need samples how to create two
datastructures from two identical files, actually three (one output).

Thanks in advance,
René

"Saml" <no...@nonesuch.com> wrote in message

news:uP1ib.147$T82....@eagle.america.net...

*NONE

unread,
Oct 12, 2003, 11:40:48 AM10/12/03
to
Before you go writing some tools,
you may want to ask Mimix what they might have to help ?

Seems they would have already written these tools
for both testing their own software (I hope)
and assisting in customer system recovery.

"René E. Breedveld" <mrsc@_no_spam_xs4all.nl> wrote in message

news:1065971963.142988@cache1...

René E. Breedveld

unread,
Oct 12, 2003, 12:25:27 PM10/12/03
to
Maybe you are right, but then again their mirroring software isn't aware of
errors/changes to db-files.
So we lost our confidence in their "high availabillity suite".

/René

"*NONE" <spa...@this-address.com> wrote in message
news:4Ceib.15817$hp5.1841@fed1read04...

Saml

unread,
Oct 12, 2003, 3:29:09 PM10/12/03
to
I tried to e-mail you a zip file. From what I can tell, I should take the
_no_spam_ out of your e-mail address below. I tried this and it came back
"550 ... User unknown". I don't know of any way to deliver zip files via
newsgroup, so I need an e-mail address. It lookes like the xs4all bit is
correct, but the mrsc bit isn't?

Sam

"René E. Breedveld" <mrsc@_no_spam_xs4all.nl> wrote in message

news:1065971963.142988@cache1...

René E. Breedveld

unread,
Oct 13, 2003, 3:56:37 PM10/13/03
to
Sam,

it should work:
mr...@nospamxs4all.nl or try rene.br...@nospambeers.nl

Remove the word nospam
thanks in advance.

Regards,
René

"Saml" <no...@nonesuch.com> wrote in message

news:dYhib.185$T82....@eagle.america.net...

Saml

unread,
Oct 13, 2003, 10:34:58 PM10/13/03
to
I sent it again to both address and it hasn't come back 3 hours later, so
perhaps I goofed last time.

Sam

"René E. Breedveld" <mrsc@_no_spam_xs4all.nl> wrote in message

news:1066075002.370926@cache2...

leszek

unread,
Oct 14, 2003, 2:20:18 AM10/14/03
to
First create a CL-program which copies both files via ddm, to files
in
> xxlib.
> Then compare each record. I tried the Iseries command cmpfile but
this is
> useless.
>

How many files You want compare?
Do You want compare each record in file?


Regards
Leszek G.


René E. Breedveld

unread,
Oct 17, 2003, 3:27:45 PM10/17/03
to
Sam,

Thanks again for your tool, it works fine and good documented too!

/René

"Saml" <no...@nonesuch.com> wrote in message

news:rhJib.256$T82....@eagle.america.net...

Saml

unread,
Oct 17, 2003, 9:42:03 PM10/17/03
to
Glad to have been of help. Thank Julian Monypenny and the folks at iSeries
News (http://www.iseriesnetwork.com/) who published the original program.

Sam


"René E. Breedveld" <mrsc@_no_spam_xs4all.nl> wrote in message

news:1066418867.268483@cache1...

0 new messages