IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

JCL Optimise Sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Fri Mar 30, 2012 2:53 pm
Reply with quote

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
View user's profile Send private message
girishbs13

New User


Joined: 11 Nov 2011
Posts: 24
Location: India

PostPosted: Fri Mar 30, 2012 3:36 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Mar 30, 2012 5:03 pm
Reply with quote

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
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Fri Mar 30, 2012 5:55 pm
Reply with quote

Sabari,

yes no matching record other than first one.
thanks, i got the expected result with NULLOFL and NULLOUT.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Mar 30, 2012 7:40 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 30, 2012 10:14 pm
Reply with quote

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
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Mon Apr 02, 2012 6:47 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top