View previous topic :: View next topic
|
Author |
Message |
rameyshkanthan v
New User
Joined: 15 Nov 2013 Posts: 10 Location: India
|
|
|
|
Hi All,
I want to compare the records in two different ISPF tables. Is there any table service for this purpose. Or should I unload the table to a dataset and then compare the records.
The table A and table B has same column names, I want to compare the values of column1 in table A with values of column2 in table B and figure out whether they match or not.
Both are keyed tables.
Thanks |
|
Back to top |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
|
|
I guess there are no table services to directly compare two ISPF tables. You can probably write a logic using REXX (using TBSCAN forward search from top) to read and compare the tables. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Tables should be members in a PDS, so what's the problem ? |
|
Back to top |
|
|
Stefan
Active User
Joined: 12 Jan 2006 Posts: 110 Location: Germany
|
|
|
|
ISPF tables can only be stored in PDS members. But their structure does not fit into the record structure of this file system. The number of fields might not be fixed with all table records. In addition the length of the fields is never fixed.
This causes ISPF to store table data in a "stream-like" format with some header data followed by the record data with each column separated by special characters (x'00') and a hex length field introducing and identifying the following data as column contents. The data of each table row is written up to the length of the current record and then continued in the next record.
So it is impossible to use a simple file compare utility which assumes that every record has the same layout.
I recommend exporting the table data to two datasets with the ISPF Table Utility (usually option 3.16) and then run a compare on the resulting datasets.
If you need to do it programmatically I'm pretty sure that you have to follow TheMFKid's advice. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
compare the values of column1 in table A with values of column2 in table B |
Stefan and theMFkid are right, but even then the col1 and col2 requirement makes the task a little harder. Even if there was a tool to compare table to table, you might still need to write your own to compare col to col.
Quote: |
Tables should be members in a PDS, so what's the problem |
As Stefan pointed out, the table structure does not map well in to FB80 records. A change in the first row will cause a change in all subsequent records, making a normal member comparison meaningless. |
|
Back to top |
|
|
rameyshkanthan v
New User
Joined: 15 Nov 2013 Posts: 10 Location: India
|
|
|
|
Thank you all, I have coded the logic in REXX (TBSCAN) |
|
Back to top |
|
|
|