Compare two files on specific columns.

JES2/3, JCL, utilities.
Previous topicNext topic

Topic Author
seemajain
New Member
Posts: 5
Joined: Sat Jan 23, 2016 12:04 pm

Compare two files on specific columns.

Post by seemajain » Mon Jul 25, 2016 2:33 pm

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.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1331
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Compare two files on specific columns.

Post by Robert Sample » Mon Jul 25, 2016 5:44 pm

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.



User avatar

Anuj Dhawan
Founder
Posts: 2461
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: Compare two files on specific columns.

Post by Anuj Dhawan » Tue Jul 26, 2016 12:25 pm

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.


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.


nicc
Global Moderator
Global Moderator
Posts: 580
Joined: Wed Apr 23, 2014 8:45 pm

Re: Compare two files on specific columns.

Post by nicc » Thu Jul 28, 2016 8:33 pm

BTW - they are data sets - not files.


Regards
Nic


Topic Author
seemajain
New Member
Posts: 5
Joined: Sat Jan 23, 2016 12:04 pm

Re: Compare two files on specific columns.

Post by seemajain » Fri Jul 29, 2016 2:55 pm

Thanks all, CMPCOLM did the job. :D



Previous topicNext topic

Return to “JCL - Job Control Language.”