View previous topic :: View next topic
|
Author |
Message |
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Hi,
I am selecting a date from a DB2 table, which appears in QMF in ccyy-mm-dd format. I hope this is iso fomat. I need to read this into a cobol variable.
what should be the format of cobol variable. I tried using 9(10) which gives me error as target not in smallint format is there any way i can read the date from db2 into a cobol variable with 9(8) or x(8). |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. forget qmf.
2. what is the column datatype? |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Please use X(10) for using in cobol |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Ketan wrote: |
Please use X(10) for using in cobol |
only if it is a date datatype - which the TS has not bothered to clarify. |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Here is the SQL I use. REG_DT is CHAR(6) in table. I am trying to recieve the value WS-REG-DTE-COMP as x(8) or 9(8) in ccyymmdd format
Code: |
SELECT REG_DT,
DATE
( CASE
WHEN REG_DT = '000000'
THEN '0000-00-00'
ELSE
CASE
WHEN SUBSTR(REG_DT, 1, 2) > '64'
THEN '19'
ELSE '20'
END
|| SUBSTR(REG_DT, 1,2)
|| '-'
|| SUBSTR(REG_DT, 3,2)
|| '-'
|| SUBSTR(REG_DT, 5,2)
END ) + 3 YEARS
INTO :REG-DT
:WS-REG-DTE-COMP
FROM KPH.DFG_ETC_KL_OPF
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Poor design guarantees poor performance. |
|
Back to top |
|
|
|