IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

reading iso date into cobol field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Wed Aug 26, 2009 1:16 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 26, 2009 1:57 pm
Reply with quote

1. forget qmf.

2. what is the column datatype?
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Wed Aug 26, 2009 2:31 pm
Reply with quote

Please use X(10) for using in cobol
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 26, 2009 3:14 pm
Reply with quote

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
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Wed Aug 26, 2009 10:25 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Aug 26, 2009 10:49 pm
Reply with quote

Poor design guarantees poor performance.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top