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

Converting EBCDIC to Unicode (TimeStamp)


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

New User


Joined: 02 Jun 2013
Posts: 15
Location: India

PostPosted: Mon Jul 25, 2016 10:42 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 2573
Location: NYC,USA

PostPosted: Tue Jul 26, 2016 8:00 pm
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: 1281
Location: Belgium

PostPosted: Mon Aug 01, 2016 3:35 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Calculate with timestamp PL/I & Assembler 19
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts XYplorer - EBCDIC to ASCII translatio... All Other Mainframe Topics 0
No new posts Converting Hex to PD Special Condition SYNCSORT 3
No new posts EBCDIC to ASCII conversion help All Other Mainframe Topics 1
Search our Forums:

Back to Top