I have a table with a VARCHAR column that holds transaction data. I need to extract a transaction amount from the VARCHAR, but it’s in packed decimal.
Is there a way to map a COBOL copybook to a VARCHAR column of a table? If not, can I write the VARCHAR column to a template flat file and then apply a copybook layout to that to extract the packed decimal field?
For anyone who runs across the same issue, I was able to come up with a solution.
You can use substr() to pull the data out of VARCHAR as string and then write the result to a flat file. Next, do a query to fetch the data from the flat file using a COBOL copybook with a COMP-3 field.