MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparing two files with different layouts

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 706
Topics: 65
Location: MD, USA

PostPosted: Wed Sep 09, 2026 8:48 am    Post subject: Comparing two files with different layouts Reply with quote

Hi,

I have file-aid DB2 RDX extracts of two versions of a database in flat files. I have corresponding XREF and COBOL layout. Is there a way to compare the common fields in the two files. I am thinking of generating file-aid compare cards for these two layouts but checking if a simpler solution exists.


Diba.


Edit:

Comparison report should report all differences at field level with field names and old and new values, like -

Code:
FIELDA:     123456   | 234567
FIELDC:     DIBAKAR  | RAKABID
FIELDABC:   MVS      | ZOS

_________________
Regards,
Diba


Last edited by Dibakar on Thu Sep 10, 2026 2:34 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12406
Topics: 75
Location: San Jose

PostPosted: Thu Sep 10, 2026 7:56 am    Post subject: Reply with quote

Dibakar,

You can use DFSORT's JOINKEYS to compare the files with different layouts. You can check the smart-tricks

https://www.ibm.com/support/pages/smart-dfsort-tricks

    Join fields from two files on a key
    Join fields from two files record-by-record
    Cartesian join
    Create files with matching and non-matching records

Here is the documentation of JOINKEYS
https://www.ibm.com/docs/en/zos/3.2.0?topic=guide-using-joinkeys-application-joining-two-files
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 706
Topics: 65
Location: MD, USA

PostPosted: Thu Sep 10, 2026 2:38 pm    Post subject: Reply with quote

Thanks Kolusu. I need differences at field level with field names, edited my post with a sample report. I think it would be challenging to do that with DFSORT.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12406
Topics: 75
Location: San Jose

PostPosted: Thu Sep 10, 2026 8:39 pm    Post subject: Reply with quote

Dibakar wrote:
Thanks Kolusu. I need differences at field level with field names, edited my post with a sample report. I think it would be challenging to do that with DFSORT.


Dibakar,

Challenging but very much do-able. So please post a sample of BOTH input files along with desired output along with DCB properties of the input and output files and we will see if it can be done using DFSORT.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 706
Topics: 65
Location: MD, USA

PostPosted: Fri Sep 11, 2026 8:32 am    Post subject: Reply with quote

Kolusu,

For input there will be two sets (old and new) each of - File-Aid Xref, Cobol layout and data files. Automation will have to process all these to generate the compare code. It will take some time for me to create them that I can post here.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 706
Topics: 65
Location: MD, USA

PostPosted: Mon Sep 14, 2026 10:47 am    Post subject: Reply with quote

Here are the details.

Cobol layouts, old and new versions. Each '01' level represents a DB2 table, naming format is <db2 schema name>-<DB2 table name>. Schema name can change in different versions, but table name will remain same. Table order can change in the layout. Old table can get deleted from old layout and new tables can get added in new layout. Level '10' fields, represents table fields. The names remain same in different versions, but ordering can be different. Old fields can get deleted from old layout and new fields can get added to new layout.

Old layout - SYS.LAYOUT(BOL):
Code:

      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMAOL ADDRESA                       *       
      ******************************************************************       
       01  SCHMAOL-ADDRESA.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDR-LOC-CD                PIC X(2).                           
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMAOL ADDRESB                       *       
      ******************************************************************       
       01  SCHMAOL-ADDRESB.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDR-LOC-CD                PIC X(2).                           
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMAOL ADDRESC                       *       
      ******************************************************************       
       01  SCHMAOL-ADDRESC.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDR-LOC-CD                PIC X(2).                           
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR                                        *       
      *   OBJECT:         NON-DATA-RECORDS                             *       
      *   LAYOUT DSN:     NOT.APPLICABLE                               *       
      *   LAYOUT MEMBER:  DEFAULT                                      *       
      *   01 LEVEL NAME:  OBJECT-DFLT                                  *       
      ******************************************************************       
       01  OBJECT-DFLT.                                                         
           05 RECORD-ID-DFLT-DATA PIC X(27990).                                 


