DB2 seems to do a SORT before every GROUP BY action. At least if I look at the query plan (using Visual Explain in the Command Center) of -- connected to the sample db SELECT WORKDEPT, SUM(SALARY)
I called Stored Procedure written in SQL from Object REXX on Windows like this CALL SQLEXEC 'CALL MigrateDECODE(:inString,:Converted)' CALL CHECKERR 'CALL MigrateDECODE'