Page 1 of 1

Need a JCL to compare two file

PostPosted: Fri Oct 29, 2010 5:25 pm
by INDRA
Hi,

I need a jcl to compare fileA with FileB and need to eliminate the record that is available in file A from FILE B and write the output in another file.

Input file:
*************
FILE A: 7 Byte length
xxxxxxx
yyyyyyyy

File B: 7000 byte length
header record
xxxxxxx09100110......................................................... etc till 7000 btye
xxxxxxx07100110......................................................... etc till 7000 btye
yyyyyyyy09100110......................................................... etc till 7000 btye
zzzzzzzz09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
trailer record with record counts(6)

File C: 7000 byte length (output file)

header - same as File B
zzzzzzzz09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
Trailer - with updated record count. (3)

Can any one pleas help me on this?

Re: Need a JCL to compare two file

PostPosted: Fri Oct 29, 2010 11:23 pm
by Frank Yaeger
What exactly does the trailer record look like? Can it be identified in some way (e.g. TRL in positions 1-3). What is the starting position, length and format of the count to be updated?

Re: Need a JCL to compare two file

PostPosted: Mon Nov 01, 2010 10:32 am
by INDRA
Trailer record contains,

High values in position 1-29 and record count of 10 byte starting from 30-39.

Re: Need a JCL to compare two file

PostPosted: Tue Nov 02, 2010 1:17 am
by Frank Yaeger
Here's a DFSORT job that will do what you asked for. I assumed 8 bytes of X'FF's are enough to identify the trailer record.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/7)
//IN2 DD DSN=...  input file2 (FB/7000)
//OUT DD DSN=...  output file (FB/7000)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,7,A)
  JOINKEYS F2=IN2,FIELDS=(1,7,A)
  JOIN UNPAIRED,F2,ONLY
  REFORMAT FIELDS=(F2:1,7008)
  SORT FIELDS=(7001,8,ZD,A)
  OUTFIL FNAMES=OUT,REMOVECC,
    BUILD=(1,7000),
    TRAILER1=(29X'FF',COUNT-1=(TO=ZD,LENGTH=10))
/*
//JNF2CNTL DD *
  OMIT COND=(1,8,BI,EQ,X'FFFFFFFFFFFFFFFF')
  INREC OVERLAY=(7001:SEQNUM,8,ZD)
/*

Re: Need a JCL to compare two file

PostPosted: Mon Nov 08, 2010 2:24 pm
by INDRA
Hi,

I am getting below JCl error with the above code, Can you please let me know what needs to be corrected?

------------------------------------------------------------------------
E1 8 DSS20011E DD 'SORTIN' WAS NOT ALLOCATED.
E2 8 DSS11051E UNRECOGNIZED 'SORT' KEYWORD 'JOINKEYS'.
E3 8 DSS11051E UNRECOGNIZED 'SORT' KEYWORD 'JOINKEYS'.
E4 8 DSS11051E UNRECOGNIZED 'SORT' KEYWORD 'JOIN'.
E5 8 DSS11051E UNRECOGNIZED 'SORT' KEYWORD 'REFORMAT'.

Re: Need a JCL to compare two file

PostPosted: Mon Nov 08, 2010 2:35 pm
by enrico-sorichetti
are You running a jcl checker perchance ?
DSS.... messages are not sort related

jcl checkers are usually out of sync with SORT products

if the only errors You get are Sort parameters related You can happily submit the job

Re: Need a JCL to compare two file

PostPosted: Tue Nov 09, 2010 12:21 am
by Frank Yaeger
INDRA,

Those are messages from a "JCL checker", not regular JCL messages, and they may not be meaningful.

If your job is not executing successfully, post the complete JES log. DFSORT's messages are in //SYSOUT.

Re: Need a JCL to compare two file

PostPosted: Thu Nov 11, 2010 6:22 pm
by INDRA
Hi Frank,

Thanks A lot for ur help.

Can u pls help me out in explaning the below lines in the icetool,

JOINKEYS F1=IN1,FIELDS=(1,7,A)
JOINKEYS F2=IN2,FIELDS=(1,7,A)
JOIN UNPAIRED,F2,ONLY
REFORMAT FIELDS=(F2:1,7008)
SORT FIELDS=(7001,8,ZD,A)
OUTFIL FNAMES=OUT,REMOVECC,
BUILD=(1,7000),
TRAILER1=(29X'FF',COUNT-1=(TO=ZD,LENGTH=10))

so that I can write this of myself for any future requirement?

Re: Need a JCL to compare two file

PostPosted: Thu Nov 11, 2010 6:26 pm
by INDRA
Trailer record count contain the number of record in file with exclusive of header and trailer. I need the record count with inclusive of both header and trailer

Re: Need a JCL to compare two file

PostPosted: Fri Nov 12, 2010 12:48 am
by Frank Yaeger
File C: 7000 byte length (output file)

header - same as File B
zzzzzzzz09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
aaaaaaa09100110......................................................... etc till 7000 btye
Trailer - with updated record count. (3)

Can any one pleas help me on this?


Trailer record count contain the number of record in file with exclusive of header and trailer. I need the record count with inclusive of both header and trailer


The original example showed a count of only the data records. Now you say you want a count of all of the records? If so, just change COUNT-1 to COUNT+1.

Can u pls help me out in explaning the below lines in the icetool


This job does NOT use ICETOOL. It just uses DFSORT. If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080