Sorry NicC . . . I deleted the repeat post you mentioned . . .
What you have is a simple SELECT, that reads a selected column based ion a CASE statement and some selection criteria.
WHEN COUNT(SX008.NUM_CPF_CNPJ) = 0
END AS :WS-IND-TP-PREMIO
FROM SX_EXC_COBER SX112
WHERE SX112.COD_PARAM_EXC_COBER = :SX112-COD-PARAM-EXC-COBER
AND SX112.NUM_COBERTURA = :SX112.NUM-COBERTURA
When posting Code, JCL, data, etc, you need to use the Code tag to improve readability and retain alignment.