If you're on a supported version of the OS, ie 6.1 or higher...
You might be able to make use of "grouping set" functionality. Particularly the ROLLUP clause.
I can't say for sure without more understanding of your data.
Otherwise, you're going to need to so something like
wth Cnt as (select ORDNO, OPSEQ, count(*) as NbrOccur from MOTRAN group by ORDNO, OPSEQ ) Select MOTRAN.ORDNO, MOTRAN.OPSEQ, MOROUT.WKCTR, MOTRAN.TDATE, MOTRAN.LBTIM, MOROUT.SRLHU, MOROUT.RLHTD, MOROUT.ACODT, MOROUT.SCODT, MOROUT.ASTDT, MOMAST.SSTDT, MOMAST.FITWH, MOMAST.FITEM, CONCAT(MOTRAN.ORDNO, MOTRAN.OPSEQ) As CON, Cnt.NbrOccur, MOROUT.SRLHU / Cnt.NbrOccur as calc from motran join Cnt on mortran.ordno = cnt.ordno and mortran.opseq = cnt.opseq *(snip)*