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
 

 

Summing and overlaying a field using Dfsort Or Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Summing and overlaying a field using Dfsort Or Syncsort
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 Moderator


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

PostPosted: Mon Dec 28, 2009 11:33 pm    Post subject:
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    Post subject: SUMMING and Overlaying additional info
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Dec 29, 2009 11:44 am    Post subject: Reply to: Summing and overlaying a field using Dfsort Or Syn
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    Post subject: Summing and overlaying a field using Dfsort Or Syn
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    Post subject:
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: 500
Location: USA

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed Dec 30, 2009 10:40 pm    Post subject: Reply to: Summing and overlaying a field using Dfsort Or Syn
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    Post subject: Summing and overlaying a field using Dfsort Or Syncsort
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


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