"Ron" <fa*******@wanadoo.nl> wrote in message
news:42***********************@news.wanadoo.nl...
Who knows how to convert a field with picture
decimal (8) to a db2 date?
--
Met vriendelijke groet
Ron van der Poel
If you have a host variable with PIC 9(8), and the format is YYYYMMDD (or
similar), and you want to use that host variable in an SQL statement, then
here is one way.
First, make sure the it is not defined as S9(8). If it is, move it to a
variable that is defined as PIC 9(8) to strip off the sign. The PIC 9(8)
target variable should be REDEFINED as PIC X(8), with separate subordinate
levels for the year, month, and day as individual variables X(4), X(2), and
X(2).
Then move the character year, month, and day variables to another variable
which has embedded dashes so that the final character filed is defined as
PIC X(10) as follows '2005-04-13'.
Then use the PIC X(10) variable as a host variable in the SQL statement.