Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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: 6966
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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us