Sorry, but without some idea of *what* all of your possible database allocations look like, and what you think the report should look like, trying to 'debug' your SQL would be a waste of time.
I would suggest:
1 - rethinking the general plan; because segments can span disk fragments, and multiple segments can reside on a single fragment, I'd recommend reporting on space at the segment level ... or log vs non-log (though this gets tricky with fragments that include data and log allocations)
2 - take a look at the source code for sp_helpsegment; the logsegment calculations may take a few minutes to comprehend but once you understand how sp_helpsegment works you should have no problems coming up with a custom query to generate the report you want
NOTE: Once you've figured out how sp_helpsegment works you should look at removing the hard-coded page size (16) thus making sure you're query can run in any ASE.