Page 1 of 1

Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 11:32 am
by meddy_2725
Hi all,I need to create a rexx utility that takes file1 and file2 as input along with their copybooks (copy1 and copy2 respectively)
and compares these 2 files to find if they are similar or not.

Though Copy1 and copy2 are almost same, but it can have some fields that have different data storage type i.e. For e.g field1 in both the files is ACC-AMOUNT but in file1 we are storing it in binary format and in file2 it is stored in Hexadecimal format.

I need to convert this field1 in both the files to some common comparable format in order to compare these files and get the relevant results.

Can we do this with REXX ? or using some other tool ? Can we open and read a file with its copybook layout in REXX just like we do in FILEAID?

Thanks in advance.
Meddy

Re: Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 2:30 pm
by NicC
Can we do this with REXX ?
Yes but why not just write a COBOL program for each file and convert to a common format and use SUPERC to compare. Or one program to read both files using their respective copybooks, copy each matching record into compatible working storage records and compare these?

Can we open and read a file with its copybook layout in REXX just like we do in FILEAID?
Sort of. Rexx is a programming language and File-aid is a tool that has been written in a programming language. To get the rexx program to do what file-aid does will require quite a bit of programming which may be beyond your abilities considering you asked this question.

Re: Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 2:50 pm
by meddy_2725
Thanks NicC for your suggestion.

Yes but why not just write a COBOL program for each file and convert to a common format and use SUPERC to compare. Or one program to read both files using their respective copybooks, copy each matching record into compatible working storage records and compare these?


I wanted to build an interactive utility where user just enters the filenames and their respective copybook names and get the desired results.Thats why I was considering to use REXX. Can you throw some light on how can we do this with REXX ?

if using REXX, is parsing the only way to do it? and how can we convert the COMPs into some other format?

Regards,
Meddy

Re: Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 6:21 pm
by NicC
You will probably have to do a lot of parsing. Converting the packed decimal to zoned decimal, and vice versa, can be done by routines commonly available on the internet and, possibly, on this forum.

Re: Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 7:46 pm
by dick scherrer
Hello and welcome to the forum,

First, you need to understand that what you want to do is far from trivial. . .

Before you start any coding map how you want the process to work - in detail. If you do not have a process defined, code will be most difficult or impossible to implement.

Suggest you re-consider Nic's suggestion and write the COBOL code to create a common file or read the files as they are and compare within nthe code. . .

Re: Rexx to compare files having different copybook layout

PostPosted: Wed Dec 18, 2013 9:13 pm
by NicC
You could always try and merge the two approaches - use Rexx/ISPF to get and allocate the dataset names and then call the COBOL program from the Rexx program.

Re: Rexx to compare files having different copybook layout

PostPosted: Thu Dec 19, 2013 11:16 am
by meddy_2725
I was also thinking to implement the same- calling COBOL from REXX program. I will finalize the process flow and try my hands on it now.

Thanks NicC and Dick for your suggestions :)

Re: Rexx to compare files having different copybook layout

PostPosted: Thu Dec 19, 2013 8:04 pm
by dick scherrer
You're welcome, good luck :)

d

Re: Rexx to compare files having different copybook layout

PostPosted: Thu Oct 31, 2019 1:50 pm
by hrao7
Hi Meddy,

Did you able to develop a file comparison utility, I am also trying to build a similar utility which can compare two files by providing there layouts

Regards!
Himanshu

Re: Rexx to compare files having different copybook layout

PostPosted: Thu Oct 31, 2019 2:10 pm
by enrico-sorichetti
topic locked,
no reason to resurrect a 6 years old topic,
and ask directly somebody whose last activity on the forum was on dec, 23 2013