New layout - SYS.LAYOUT(BNU):
Code:

      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMANU ADDRESC                       *       
      ******************************************************************       
       01  SCHMANU-ADDRESC.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDR-LOC-CD                PIC X(2).                           
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMANU ADDRESB                       *       
      ******************************************************************       
       01  SCHMANU-ADDRESB.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
              10 ADDR-CITY                  PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR  SCHMANU ADDRESD                       *       
      ******************************************************************       
       01  SCHMANU-ADDRESD.                                                     
           05 NULL-INDICATORS.                                                 
              10 ADDRLN-2                   PIC S9(4) COMP.                     
           05 COBOL-ADDRESS.                                                   
              10 ADDR-UID                   PIC S9(9) COMP.                     
              10 ADDR-LOC-CD                PIC X(2).                           
              10 ADDRLN-1                   PIC X(40).                         
              10 ADDRLN-2                   PIC X(40).                         
      ******************************************************************       
      * COBOL RECORD LAYOUT FOR                                        *       
      *   OBJECT:         NON-DATA-RECORDS                             *       
      *   LAYOUT DSN:     NOT.APPLICABLE                               *       
      *   LAYOUT MEMBER:  DEFAULT                                      *       
      *   01 LEVEL NAME:  OBJECT-DFLT                                  *       
      ******************************************************************       
       01  OBJECT-DFLT.                                                         
           05 RECORD-ID-DFLT-DATA PIC X(27990).                                 


Xref tells which record to map with which '01' layout. For example the old XREF below tells that if input record has value 'D002', called D#, at position 7 then map record with the old layout 'SCHMAOL-ADDRESB'. If the D# is anything other than 'D001' thru 'D003', then match it with the OBJECT-DFLT layout.

Old Xref:
Code:

