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

Syncsort Joinkeys-get only one record.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Dec 10, 2010 5:10 pm
Reply with quote

Hi,

My sort job uses JOINKEYS:

Code:

//STEP0002 EXEC PGM=SORT             
//SORTJNF1 DD *                     
1                                   
//SORTJNF2 DD *                     
1                                   
1                                   
3                                   
1                                   
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                     
  JOINKEYS FILE=F1,FIELDS=(1,1,A)   
  JOINKEYS FILE=F2,FIELDS=(1,1,A)   
  REFORMAT FIELDS=(F1:1,1)           
  SORT FIELDS=COPY                   
  END                               
/*                                   


Output:
Code:

1
1
1


Expected Output:
Code:

1


I am getting three records into output file because the SORTJNF2 has three matches against SORTJNF1. But, I want to get only one record into output file. How to alter my job to achieve it icon_rolleyes.gif icon_question.gif

Please help.

Thanks.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Dec 10, 2010 7:01 pm
Reply with quote

not-tested:
Code:
//SYSIN    DD *                               
  JOINKEYS FILE=F1,FIELDS=(1,1,A)             
  JOINKEYS FILE=F2,FIELDS=(1,1,A)             
  REFORMAT FIELDS=(F1:1,1)                     
  INREC OVERLAY=(80:SEQNUM,2,ZD,RESTART=(1,1))
  SORT FIELDS=COPY                             
  OUTFIL INCLUDE=(80,2,ZD,EQ,1),BUILD=(1,1)   
/*                                             
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Dec 10, 2010 7:02 pm
Reply with quote

And what release of SyncSort you are at, if you've DUPKEYS feacture availbale, try this:
Code:
//SYSIN    DD *                   
  JOINKEYS FILE=F1,FIELDS=(1,1,A)
  JOINKEYS FILE=F2,FIELDS=(1,1,A)
  REFORMAT FIELDS=(F1:1,1)       
  SORT FIELDS=(1,1,CH,A)         
  DUPKEYS FIELDS=NONE             
/*                               
Back to top
View user's profile Send private message
Hariharan Ramachandran

New User


Joined: 30 Nov 2010
Posts: 28
Location: Chennai, Tamilnadu,INDIA

PostPosted: Fri Dec 10, 2010 10:40 pm
Reply with quote

Please find the exact solution for your query. It has been TESTED. icon_wink.gif

Code:
//SORTJNF1 DD *
1
//SORTJNF2 DD *
1
1
3
1
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  JOINKEYS FILE=F1,FIELDS=(01,01,A)
  JOINKEYS FILE=F2,FIELDS=(01,01,A)
  REFORMAT FIELDS=(F1:01,02,
                   F2:01,02)
  INREC FIELDS=(01,01,SEQNUM,01,ZD,RESTART=(01,01),START=0)
  INCLUDE COND=(01,01,CH,EQ,03,01,CH,AND,
                 02,01,CH,EQ,04,01,CH)
  OUTREC FIELDS=(1:1,1)
  SORT FIELDS=(01,01,CH,A)
  SUM FIELDS=NONE
/*


Regards,
Hari
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Dec 12, 2010 11:02 pm
Reply with quote

Ramsri,
Code:
//SYSIN    DD *                   
  JOINKEYS FILE=F1,FIELDS=(1,1,A)
  JOINKEYS FILE=F2,FIELDS=(1,1,A)
  REFORMAT FIELDS=(F1:1,1)       
  SORT FIELDS=(1,1,CH,A)         
  SUM FIELDS=NONE             
/*
This should do what you're trying to achieve.
Hariharan Ramachandran wrote:
Please find the exact solution for your query
Hariharan Ramachandran,

Your solution has too many control statements which are not really required to achieve what the OP is trying to do.
Back to top
View user's profile Send private message
Hariharan Ramachandran

New User


Joined: 30 Nov 2010
Posts: 28
Location: Chennai, Tamilnadu,INDIA

PostPosted: Mon Dec 13, 2010 1:28 pm
Reply with quote

You are right... icon_wink.gif

Regards,
Hari
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Dec 13, 2010 3:23 pm
Reply with quote

Quote:
too many control statements
and so the passes of the data!
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Dec 17, 2010 4:11 pm
Reply with quote

Hi Arun,

Thank you very much.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Dec 17, 2010 4:20 pm
Reply with quote

Hi Anuj,

DUPKEYS FIELDS=NONE works for me. It does similar to SUM FIELDS=NONE.

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 17, 2010 4:45 pm
Reply with quote

Ramsri,

You're welcome. icon_smile.gif

DUPKEYS FIELDS is an advanced version of SUM FIELDS where you can perform AVG,MIN,MAX and SUM of equally keyed control fields. For FIELDS=NONE or SUM operation, you may use either of these.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top