Page 1 of 1

Compare two files on specific columns.

Posted: Mon Jul 25, 2016 2:33 pm
by seemajain
Hi,

I have two files which I want to compare. The files are fixed block and record lengths of 80. But I want ot compare these two files in such a way that only the data between column 5 to column 27 of both files are compared. Is it possible? If we can do it how can I do this ? Please help me.

Re: Compare two files on specific columns.

Posted: Mon Jul 25, 2016 5:44 pm
by Robert Sample
Use the ISPF compare option under Utilities. You may need to spend some time reading the Help (PF1) screens or dig in the manual, but you can specify the columns to use for your compare.

Re: Compare two files on specific columns.

Posted: Tue Jul 26, 2016 12:25 pm
by Anuj Dhawan
As Robert has said, you can use ISPF compare option. As per the manual:

The Fine Manual wrote: The COMPARE command compares the file you are editing with an external sequential data set or member of a partitioned data set. Lines that exist only in the file being edited are marked, and lines that exist only in the file being compared are inserted as information lines in the file being edited. The command operates as a primary command or an edit macro command.

You can use the Delete and Make Data line commands to merge changes between files that are being compared.

The COMPARE function supports all line lengths, but some SuperC options are ignored for line lengths greater than 256 characters long.

When you are editing a cataloged data set, explicit data set names refer to cataloged data sets. However, if you are editing an uncataloged data set and specify only a member name, COMPARE searches for the member in the current uncataloged data set. For example, if you are editing an uncataloged data set called "userid.TEMP", then the command


COMPARE TEMP


first looks for member TEMP in the current, uncataloged data set, then looks for a cataloged data set named TEMP (TSO prefix rules apply). If it finds data set TEMP, and the data set being edited is a PDS member, then the same named member is searched for in data set TEMP.


For zOS 2.1 COMPARE-Edit Compare - you might want to look at: https://www.ibm.com/support/knowledgece ... comped.htm


Example:

z/OS ISPF User's Guide Vol II SC19-3628-00 wrote:

Code: Select all

//COMPARE  EXEC PGM=ISRSUPC,PARM=('LINECMP,CHNGL,UPDCNTL')
//STEPLIB  DD   DSN=ISPF.LOAD,DISP=SHR
//NEWDD    DD   DSN=DLUDLOW.PDS(TEST1),DISP=SHR
//OLDDD    DD   DSN=DLUDLOW.PDS(TEST2),DISP=SHR
//OUTDD    DD   SYSOUT=A
//DELDD    DD   DSN=DLUDLOW.UCTL1,DISP=OLD
//SYSIN    DD   *
       CMPCOLM 5:27
/*
[/url]

PS. Have modified the the compare columns as per the topic.

Re: Compare two files on specific columns.

Posted: Thu Jul 28, 2016 8:33 pm
by nicc
BTW - they are data sets - not files.

Re: Compare two files on specific columns.

Posted: Fri Jul 29, 2016 2:55 pm
by seemajain
Thanks all, CMPCOLM did the job. :D