Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

JCL Optimise Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: JCL Optimise Sort
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Mar 30, 2012 5:03 pm    Post subject: Reply to: JCL Optimise Sort
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Mar 30, 2012 7:40 pm    Post subject: Reply to: JCL Optimise Sort
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us