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
 

 

Date Range File comparison

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Wed Feb 02, 2011 2:39 pm    Post subject: Date Range File comparison
Reply with quote

Hi
How to perform the following in DFSORT?
Can this be performed using JOINKEYS

Input File-1 (will have only one record)
1,10 and 11,10 are two dates
Code:
----+----1----+----2
2011-01-012011-12-31


Input File-2 (will have n records)
4,10 is a date field
Code:
----+----1---
OPQ2010-01-01
ABC2011-01-01
CDE2011-02-10
EFG2011-03-20
GHI2011-04-30
IJK2011-05-01
LMN2012-01-01


Output File(should contain records from Input File-2. Comparison is 4,10 of file 2 which are greater than 1,10 and lesser than 2,10 of file 1)

Code:
----+----1---
ABC2011-01-01
CDE2011-02-10
EFG2011-03-20
GHI2011-04-30
IJK2011-05-01
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Wed Feb 02, 2011 10:26 pm    Post subject:
Reply with quote

HameedAli,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//INA      DD *                                         
OPQ2010-01-01                                           
ABC2011-01-01                                           
CDE2011-02-10                                           
EFG2011-03-20                                           
GHI2011-04-30                                           
IJK2011-05-01                                           
LMN2012-01-01                                           
//INB      DD *                                         
2011-01-012011-12-31                                     
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  OPTION COPY                                           
  JOINKEYS F1=INA,FIELDS=(81,1,A),SORTED,NOSEQCK         
  JOINKEYS F2=INB,FIELDS=(81,1,A),SORTED,NOSEQCK         
  REFORMAT FIELDS=(F1:1,80,F2:1,20)                     
  OUTFIL BUILD=(1,80),                                   
  INCLUDE=(4,10,CH,GE,81,10,CH,AND,4,10,CH,LE,91,10,CH) 
//JNF1CNTL DD *                                         
  INREC OVERLAY=(81:C'1')                               
//JNF2CNTL DD *                                         
  INREC OVERLAY=(81:C'1')                               
//*
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu Feb 03, 2011 3:03 pm    Post subject: Reply to: Date Range File comparison
Reply with quote

Skolusu, it was of great help and very precise.

I don't understand the significance of the CNTL cards.
how 4,10 refers to INB not INA
and the (81,1,A)SORTED,NOSEQCK

Quote:
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(81,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(81,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:1,20)
OUTFIL BUILD=(1,80),
INCLUDE=(4,10,CH,GE,81,10,CH,AND,4,10,CH,LE,91,10,CH)
//JNF1CNTL DD *
INREC OVERLAY=(81:C'1')
//JNF2CNTL DD *
INREC OVERLAY=(81:C'1')

//*
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu Feb 03, 2011 5:19 pm    Post subject: Reply to: Date Range File comparison
Reply with quote

Is it possible to SORT while using JOINKEYS, I tried SORT FIELDS(1,3,CH,A). The step went fine, but the output wasn't sorted.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Feb 03, 2011 10:53 pm    Post subject: Reply to: Date Range File comparison
Reply with quote

HameedAli wrote:
I don't understand the significance of the CNTL cards.
how 4,10 refers to INB not INA and the (81,1,A)SORTED,NOSEQCK


HameedAli,

Since your files did not have a key to match from both files, we pad an arbitrary value of '1' in both files at the end of the record and use that as a matching key. Since we are padding the extra byte and we know it is sorted, so there is no need for sorting during match. SORTED,NOSEQCK tells DFSORT not to check the order of the records which can improve performance.

HameedAli wrote:
Is it possible to SORT while using JOINKEYS, I tried SORT FIELDS(1,3,CH,A). The step went fine, but the output wasn't sorted.


Yes it is possible. Replace the OPTION COPY statement with SORT FIELDS=(1,3,CH,A).

I am assuming that you did not remove the OPTION COPY statement and just added SORT statement which DFSORT ignored as OPTION COPY was used.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Fri Feb 04, 2011 5:35 pm    Post subject: Reply to: Date Range File comparison
Reply with quote

Thanks for the detailed response Skolusu.

Performance wise which is better?
1) Sorting step separately and then perform JOIN step separately.
2) SORT and JOIN in same step?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Feb 04, 2011 8:32 pm    Post subject:
Reply with quote

Hello,

Quote:
Performance wise which is better?
Your mileage may vary. . .

Suggest you try both with the "real" data (not some subset) and determine which is better for you.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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