Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
reading iso date into cobol field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: reading iso date into cobol field
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: 6968
Location: porcelain throne

PostPosted: Wed Aug 26, 2009 1:57 pm    Post subject:
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Aug 26, 2009 3:14 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us