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
 
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: 15
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: 1940
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: 1281
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 row change timestamp charanmsrit DB2 3 Tue Jul 10, 2018 12:30 pm
No new posts Converting SAS code to Cobol or Easyt... Ashish.Raghav All Other Mainframe Topics 6 Fri Jun 29, 2018 6:01 pm
No new posts converting '36000C'x Pedro PL/I & Assembler 4 Wed Jun 27, 2018 4:14 am
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
This topic is locked: you cannot edit posts or make replies. UTC Timestamp Log Thangavel COBOL Programming 5 Mon Jan 22, 2018 9:04 pm

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