ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Convert Delimited Hex Data String to Character

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert Delimited Hex Data String to Character

    I have created an output file using the STRDBMON command. It is monitoring the STRSQL command and creating records that include the SQL statement that was run. If the SQL statement had a WHERE clause it shows the where clause with "?" for the values requested. For example:

    SELECT qqstim, qq1000 from eric/strsqlmon1 where qqrid = ? and qquser = ?

    It will then create another record that has a field with the values denoted with the "?". If the data requested in the WHERE clause is numeric it will show the value. If it is character the field will be in hex format. Here is what the field for the above statement looks like with QQRID being numeric and QQUSER being character. Notice they are comma separated:

    1000, X'C5C8C9D3D3'

    That hex field should translate to EHILL.

    I have a routine to parse out the fields based on the comma delimiter (GETTOK. Thanks Scott Klement). But I cannot get it to give me the actual character value instead of the hex value. Could it be the extra quote(') mark being placed on a character field? I have the returned parsed field defined as 50a on the D specs of my program. When I look at the field in debug after parsing it looks like this:

    'X'C5C8C9D3D3' '

    Do I need to somehow strip away the extra quote marks? Do I need to define the field differently on the D specs? I'm at a loss on this one. Probably something simple I'm missing.

    Thanks in advance!!!

Working...
X