Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Extract Data till prev hour balaji81_k DB2 16 Fri Aug 25, 2017 9:25 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us