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

Adding Numeric Values using SYNCSORT?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu May 03, 2007 9:41 pm
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
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
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 Developer


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

PostPosted: Mon May 07, 2007 8:39 pm
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
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 Developer


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

PostPosted: Tue May 08, 2007 8:53 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top