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
 

 

Adding Numeric Values using SYNCSORT?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Thu May 03, 2007 4:26 pm    Post subject: Adding Numeric Values using SYNCSORT?
Reply with quote

Hi
I have the following requirement

input PS file:

abcde 201 4000
abcde 201 5000
abcde 201 0500
abcde 301 0100
abcde 301 0010
xyz 201 2500
xyz 301 2000

output:

abcde 201 9500
abcde 301 0110
xyz 201 2500
xyz 301 2000

Can this be obtained using SYNCSORT. if yes could anyone give the sort card for this requirement
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 03, 2007 9:41 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for. Since your records are already in order by the keys, I used a MERGE which is more efficient than a SORT.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD *
abcde 201 4000
abcde 201 5000
abcde 201 0500
abcde 301 0100
abcde 301 0010
xyz   201 2500
xyz   301 2000
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  MERGE FIELDS=(1,9,CH,A)
  OPTION ZDPRINT
  SUM FIELDS=(11,4,ZD)
/*
Back to top
View user's profile Send private message
raam_kumar

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Mon May 07, 2007 9:42 am    Post subject:
Reply with quote

Thanks Frank
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon May 07, 2007 3:07 pm    Post subject:
Reply with quote

One more way.... icon_biggrin.gif

Code:
//STEP1   EXEC   PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN   DD *         
ABCDE 201 4000           
ABCDE 201 5000           
ABCDE 201 0500           
ABCDE 301 0100           
ABCDE 301 0010           
XYZ   201 2500           
XYZ   301 2000           
/*                       
//SORTOUT DD SYSOUT=*   
//SYSIN    DD    *       
  SORT FIELDS=(1,9,CH,A)
  SUM FIELDS=(11,4,ZD)   
//*   
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon May 07, 2007 8:39 pm    Post subject:
Reply with quote

Raak,

You've actually shown a less efficient way to do it that doesn't produce the correct output.

Doing a SORT is less efficient then doing a MERGE. That's why I showed a job using a MERGE.

Without ZDPRINT the ZD output values will not be displayed as requested (they will have a C sign instead of an F sign) so the output will be:

Code:

abcde 201 950{   
abcde 301 011{   
xyz   201 2500   
xyz   301 2000   


ZDPRINT is needed to get the correct output of:

Code:

abcde 201 9500 
abcde 301 0110 
xyz   201 2500 
xyz   301 2000 


That's why I showed a job using ZDPRINT.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue May 08, 2007 10:34 am    Post subject:
Reply with quote

Frank,

Quote:
Doing a SORT is less efficient then doing a MERGE.


Thanks for this piece of information...

But i have a doubt on the later point.

Quote:
Without ZDPRINT the ZD output values will not be displayed as requested (they will have a C sign instead of an F sign)


Because when i used the JCL that i posted above, i am getting the result as shown below.

Code:
ABCDE 201 9500
ABCDE 301 0110
XYZ   201 2500
XYZ   301 2000


I didn't use ZDPRINT. When i give a Hex On, iam getting F under the last value, not C.
To add, I am using SYNCSORT, but the same option of ZDPRINT is there in Syncsort also.
Is the ZDPRINT option the default one??
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue May 08, 2007 8:53 pm    Post subject:
Reply with quote

If you're getting an F, not a C, then ZDPRINT is in effect at YOUR site. But that may not be the case for everyone.

I believe Syncsort does have ZDPRINT=YES as their shipped installation default.

DFSORT has ZDPRINT=YES as its shipped installation default for z/OS DFSORT V1R5, but has ZDPRINT=NO as its shipped installation default for DFSORT R14.

But the site can change the shipped installation default, so even with z/OS DFSORT V1R5 or Syncsort, the installation default can be ZDPRINT=NO.

Therefore, it's prudent to specify the ZDPRINT run-time option explicitly to make sure its in effect regardless of what the installation default is set to.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed May 09, 2007 11:08 am    Post subject:
Reply with quote

Frank,

thanks for this piece of info..

Quote:
Therefore, it's prudent to specify the ZDPRINT run-time option explicitly to make sure its in effect regardless of what the installation default is set to.


I l always keep this in mind.... icon_lol.gif
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


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