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

SORT: SUM not giving correct result


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kanisha_prabha

New User


Joined: 10 Mar 2006
Posts: 26

PostPosted: Mon Jun 19, 2006 11:26 am
Reply with quote

Hi,
I have 2 files. First position of all records in file-1 contains '1'. First position of all records in file-2 contains '2'. Records are unique in each file. When I merge the files and do a sum on the first position (sort card follows), I expect to get '1' for all records that are only in File-1, '2' for all records that are in file-2 only and '3' for all records that are in both file-1 & file-2. Instead of a '3' I get a 'C' on the first position.

//SYSIN DD *
SORT FIELDS=(2,7,CH,A)
SUM FIELDS=(1,1,ZD)
/*

Could you tell me why I am getting a 'C' instead of a '3'?

- Kanisha.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon Jun 19, 2006 1:12 pm
Reply with quote

Hi,
Please proivde the JCL with some test data which you are using.It will help you to get the correct and quick reply.

Thanks
Krishy
Back to top
View user's profile Send private message
kanisha_prabha

New User


Joined: 10 Mar 2006
Posts: 26

PostPosted: Mon Jun 19, 2006 3:17 pm
Reply with quote

Here is the JCL to merge ...
//MRGEPGM EXEC PGM=SORT
//SORTIN01 DD DSN=xxxxxxx.MYFIL.INFILE1,DISP=SHR
//SORTIN02 DD DSN=xxxxxxx.MYFIL.INFILE2,DISP=SHR
//SORTOUT DD DSN=xxxxxxx.MYFIL.OUTFILE,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(20,30),RLSE),
// DCB=(RECFM=FB,LRECL=79,BLKSIZE=7900,DSORG=PS)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
MERGE FIELDS=(2,7,CH,A)
SUM FIELDS=(1,1,ZD)
/*

Infile1:
========
1AAPTM01
1AAPTSY1
1AAPTSY2
1AAPTSY3
1ABAPT18
1ABAPT19
1ABAPT28
1ABAPT29
1ABAPT38
1ABAPT39
1ABAPT48

Infile2:
========
2AAPTM01
2AAPTSY1
2AAPTSY2
2AAPTSY3
2ABSER17
2ABSER18
2ABSER19
2ABSER27
2ABSER28

Outfile:
========
CAAPTM01
CAAPTSY1
CAAPTSY2
CAAPTSY3
1ABAPT18
1ABAPT19
1ABAPT28
1ABAPT29
1ABAPT38
1ABAPT39
1ABAPT48
2ABSER17
2ABSER18
2ABSER19
2ABSER27
2ABSER28


Concern: the first four records in outfile has 'C' in first position. I expected a '3'.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon Jun 19, 2006 3:43 pm
Reply with quote

Hi,
I just copied your jcl and ran in my system.I am getting the o/p as you are expecting.Not sure why you are getting the diffrent o/p.

I ran the below jcl.

Code:


//MRGEPGM EXEC PGM=SORT             
//SORTIN01 DD *                     
1AAPTM01                           
1AAPTSY1                           
1AAPTSY2                           
1AAPTSY3                           
1ABAPT18                           
1ABAPT19                           
1ABAPT28                           
1ABAPT29                           
1ABAPT38                           
1ABAPT39                           
1ABAPT48                           
//SORTIN02 DD *                     
2AAPTM01                           
2AAPTSY1                           
2AAPTSY2                           
2AAPTSY3                           
2ABSER17                           
2ABSER18                           
2ABSER19                           
2ABSER27                           
2ABSER28                           
//SORTOUT  DD SYSOUT=*             
//SYSPRINT DD SYSOUT=*             
//SYSOUT   DD SYSOUT=*             
//SYSIN    DD *                     
 MERGE FIELDS=(2,7,CH,A)           
 SUM FIELDS=(1,1,ZD)               
/*                                 


My o/p is :

3AAPTM01
3AAPTSY1
3AAPTSY2
3AAPTSY3
1ABAPT18
1ABAPT19
1ABAPT28
1ABAPT29
1ABAPT38
1ABAPT39
1ABAPT48
2ABSER17
2ABSER18
2ABSER19
2ABSER27
2ABSER28

Thank you
Krishy
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Jun 19, 2006 4:07 pm
Reply with quote

Your shop must have the ZDPRINT default option set to N

So if you code

//MRGEPGM EXEC PGM=SORT,PARM=ZDPRINT

you should get the result you want
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon Jun 19, 2006 4:27 pm
Reply with quote

IQofaGerbil,
Do you have any idea regarding ,,viewing of all the default options ?

Thanks
Kirshy
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Jun 19, 2006 4:36 pm
Reply with quote

If you look at the SYSOUT for any of your sort jobs you will see the default values that you have set in your shop, look for OPTIONS:

eg one line from my SYOUT is
OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE
Back to top
View user's profile Send private message
kanisha_prabha

New User


Joined: 10 Mar 2006
Posts: 26

PostPosted: Mon Jun 19, 2006 4:55 pm
Reply with quote

Hi,
Thank you so much. PARM=ZDPRINT did work!!

- Kanisha
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 Jun 19, 2006 9:06 pm
Reply with quote

Note that you don't have to specify the ZDPRINT option as a PARM - you can specify it in a control statement as well, e.g.

Code:

//SYSIN DD *
   OPTION ZDPRINT
   ...
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top