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
 

 

Syncsort Joinkeys-get only one record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort Joinkeys-get only one record.
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

Senior Member


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

PostPosted: Fri Dec 10, 2010 7:01 pm    Post subject:
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

Senior Member


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

PostPosted: Fri Dec 10, 2010 7:02 pm    Post subject:
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    Post subject: Re: Syncsort Joinkeys-get only one record.
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: 2177
Location: @my desk

PostPosted: Sun Dec 12, 2010 11:02 pm    Post subject:
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    Post subject:
Reply with quote

You are right... icon_wink.gif

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

Senior Member


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

PostPosted: Mon Dec 13, 2010 3:23 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2177
Location: @my desk

PostPosted: Fri Dec 17, 2010 4:45 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm


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