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: 6970
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: 6970
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 Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

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