Bill,
Your recommendation to do an SQL Select with Case statements is great
and I thank you.

Your observation made me give myself a dope slap because I had forgotten
that I have previously used STRQMQRY with output parms to create files
with descriptive column names, shown here:

STRQMQRY QMQRY(F55PROFE) OUTPUT(*OUTFILE) +
OUTFILE(PLAN/F55PROFE) SETVAR((BEGIN +
&PSOPT1) (END &PSOPT2))

The QMQRY logic is:
SELECT
TDAC05,TDELNM,SDADDJ,SDDOCO,SDDCTO,SDAN8,TDMNNS,TDCTYS,TDADDO,TDADZO,

SUM(CASE WHEN SDSRP1='HDW' THEN SDAEXP * 0.01 ELSE 0 END)

AS WoodGateHdw,

SUM(CASE WHEN SDSRP1='HDW' THEN TD$PXP ELSE 0 END)

AS WoodGateHdw_Profit,

SUM(CASE WHEN SDSRP1='QR ' THEN SDAEXP * 0.01 ELSE 0 END)

AS QuickRok,

{ and many more SUM AS statements omitted here}

FROM F42119J9 WHERE SDADDJ BETWEEN &BEGIN AND &END

AND SDKTLN=0

AND SDDCTO IN('SO', 'SC','SP')

AND SDLNTY IN('P','S','C')

AND SDMCU NOT IN(' 350',' 2000')

AND SDTORG NOT IN('LMITCHELL', 'JMCINTYRE' )

GROUP BY TDAC05,TDELNM,SDADDJ,SDDOCO,SDDCTO,SDADDJ,SDDOCO,SDDCTO,SDAN8,

TDMNNS,TDCTYS,TDADDO,TDADZO

ORDER BY TDAC05,TDELNM,SDADDJ,SDDOCO,SDDCTO,SDADDJ,SDDOCO,SDDCTO,SDAN8,

TDMNNS,TDCTYS,TDADDO,TDADZO




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.