IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

COnvert a column with mix of hex ,char ,int to readable form


 
IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message
shub2204

New User


Joined: 13 May 2020
Posts: 19
Location: India

PostPosted: Fri Oct 02, 2020 2:20 pm
Reply with quote

Hi,

I have a requirement where a table has a column varchar(193) .however this column contains data in unreadable format. It is a mix of characters ,some are readable some are not. Is there a way to decode them using SQL query
Code:


  AUDIT
 BEFORE1
 -------------------------------------------------------------------------------
  cjÃ201704240945460             0                          p             à {  ‰±1  srCPFP290      s
  ”Ux201704240947440             0                                        à {  ‰±1  srCPFP290      s
  ”Uy201704240947480             0                          ñ             à {  ‰±1  srCPFP290      s
  ÝXi201001221110320             0                      Ý       †         r {  §
  ÝXÆ201001221110320             0                      Ý       Ü         r {  §
  úzž200610081016330             0                      Û       Ó         Z    ž
  úz 200610081016330             0                      Û      ±÷         Z    ž
  úz¡200610081016330             0                      Û      }˜         Z    ž
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 47
Location: India

PostPosted: Fri Oct 02, 2020 6:30 pm
Reply with quote

shub2204 wrote:
Hi,

I have a requirement where a table has a column varchar(193) .however this column contains data in unreadable format. It is a mix of characters ,some are readable some are not. Is there a way to decode them using SQL query
Code:



CHAR data is CHAR data, and there is no way to decode them. You can decode only numeric binary, decimal or floating point data types, and not CHAR data types. If you think what you are seeing is incorrect then you should probably check the source of that data.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

PostPosted: Sun Oct 04, 2020 6:30 pm
Reply with quote

Display your column as hexadecimal value.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Sun Oct 04, 2020 11:41 pm
Reply with quote

You can try either of this ,
1. Fix the source if that’s not what you want.
2. Try UNHEX or HEX
3. Db2 has build in encoding and decoding feature , explore it.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

PostPosted: Mon Oct 05, 2020 12:07 am
Reply with quote

In general, Software Development is very, very different from playing computer games.

In both cases one needs to click many buttons on computer, and/or move and click a mouse, or other pointing device. Everything else is different in those two activities.

The base to start Software Development should be: good knowledge of Information Technology basics, including algorithms, data processing, and many, many others.

Please, do not seek for an IT job as soon as you became an expert in a few of computer games. icon_pai.gif icon_axe.gif
Back to top
View user's profile Send private message
shub2204

New User


Joined: 13 May 2020
Posts: 19
Location: India

PostPosted: Tue Oct 06, 2020 5:46 pm
Reply with quote

Thanks all for the lovely feedback

i have sorted it out and able to display data. wrote down a cobol code for the same
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Can we Insert duplicates in Primary U... DB2 0
No new posts How do i verify the char field is hav... PL/I & Assembler 1
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
No new posts how to convert Hex String t char hex PL/I & Assembler 6
No new posts Insert System Runtime in HEADER In SY... SYNCSORT 9

Back to Top