Selecting Packed Fields from Tables
COBOL programs with embedded SQL statements present a wrinkle you may not be aware of. If you are selecting a group of fields in packed format from tables and you try to use those fields in your COBOL program, you have to fetch the fields into working storage variables which are defined as packed. Then you must unpack them before using them in the COBOL program.
Suppose a field is packed (numeric) in a table. You have to define that field in working storage as S9(n) COMP-3 and then unpack this field before you can use it in your program.