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 character data and writing the sum to the O/P file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Summing character data and writing the sum to the O/P file
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 Moderator


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

PostPosted: Fri Nov 09, 2007 2:26 am    Post subject:
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    Post subject: Reply to: Summing character data and writing the sum to the
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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