/* CAUTION: If you edit this member manually, with the File-AID
/* editor or any other editor, immediately issue the command:   
/*    PRESERVE ON      (or its equivalent)                     
/* to preserve trailing blanks which are required by File-AID. 
/*                                                             
/* When you edit criteria outside of File-AID, member type     
/* identification (XREF/CHGC/SELC) may be lost. File-AID will   
/* include unidentified members in all Member List displays;   
/* selecting the correct member is a customer responsibility.   
/*                                                             
/* COMPUWARE ASSUMES NO LIABILITY FOR RESULTS OF USING MEMBERS 
/* THAT HAVE BEEN EDITED MANUALLY.                             
/*                                                             
/* Copyright (c) 1993-2008 by COMPUWARE Corporation,           
/* All Rights Reserved.                                         
/*                                                             
/*                                                             
 
DEFINE BLOCKS=XREF,
 
DESCRIPTION ="FILE-AID/RDX GENERATED XREF",
 
       LAYOUT_DSNAME=SYS.LAYOUT,                     
       LAYOUT_FILLER=10
 
SELECT SET=1,LAYOUT=SCHMAOL-ADDRESA,
       LAYOUT_MBRNAME=BOL,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D001
 
SELECT SET=1,LAYOUT=SCHMAOL-ADDRESB,
       LAYOUT_MBRNAME=BOL,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D002
 
SELECT SET=1,LAYOUT=SCHMAOL-ADDRESC,
       LAYOUT_MBRNAME=BOL,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D003
 
SELECT SET=1,LAYOUT=OBJECT-DFLT,
       LAYOUT_MBRNAME=BOL,
       LAYOUT_TYPE=DEFAULT
 


New Xref:
Code:

/* CAUTION: If you edit this member manually, with the File-AID
/* editor or any other editor, immediately issue the command:   
/*    PRESERVE ON      (or its equivalent)                     
/* to preserve trailing blanks which are required by File-AID. 
/*                                                             
/* When you edit criteria outside of File-AID, member type     
/* identification (XREF/CHGC/SELC) may be lost. File-AID will   
/* include unidentified members in all Member List displays;   
/* selecting the correct member is a customer responsibility.   
/*                                                             
/* COMPUWARE ASSUMES NO LIABILITY FOR RESULTS OF USING MEMBERS 
/* THAT HAVE BEEN EDITED MANUALLY.                             
/*                                                             
/* Copyright (c) 1993-2008 by COMPUWARE Corporation,           
/* All Rights Reserved.                                         
/*                                                             
/*                                                             
 
DEFINE BLOCKS=XREF,
 
DESCRIPTION ="FILE-AID/RDX GENERATED XREF",
 
       LAYOUT_DSNAME=SYS.LAYOUT,                     
       LAYOUT_FILLER=10
 
SELECT SET=1,LAYOUT=SCHMANU-ADDRESC,
       LAYOUT_MBRNAME=BNU,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D001
 
SELECT SET=1,LAYOUT=SCHMANU-ADDRESB,
       LAYOUT_MBRNAME=BNU,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D002
 
SELECT SET=1,LAYOUT=SCHMANU-ADDRESD,
       LAYOUT_MBRNAME=BNU,                 
       LAYOUT_TYPE=BASE
 IF
       POSITION=7,LENGTH=4,OPERATOR=EQ,           
       TYPE=T,VALUE=D003
 
SELECT SET=1,LAYOUT=OBJECT-DFLT,
       LAYOUT_MBRNAME=BNU,
       LAYOUT_TYPE=DEFAULT
 


Input data files, it will only have table records common to both versions, only one record for each table. It will have 1-1 match between two files, 1st record in old file and new file will represent same table (even though they will have different D# values at position 7). Second record in both files will again represent same table, and so on. Below first record in both files represent ADDRESB table, 2nd record in both files represent ADDRESC table. '.'s represent binary field(s) data.

Old data file:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
000001D002......MD100 FREEDOM ST                          FREEDOM VALLEY       
000001D003......MD100 FREEDOM ST                          FREEDOM VALLEY       
000001D999......MD100 FREEDOM ST                          FREEDOM VALLEY       
******************************** Bottom of Data ********************************


New data file:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
000001D002......200 FREEDOM ST                          FREEDOM VALLEY         
000001D001......MD100 FREEDOM ST                          FREEDOM VALLEY       
000001D999......MD100 FREEDOM ST                          FREEDOM VALLEY       
******************************** Bottom of Data ********************************


Sample file-aid comparison report. It can be in any format, as long as it gives me the required information - Record number, group and elementary field names, old and new values.
Code:

FILE-AID 23.1   COMPARE DETAIL REPORT              USERID-#USERFAC       DATE 09/14/2026        TIME 11:33:17        PAGE         1
"OLD" DSN: SYS.FNCTST.IN(BOL)                     "NEW" DSN: SYS.IN(BNU)
===================================================================================================================================
CHANGED RECORD       "OLD" FILE RECORD:         1                |                     "NEW" FILE RECORD:         1
 NUM DATA-FIELD-NAME               FORMAT   FIELD VALUES         | NUM DATA-FIELD-NAME               FORMAT   FIELD VALUES
---- ---------------------------- -------- --------------------  |---- ---------------------------- -------- --------------------
   1 SCHMAOL-ADDRESB                                             |   1 SCHMANU-ADDRESB
                                                                 |
>>> COMPARED FIELDS -    -    -    -    -    -    -    -    -    |    -    -    -    -    -    -    -    -    - COMPARED FIELDS <<<
                                                                 |
   6 ADDR-UID                     BS  9    11                    |   6 ADDR-UID                     BS  9    22
   8 ADDRLN-1                     C     40 100 FREEDOM ST        |   7 ADDRLN-1                     C     40 200 FREEDOM ST
     (POS 21-40)                                                 |     (POS 21-40)
                                                                 |
===================================================================================================================================
 
 
                                                **** E N D   O F   R E P O R T ****

_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Thu Nov 19, 2026 11:25 am    Post subject: Reply with quote

untested Yes, DFSORT can produce this report. There are two steps. The first joins the two files record by record and marks each common field as same or different. The second keeps only the different fields and prints them with field names, old values and new values.

Manual features it relies on

JOINKEYS on a sequence number. Your two files match record 1 to record 1, so I add a SEQNUM in each JNFnCNTL and join on it. If you specify SORTED and know the records are already in order by the keys, NOSEQCK tells DFSORT not to check the order, which can improve performance.

Comparing one field to another in the same record. INCLUDE and WHEN conditions can compare two compare fields or a compare field and a constant. This is how an old field is tested against its new counterpart in the joined record.

CH compare length limit. CH compare fields can be 1 to 256 bytes. This matters for OBJECT-DFLT (see notes).

Several output lines from one record. OUTFIL can do creation of multiple output records from each input record using the / operator, so each joined record becomes one line per field.

HIT=NEXT. All the INREC IFTHENs use HIT=NEXT, so each record goes through every test. The OUTFIL IFTHENs build with /, and HIT=NEXT is ignored when you have BUILD with / in the IFTHEN clause. That?s why those OUTFIL clauses don?t have it.


Positions used. The XREF has LAYOUT_FILLER=10, so each layout starts at byte 11 of the data record. JNFnCNTL keeps bytes 1-200 and adds the SEQNUM at 201. The REFORMAT then lays out the joined record like this:

Joined bytes Contents Position rule
1-8 Record number
9-208 Old record old position p → 8+p
209-408 New record new position p → 208+p
409 Table id (B, C, or X = default)
410-419 One diff flag per field (?D? = different)

Step 1: join, compare, one line per common field
Code:

//STEP01   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//OLD      DD DISP=SHR,DSN=Your.Old.RDX.Extract
//NEW      DD DISP=SHR,DSN=Your.New.RDX.Extract
//SORTOUT  DD DSN=&&FLDS,DISP=(,PASS),SPACE=(CYL,(10,10),RLSE),
//            RECFM=FB,LRECL=180
//JNF1CNTL DD *
  INREC BUILD=(1,200,SEQNUM,8,ZD)
//JNF2CNTL DD *
  INREC BUILD=(1,200,SEQNUM,8,ZD)
//SYSIN    DD *
  OPTION COPY
  JOINKEYS F1=OLD,FIELDS=(201,8,A),SORTED,NOSEQCK
  JOINKEYS F2=NEW,FIELDS=(201,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:201,8,F1:1,200,F2:1,200)
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(409:C'X',10C' ')),
   IFTHEN=(WHEN=(15,4,CH,EQ,C'D002',AND,215,4,CH,EQ,C'D002'),
           OVERLAY=(409:C'B'),HIT=NEXT),
   IFTHEN=(WHEN=(15,4,CH,EQ,C'D003',AND,215,4,CH,EQ,C'D001'),
           OVERLAY=(409:C'C'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'B',AND,19,2,BI,NE,219,2,BI),
           OVERLAY=(410:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'B',AND,21,4,BI,NE,221,4,BI),
           OVERLAY=(411:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'B',AND,27,40,CH,NE,225,40,CH),
           OVERLAY=(412:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'B',AND,67,40,CH,NE,265,40,CH),
           OVERLAY=(413:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C',AND,19,2,BI,NE,219,2,BI),
           OVERLAY=(410:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C',AND,21,4,BI,NE,221,4,BI),
           OVERLAY=(411:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C',AND,25,2,CH,NE,225,2,CH),
           OVERLAY=(412:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C',AND,27,40,CH,NE,227,40,CH),
           OVERLAY=(413:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C',AND,67,40,CH,NE,267,40,CH),
           OVERLAY=(414:C'D'),HIT=NEXT),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'X',AND,19,190,CH,NE,219,190,CH),
           OVERLAY=(410:C'D'))
  OUTFIL IFOUTLEN=180,
   IFTHEN=(WHEN=(409,1,CH,EQ,C'B'),
    BUILD=(410,1,1,8,10:C'SCHMAOL-ADDRESB',40:C'SCHMANU-ADDRESB',
      70:C'NULL-INDICATORS.ADDRLN-2',
      100:19,2,FI,EDIT=(SIIIIT),SIGNS=(,-),
      140:219,2,FI,EDIT=(SIIIIT),SIGNS=(,-),180:X,/,
      411,1,1,8,10:C'SCHMAOL-ADDRESB',40:C'SCHMANU-ADDRESB',
      70:C'COBOL-ADDRESS.ADDR-UID',
      100:21,4,FI,EDIT=(SIIIIIIIIIT),SIGNS=(,-),
      140:221,4,FI,EDIT=(SIIIIIIIIIT),SIGNS=(,-),180:X,/,
      412,1,1,8,10:C'SCHMAOL-ADDRESB',40:C'SCHMANU-ADDRESB',
      70:C'COBOL-ADDRESS.ADDRLN-1',100:27,40,140:225,40,/,
      413,1,1,8,10:C'SCHMAOL-ADDRESB',40:C'SCHMANU-ADDRESB',
      70:C'COBOL-ADDRESS.ADDRLN-2',100:67,40,140:265,40)),
   IFTHEN=(WHEN=(409,1,CH,EQ,C'C'),
    BUILD=(410,1,1,8,10:C'SCHMAOL-ADDRESC',40:C'SCHMANU-ADDRESC',
      70:C'NULL-INDICATORS.ADDRLN-2',
      100:19,2,FI,EDIT=(SIIIIT),SIGNS=(,-),
      140:219,2,FI,EDIT=(SIIIIT),SIGNS=(,-),180:X,/,
      411,1,1,8,10:C'SCHMAOL-ADDRESC',40:C'SCHMANU-ADDRESC',
      70:C'COBOL-ADDRESS.ADDR-UID',
      100:21,4,FI,EDIT=(SIIIIIIIIIT),SIGNS=(,-),
      140:221,4,FI,EDIT=(SIIIIIIIIIT),SIGNS=(,-),180:X,/,
      412,1,1,8,10:C'SCHMAOL-ADDRESC',40:C'SCHMANU-ADDRESC',
      70:C'COBOL-ADDRESS.ADDR-LOC-CD',100:25,2,140:225,2,180:X,/,
      413,1,1,8,10:C'SCHMAOL-ADDRESC',40:C'SCHMANU-ADDRESC',
      70:C'COBOL-ADDRESS.ADDRLN-1',100:27,40,140:227,40,/,
      414,1,1,8,10:C'SCHMAOL-ADDRESC',40:C'SCHMANU-ADDRESC',
      70:C'COBOL-ADDRESS.ADDRLN-2',100:67,40,140:267,40)),
   IFTHEN=(WHEN=NONE,
    BUILD=(410,1,1,8,10:C'OBJECT-DFLT',40:C'OBJECT-DFLT',
      70:C'RECORD-ID-DFLT-DATA',100:19,40,140:219,40))
/*


Each line in &&FLDS is laid out as follows:

Bytes Contents
1 Flag (?D? or blank)
2-9 Record number
10 Old 01-level name
40 New 01-level name
70 Group.field name
100 Old value
140 New value

Step 2: keep the different fields and print the report
Code:

//STEP02   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=&&FLDS,DISP=(OLD,DELETE)
//REPORT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INCLUDE COND=(1,1,CH,EQ,C'D')
  OUTFIL FNAMES=REPORT,REMOVECC,
   HEADER1=(1:C'FIELD LEVEL COMPARE REPORT',/,1:132C'='),
   SECTIONS=(2,8,
    HEADER3=(/,1:C'RECORD: ',2,8,3X,C'OLD: ',10,30,C'NEW: ',40,30,/,
             1:C'DATA-FIELD-NAME',32:C'OLD VALUE',73:C'| NEW VALUE',/,
             1:132C'-')),
   BUILD=(1:70,30,32:100,40,73:C'| ',140,40,132:X),
   TRAILER1=(/,C'FIELDS WITH DIFFERENCES: ',COUNT=(M10,LENGTH=8))
/*



Expected output for your sample. Records 2 (ADDRESC) and 3 (D999) are the same, so only record 1 shows. The UID values are taken from your sample report.

Code:

RECORD: 00000001   OLD: SCHMAOL-ADDRESB  NEW: SCHMANU-ADDRESB
DATA-FIELD-NAME                OLD VALUE                                | NEW VALUE
-----------------------------------------------------------------------------------
COBOL-ADDRESS.ADDR-UID                  11                              |          22
COBOL-ADDRESS.ADDRLN-1         100 FREEDOM ST                           | 200 FREEDOM ST


ADDR-LOC-CD is dropped from ADDRESB because it exists only in the old layout. ADDR-CITY is dropped because it exists only in the new layout. ADDRESA and ADDRESD never come up.

Generating the control cards. Everything in INREC and OUTFIL follows directly from the two layouts and the two XREFs, so your automation (REXX, for example) only has to write these cards:

Read the layouts. For each 01-level, the table name is the part after the schema prefix (ADDRESB). Each 10-level field is identified by its 05 group plus its name. Use both, because ADDRLN-2 appears under NULL-INDICATORS and under COBOL-ADDRESS.
Work out each field?s position and length. The start position is LAYOUT_FILLER + 1 + the total length of the fields before it. Lengths: X(n)=n; S9(1-4) COMP=2; S9(5-9) COMP=4; S9(10-18) COMP=8; COMP-3 = n/2+1.
Read the XREFs to map each D# value to its 01-level. Pair old and new tables by table name, which gives the table-id WHENs (for example old D003 with new D001).
For each field the two tables share, write one compare IFTHEN and one OUTFIL line:
Joined positions: old = p+8, new = p+208.
PIC X fields compare as CH.
COMP fields compare as BI and print as FI with EDIT.
COMP-3 fields compare and print as PD.
Flag bytes run 410 to 409+N, where N is the number of fields in the widest table.

Assumptions and limits

Record format. I assumed FB. If the RDX extracts are VB, keep the RDW (INREC BUILD=(1,4,5,200,SEQNUM,8,ZD)), add 4 to every position, and watch for short records.
200-byte window. Bytes 1-200 per file cover these tables. Set it to your widest common table plus 10. The joined record must stay under 32,760 bytes, so two full 28,000-byte records won?t fit.
OBJECT-DFLT. A CH compare is 256 bytes at most, so the 27,990-byte default record has to be compared in pieces of 256 bytes or less, one WHEN per piece. Or skip it if those are only non-data records.
Null indicators. These are reported as numbers (-1 = NULL). You may want the generator to hide a value-field difference when both sides are NULL.

The sample cards are untested, so try them on your three-record sample first.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group