Rexx to compare files having different copybook layout



IBM's Command List programming language & Restructured Extended Executor

Rexx to compare files having different copybook layout

Postby meddy_2725 » Wed Dec 18, 2013 11:32 am

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
Regards,
Meddy
meddy_2725
 
Posts: 6
Joined: Tue Dec 17, 2013 5:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rexx to compare files having different copybook layout

Postby NicC » Wed Dec 18, 2013 2:30 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Rexx to compare files having different copybook layout

Postby meddy_2725 » Wed Dec 18, 2013 2:50 pm

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
Regards,
Meddy
meddy_2725
 
Posts: 6
Joined: Tue Dec 17, 2013 5:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rexx to compare files having different copybook layout

Postby NicC » Wed Dec 18, 2013 6:21 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Rexx to compare files having different copybook layout

Postby dick scherrer » Wed Dec 18, 2013 7:46 pm

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. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Rexx to compare files having different copybook layout

Postby NicC » Wed Dec 18, 2013 9:13 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Rexx to compare files having different copybook layout

Postby meddy_2725 » Thu Dec 19, 2013 11:16 am

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 :)
Regards,
Meddy
meddy_2725
 
Posts: 6
Joined: Tue Dec 17, 2013 5:34 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rexx to compare files having different copybook layout

Postby dick scherrer » Thu Dec 19, 2013 8:04 pm

You're welcome, good luck :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Rexx to compare files having different copybook layout

Postby hrao7 » Thu Oct 31, 2019 1:50 pm

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
hrao7
 
Posts: 1
Joined: Thu Oct 31, 2019 1:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Rexx to compare files having different copybook layout

Postby enrico-sorichetti » Thu Oct 31, 2019 2:10 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post