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

Summing and overlaying a field using Dfsort Or Syncsort


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

New User


Joined: 12 Sep 2005
Posts: 9

PostPosted: Mon Dec 28, 2009 9:51 pm
Reply with quote

Hello,
Can somebody help on how to achieve the following using DFSORT or Syncsort

Input fixed length file:

Code:
Col1        Col2         Col3       Col4 Col5   Col6
========================================
1234|111111111|000000002|0002|VAC|BEFGHIJ|
2345|333333333|000000001|0002|BUR|DEFGHIJ|
1234|222222222|000000003|0003|BUR|CDFGHIJ|
1234|111111111|000000001|0002|BAC|DEFGHIJ|
1234|111111111|000000003|0002|SPC|DEFGHIJ|
1234|222222222|000000003|0003|MST|DEFGHIJ|
1234|222222222|000000003|0003|KEF|EFFGHIJ|
2345|333333333|000000001|0002|KEF|DEFGHIJ|


Output:

Col1     Col2            Col3       Col4 Col5   Col6
========================================
1234|111111111|000000015|0002|BAC|DEFGHIJ|
1234|111111111|000000015|0002|VAC|BEFGHIJ|
1234|111111111|000000015|0002|SPC|DEFGHIJ|
1234|222222222|000000015|0003|MST|DEFGHIJ|
1234|222222222|000000015|0003|BUR|CDFGHIJ|
1234|222222222|000000015|0003|KEF|EFFGHIJ|
2345|333333333|000000002|0002|BUR|DEFGHIJ|
2345|333333333|000000002|0002|KEF|DEFGHIJ|

OUTPUT condition:

A.Output need to be in sorted order on Col1,Col2
B.Col3 - Must be sum of amount in Col3 and to overlay;for matching Col1
C.Must have all records as input file as is.

Any help is appreciated!!

-Neo
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 Dec 28, 2009 11:33 pm
Reply with quote

What is the RECFM and LRECL of your input file?

What is the starting position, length and format of each field?

Please run this DFSORT job and show the //SYSOUT messages so I can tell what level you're at:

Code:

//S1    EXEC  PGM=SORT                                           
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD *                                                     
RECORD                                                         
//SORTOUT DD DUMMY   
//SYSIN    DD    *                                               
  OPTION COPY                                                     
/*
Back to top
View user's profile Send private message
sub7

New User


Joined: 12 Sep 2005
Posts: 9

PostPosted: Tue Dec 29, 2009 11:31 am
Reply with quote

Hi Frank,

LRECL=200 Bytes (I have excluded the rest of data from record)
COl1 - Starting pos 1 and 5 Bytes long PIC X(5)
COl2 - Starting pos 6 and 9 Bytes long PIC X(9)
Col3 - Starting pos 16 and 13 Bytes long PIC 9(10)V9(3) implied decimal.
(in the above please treat the amount as 0000000000015).
Col1,2,Col4,5,6 -just need to be included as is.

and the JOb status below:

Job successfully processed and here is the SYSOUT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR SORTIN
WER416B BSAM WAS USED FOR SORTOUT
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.3 BATCH 0494 TPF LEVEL 2.0
WER052I END SYNCSORT - FPRTSORT,STEP001,,DIAG=C600,4082,EAA2

-Neo
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 29, 2009 11:44 am
Reply with quote

the messages show that You are using SYNCSORT,
topic moved to the proper forum

did You read the forum rules about duplicate posts on the IBMMAINFRAME domain
looks like not !


please clarify where You want to be answered
( somebody will delete the duplicate/useless post)
Back to top
View user's profile Send private message
sub7

New User


Joined: 12 Sep 2005
Posts: 9

PostPosted: Tue Dec 29, 2009 12:37 pm
Reply with quote

My bad.

Thanks Enrico ,for moving to appropritae place.

Can sombody suggest a solution using Sort for my problem?

-Neo.
Back to top
View user's profile Send private message
venkatesh83be

New User


Joined: 10 Aug 2009
Posts: 12
Location: Chennai

PostPosted: Tue Dec 29, 2009 6:15 pm
Reply with quote

Try this code

Code:

//SORT01 EXEC PGM=SORT                           
//SYSOUT   DD  SYSOUT=*                         
//SYSPRINT DD  SYSOUT=*                         
//SYSUDUMP DD  SYSOUT=*                         
//SORTIN   DD *                                 
1234|111111111|000000002|0002|VAC|BEFGHIJ|       
2345|333333333|000000001|0002|BUR|DEFGHIJ|       
1234|222222222|000000003|0003|BUR|CDFGHIJ|       
1234|111111111|000000001|0002|BAC|DEFGHIJ|       
1234|111111111|000000003|0002|SPC|DEFGHIJ|       
1234|222222222|000000003|0003|MST|DEFGHIJ|       
1234|222222222|000000003|0003|KEF|EFFGHIJ|       
2345|333333333|000000001|0002|KEF|DEFGHIJ|       
/*                                               
//SORTOUT  DD DSN=&&TEMP,                       
//            DISP=(,PASS)                       
//SYSIN    DD *                                 
 SORT FIELDS=(1,4,CH,A)                         
 SUM FIELDS=(16,9,ZD)                           
 OUTREC FIELDS=(1,4,16,9)                       
/*                                               
//SORT2 EXEC PGM=SORT                           
//SORTJNF1 DD *                                 
1234|111111111|000000002|0002|VAC|BEFGHIJ|       
2345|333333333|000000001|0002|BUR|DEFGHIJ|       
1234|222222222|000000003|0003|BUR|CDFGHIJ|       
1234|111111111|000000001|0002|BAC|DEFGHIJ|       
1234|111111111|000000003|0002|SPC|DEFGHIJ|       
1234|222222222|000000003|0003|MST|DEFGHIJ|       
1234|222222222|000000003|0003|KEF|EFFGHIJ|       
2345|333333333|000000001|0002|KEF|DEFGHIJ|       
/*                                               
//SORTJNF2 DD DISP=SHR,DSN=&&TEMP                       
//SORTOUT DD DSN=ZI15.TEST.FORUM.JOIN,DISP=(NEW,CATLG), 
//            UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE)         
//SYSOUT DD SYSOUT=*                                     
//SYSIN    DD    *                                       
  JOINKEYS FILES=F1,FIELDS=(1,4,A)                       
  JOINKEYS FILES=F2,FIELDS=(1,4,A)                       
  REFORMAT FIELDS=(F1:1,42,F2:1,13),FILL=X'FF'           
  JOIN UNPAIRED                                         
  SORT FIELDS=(1,4,CH,A,6,9,CH,A)                       
  OUTFIL INCLUDE=(1,1,BI,NE,X'FF',AND,43,1,CH,NE,X'FF'),
   OUTREC=(1,15,16:47,9,25,18)                           
//*
                                                       


Thanks,
Venkat
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Dec 30, 2009 9:55 pm
Reply with quote

This appears to be the same question posted here: ibmmainframeforum.com/viewtopic.php?f=61&t=2828
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Dec 30, 2009 10:40 pm
Reply with quote

Quote:
....This appears to be the same question ....


Yess! that' s the reason for my mild warning
Back to top
View user's profile Send private message
sub7

New User


Joined: 12 Sep 2005
Posts: 9

PostPosted: Thu Dec 31, 2009 2:15 pm
Reply with quote

Thanks to Venkat and Alissa . In fact I reached the same solution which Alisaa has proposed using Venkat's code !!

Enrico my bad again.Hope you will forgive !!!!

-Neo.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
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 Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top