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
 

 

Converting EBCDIC to Unicode (TimeStamp)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
muralikrishnan_new

New User


Joined: 02 Jun 2013
Posts: 11
Location: India

PostPosted: Mon Jul 25, 2016 10:42 pm    Post subject: Converting EBCDIC to Unicode (TimeStamp)
Reply with quote

Hi,
I am Converting a EBCDIC Timestamp value to Unicode Timestamp value to use it in my Db2 table.

Code:

01 WS-EBCD-TS               PIC X(26) VALUE '2016-04-18-01.12.11.005634'.
01 WS-UNCD-TS               PIC N(26).
.......
......
......
Move Function national-of(WS-EBCD-TS)  TO WS-UNCD-TS

EXEC SQL
     SELECT LENGTH(COL1)
         FROM TABLE1
     WHERE LATE_TS   = :WS-UNCD-TS
END-EXEC


I am getting sqlcode -180.
Code:

SQLCODE -180
SQLCABC +136
SQLSTATE 22007
SQLERRD +186


I have even tried the below SQL
Code:

EXEC SQL
      SELECT LENGTH(COL1)
         FROM TABLE1
     WHERE LATE_TS   = CAST(:WS-UNCD-TS AS TIMESTAMP(6) CCSID         UNICODE)
END-EXEC


But still i am getting the same SQLCODE. Is there any way to convert Timestamp from EBCDIC to unicode timestamp .

Please help me to correct if i have made any mistakes.
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jul 26, 2016 8:00 pm    Post subject:
Reply with quote

Shouldn't it be?
Code:
CAST(:WS-EBCD-TS TIMESTAMP(6) CCSID         UNICODE
Ensure there is no truncation
Code:
CODEUNITS32
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Mon Aug 01, 2016 3:35 pm    Post subject:
Reply with quote

db2 should take care of it by itself. it will recognize that the host-variable is EBCDIC and that the table is unicode (if it is?) and take care of the the translation for you.
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 EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts changing z/os unicode conversion service meykh2014 All Other Mainframe Topics 0 Tue Jul 12, 2016 10:49 am
No new posts PC to Host for unicode file Tom Steiner TSO/ISPF 5 Mon May 16, 2016 10:38 pm


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