|
View previous topic :: View next topic
|
| Author |
Message |
suzeet
New User

Joined: 16 May 2005 Posts: 54
|
|
|
|
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
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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
New User

Joined: 16 May 2005 Posts: 54
|
|
|
|
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
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|