I am having a x(5) field in db2 table but that field(empno) contains numeric data.
I would like to find the maximum employee number in that field and during new employee insert I need to add 1 to maximum available empno.Please suggest me how to do.I am getting -303 sqlcode if I move use MAX FUNIC and later move to comp variable
Joined: 20 Oct 2006 Posts: 6962 Location: porcelain throne
the explanation of the -303, if you bothered to look it up, would have suggested that your host variable is not the correct type.
why are you using a comp host variable for an x-type field? is that COMP-3 or what. Binary or PACK-DECIMAL.
use an x-type host variable, which is redefined as numeric if you just have to move it to a comp field. sorta silly since you are only saving two bytes by not using the x-type definition and are incurring more processing costs by either converting the numeric to binary or doing a PACK.