IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

To get total of a report using DFSORT

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
suzeet



Joined: 16 May 2005
Posts: 28

Posted: Mon Jun 06, 2005 11:48 am    Post subject: To get total of a report using DFSORT  

My requirement is to get a formatted report having subtotal regionwise and a grand total. I am just giving an example. All the file are FB and record length of 700.
suppose, following is my two input file,
101 xxxxxxxxxxx
101 xxxxxxxxxxx
102 xxxxxxxxxxx
103 xxxxxxxxxxx
103 xxxxxxxxxxx
104 xxxxxxxxxxx
105 xxxxxxxxxxx

it should display like this
----------------------------------
SUB TOTAL 719.00
----------------------------------

101 xxxxxxxxxxx

----------------------------------
SUB TOTAL 101.00
----------------------------------

----------------------------------
TOTAL 820.00
----------------------------------
Back to top  
Frank Yaeger



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

Posted: Mon Jun 06, 2005 9:13 pm    Post subject:  

You can do this kind of thing with the report functions of DFSORT's OUTFIL statement, but exactly what you would code depends on exactly what the input looks like and exactly what you want the report to look like.

If you want me to show you how to do what you ant, please give a more detailed example of your input records and exactly what you want the output records/report to look like. Indicate the starting position, length and format of each relevent field (key, amount to be totalled, etc).
Back to top  
suzeet



Joined: 16 May 2005
Posts: 28

Posted: Tue Jun 07, 2005 10:50 am    Post subject: Re: To get total of a report using DFSORT  

Suppose there is a file having Salary, Name and Department. It a Fixed Block file with Record length of 80. The Salary Field starts from Column 40.

Code:
Name             Dept                  Salary
Tom              01                      1000
Harry            01                      2000
Peter            02                      1000
Anita            01                     10000
Hank             01                       100


I want to see the report like this

Code:
SUB TOTAL FOR DEPT 01   13100.00

SUB TOTAL FOR DEPT 02    1000.00

TOTAL IS                14100.00
Back to top  
Frank Yaeger



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

Posted: Tue Jun 07, 2005 9:32 pm    Post subject:  

Here's a DFSORT job that will produce the report you asked for:

Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
Tom                01                    1000
Harry              01                    2000
Peter              02                    1000
Anita              01                   10000
Hank               01                     100
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=(20,2,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(20,2,
      TRAILER3=(/,'SUB TOTAL FOR DEPT ',20,2,
        24:TOT=(40,6,FS,EDIT=(IIIIIT)),C'.00')),
    TRAILER1=(/,'TOTAL IS',
        24:TOT=(40,6,FS,EDIT=(IIIIIT)),C'.00')
/*
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM