|
View previous topic :: View next topic
|
| Author |
Message |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
Hi,
I have a requirement to check dates in two files and abend if not equal.
I have done it in two steps , Can anyone help me to do this in one step.
As I have multiple files , so lesser the steps in the jcl would be good.
both the files have 1st record as the date
MY card below
==============
| Code: |
//DFSORT EXEC SORT
//SORTJNF1 DD DISP=OLD,DSN=file1
//SORTJNF2 DD DISP=OLD,
// DSN=file2
//SORTOUT DD DSN=&&TEMP1,DISP=(MOD,PASS,)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(8,10,A)
REFORMAT FIELDS=(F1:1,10,F2:8,10)
SORT FIELDS=COPY,STOPAFT=1
//*CHECK FILE EMPTY - VALIDATION *
//*********************************************************
//CHECK EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFILE DD DISP=SHR,DSN=&&TEMP1
//TOOLIN DD *
COUNT FROM(INFILE) EMPTY
/*
|
Count step gives me RC12 for empty file , which I am using to Abend.
thanks |
|
| Back to top |
|
 |
girishbs13
New User
Joined: 11 Nov 2011 Posts: 24 Location: India
|
|
|
|
Hi,
You can use
| Code: |
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(8,10,A)
REFORMAT FIELDS=(F1:1,10,F2:8,10)
SORT FIELDS=COPY,STOPAFT=1
OUTFIL NULLOFL=RC4
|
It will give you a return code of 4.
But are you sure that the other records wont have matching data at positions 1,10 and 8,10? |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
in order not to have people spend time on a competitor' s product
find out the <sort> product You are using ...
ICE messages IBM DFSORT
WER messages SYNCSORT
Run this job and show the //SYSOUT messages you receive, so we can see what sort product You are using and it' s level
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/*
|
|
|
| Back to top |
|
 |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
Sabari,
yes no matching record other than first one.
thanks, i got the expected result with NULLOFL and NULLOUT. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You know that you will be sorting, by default, your two input files?
That's a lot of effort to just find two records to check.
Plus, I'm still saying it would be very easy to get a "false match" with your sort cards. OK, your data may preclude that, but you are doing multiple files. I don't like the thought of a bad solution replicating. It is bad, becuase when it works it works by accident rather than design, and when it doesn't it doesn't. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| knickraj wrote: |
Sabari,
yes no matching record other than first one.
thanks, i got the expected result with NULLOFL and NULLOUT. |
knickraj,
You shouldn't be developing a solution that there are no matches except on the first record. As Bill mentioned, you are using joinkeys without limiting the number of records to match. Joinkeys runs 2 subtasks and assuming you have 1 million records in each file , you are wasting a lot of resources. Also there is a chance of "false match".
Use the following DFSORT JCL which will limit the number of records the subtasks read and match. You don't need another step to check for the return code and abend. You can do it all in a single step.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your input file1,DISP=SHR
//INB DD DSN=Your input file2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=INA,FIELDS=(01,10,A),STOPAFT=1
JOINKEYS F2=INB,FIELDS=(08,10,A),STOPAFT=1
REFORMAT FIELDS=(?)
DEBUG ABEND
OPTION COPY,NULLOUT=RC16
//* |
|
|
| Back to top |
|
 |
knickraj Warnings : 1 New User

Joined: 11 Jun 2007 Posts: 50 Location: Euro
|
|
|
|
Skolusu,
Thanks for your suggestions,
As per the requirement I am only building input files, after some sorting ,so the data in the file would be correct and both files have only 1 record. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|