Compare two files on specific columns.

JES2/3, JCL, utilities.
Post Reply
seemajain
New Member
Posts: 8
Joined: Sat Jan 23, 2016 12:04 pm

Compare two files on specific columns.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Compare two files on specific columns.

Post 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.
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Compare two files on specific columns.

Post 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.
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: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Compare two files on specific columns.

Post by nicc »

BTW - they are data sets - not files.
Regards
Nic
seemajain
New Member
Posts: 8
Joined: Sat Jan 23, 2016 12:04 pm

Re: Compare two files on specific columns.

Post by seemajain »

Thanks all, CMPCOLM did the job. :D
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”