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

Summing character data and writing the sum to the O/P file


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

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Nov 09, 2007 1:53 am
Reply with quote

I have the following input records to DFSORT:

RECFM=FB, LRECL=71

Code:

ABENDAID ABENDAID.CICS*.**           
ABENDAID ABENDAID.**                 
ABJ      ABJ.**                     
ACI      ACI.**                     
ACTP     ACTP.**                     
ACTP     ACTP.**                     
ADT0     ADT0.CIMS.**               
ADT0     ADT0.CIMS.**               
ADT0     ADT0.CIMS.**               
ADT0     ADT0.CIMS.**               
ADT0     ADT0.CIMS.**               
ADT0     ADT0.**                     
ADT0     ADT0.**                     
ADT0     ADT0.**                     


I would like to sort these (10,44,CH,A), sum the occurences, and write the sum to position 55 of the output file. The output should resemble:

Code:

ABENDAID ABENDAID.CICS*.**                            00001   
ABENDAID ABENDAID.**                                  00001   
ABJ      ABJ.**                                       00001   
ACI      ACI.**                                       00001   
ACTP     ACTP.**                                      00002   
ADT0     ADT0.CIMS.**                                 00005   
ADT0     ADT0.**                                      00003   


The SUM'ed field can be in any number format if DFSORT is unable to use straight numbering.

Any assistance would be appreciated.
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: Fri Nov 09, 2007 2:26 am
Reply with quote

Here's a DFSORT job that will do what you asked for. You can format the count any way you like using the appropriate edit mask.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input (FB/71)
//SORTOUT DD DSN=... output (FB/71)
//SYSIN    DD    *
  SORT FIELDS=(10,44,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(10,44,
      TRAILER3=(10,44,55:COUNT=(M11,LENGTH=5)))
/*
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Nov 09, 2007 3:10 am
Reply with quote

Worked perfect!

Thank you very much...Scott
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Nov 09, 2007 3:43 am
Reply with quote

This should work too:
Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input (FB/71)
//SORTOUT DD DSN=... output (FB/71)
//SYSIN    DD    *
 INREC FIELDS=(1:1,54,55:C'00001',60:60,12)
 SORT FIELDS=(10,44,A),FORMAT=CH           
 SUM  FIELDS=(55,5,ZD)                     
/*
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top