Eliminating ###'s after hex reconversion to char string

This is interesting.
I was originally required to pass a segment to my subroutine. I had to do so using text literals. The   symbol is not recognizable by text literals. Therefore, I had to convert the entire string to hex.
I then passed the hex segment to the subroutine, and reconverted it back to char string.
After this I found a ton of unexpected # symbols in my segment. I tried doing a
REPLACE '###' WITH '' INTO CHARSTRING.
, but unsuccessfully. There is not much documentation on hex_to_char conversion, there are 2 FMs on 46, but I cannot get them to work. If anyone knows how to eliminate these unexpected # symbols please let me know.

DATA: HEXSTRINGER(6000) TYPE 'X'.
DATA: STRINGER(3000) TYPE 'C'.
FIELD-SYMBOLS: <FSHEX>, <RECONVERT2>.
CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
               EXPORTING
                     ARCHIVE_HANDLE       = READ_HANDLE
               IMPORTING
                     RECORD               = ARC_BUFFER-SEGMENT
                     RECORD_STRUCTURE     = ARC_BUFFER-RNAME
           MOVE ARC_BUFFER-SEGMENT TO SEGSTER.
           assign SEGSTER to <fsHEX> type 'X'.
           MOVE <fsHEX> to HEXSTRINGER.
APPEND 'REPORT ZSUBR.' TO CODE.
APPEND 'FORM DYN1 USING HEXSTRINGER.' TO CODE.
APPEND 'DATA: SEGSTER2(3000) TYPE ''C''.' TO CODE.
APPEND 'ASSIGN HEXSTRINGER TO <RECONVERT2> TYPE ''C'' .' TO CODE.
APPEND 'MOVE <RECONVERT2> TO SEGSTER2.' TO CODE.
APPEND 'WRITE:/ SEGSTER2.' TO CODE.
APPEND 'ENDFORM.' TO CODE.
I write out Segster2 and compare it to segster.
I've done some variations of this where after I change the char string to hex string I replace 'C' with '7C' into hexstringer and then re-replace it in the subroutine, and then reconvert it to a char string- but actually I don't think that was a necessary step. I believe I can just convert it to hex, and then reconvert it back to hex in the subroutine.

Similar Messages

  • How can I get an unsigned char string with nulls from a dll into LabVIEW 6i?

    The following ethernet packet data is contained in an unsigned char * string returned from my dll (it's formatted on printing):
    Received A 230 Packet On Adapter 0x008F0070
    Ethernet Dest: 01.E0.BB.00.00.15 Src: 00.E0.BB.00.DD.CC Type: 0x8868
    000000: 01 E0 BB 00 00 15 00 E0 : BB 00 DD CC 88 68 48 41 .............hHA
    000010: 00 E0 BB 00 DD CC 80 B3 : 00 00 FF FF 00 02 00 01 ................
    000020: 01 00 F0 18 FF 7F 7F FF : FF 7F 7F FF FF 7F 7F FF ................etc., etc.
    However, when I read this string into LabVIEW 6i, I only get the following:
    01E0 BB
    Which is the data before the first NULL or 00 information. I found a "Remove Unprintable Chars.vi" but it
    just sees more data before the above string, nothing after, as seen here: 5C30 31E0 BB.
    Anybody have any suggestions for how to get the rest of the string? Is there something I can do to further reformat my dll? The dll I'm using is already a wrapper around another dll so I have some flexibility, but the bottom line is, the data I want is in the format of an unsigned char *.

    Excellent advice, this mostly works so I have some further questions:
    I am just reading network traffic off my ethernet card right now, but here is what I get using my C program to test:
    000000: 01 E0 BB 00 00 15 00 E0 : BB 00 DD CC 88 68 48 41 .............hHA
    000010: 00 E0 BB 00 DD CC 80 B3 : 00 00 FF FF 00 02 00 01 ................
    000020: 01 00 38 3C FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7F FF ..8<............
    000030: FF 7F 7F FF FF 7F 7F FF : 7F 7F 7F FF FF FF FF FE ................
    000040: FE FF FF FF FF 7F 7F 7F : 7F 7E 7E 7F 7F 7E 7E FF .........~~..~~.
    000050: 7F 7F 7F 7F FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7E 7F ..............~.
    000060: 7F 7F 7E 7F 7F 7E 7F FF : FF 7F FF FF FE FF FF FE ..~..~..........
    000070: FF FF FF FF FF 7F 7F FF : FF 7F 7F FF FF FF FF FF ................
    000080: FF 7F 7F FF FF 7F 7F FF : FF 7F 7F FF FF 7F 7F FF ................
    000090: FF 7F 7F 7F FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7F FF ................
    0000A0: FF 7F 7F 7F 7F 7E 7E 7F : 7F 7F FF FF FF FF FF FF .....~~.........
    0000B0: FF FF 7F FF FF 7F 7F FF : 7F 7F 7F FF FF 7E 7F FF .............~..
    0000C0: FF FF 7F FF FF 7F 7F FF : 7F 7F 7F FF FF 7F 7F FF ................
    0000D0: FF 7F 7F FF FF 7F 7F 7F : 7F 7F 7F FF FF FF FF FE ................
    0000E0: FE FF FF FF 00 01 : ................
    And here is what I get using LabVIEW to call the dll:
    0015 00E0 BB00 DDCC 8868 4841 00E0 BB00 DDCC 80B3 0000 FFFF 0002 0001 0100 9600 7F7F 7F7E 7F7F 7F7F 7F7F 7F7F 7F7F 7F00 B405 4300 3300 0000 0000 0000 01E0 BB00 0015 00E0 BB00 DDCC 8868 4841 00E0 BB00 DDCC 80B3 0000 FFFF 0002 0001 0100 9600 7F7F 7F7E 7F7F 7F7F 7F7F 7F7F 7F7F 7F00 F405 1B04 0C04 0000 0000 0000 8000 0000 0000 0000 0800 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
    The first thing I notice is that the first 4 bytes are chopped off, and after about 50 bytes, the data is corrupted until the sequence starts to repeat, but this time it starts with the missing 4 bytes and still corrupts after about 55 bytes.
    I am expecting the data in LabVIEW to look very similar to the C data because the network packets I am grabbing are pretty consistant, only a couple bytes will vary between them, not the number I am seeing in LabVIEW.
    Another side effect I'm seeing is that I can only run my labVIEW code once, if I try running it again it crashes with failures such as:
    memory could not be "read"
    For reference, I am opening and closing the network adapter inside the read function of my dll, but the pointer seems like it should be intact...
    Attachments:
    zListAdapters.vi ‏30 KB
    listAdapters.dll ‏201 KB
    Reading.dll ‏213 KB

  • How to Convert a HEX value to CHAR value...Unicode Issue...

    Hi,
    How can I convert HEX value to CHAR value.
    The Code in <b>non Unicode</b> system is:
    DATA: t_text LIKE tline OCCURS 0 WITH HEADER LINE.
    constants:   c_hex_20a5(2) TYPE x            VALUE '20A5'.
    t_text-tdline = 'seller of the item so listed.  A legend of the Seller Code(s) is as'.
          TRANSLATE t_text-tdline USING c_hex_20a5.
    The same code give error in <b>Uni-Code</b> system:
    <b>error is "c_hex_20a5 must be an character type object (C, N, D, T or String type)."</b>
    If anyone know, what is the solution, please let me know.
    Thanks!
    Puneet.

    Hi,
    Try declaring the Hex chars using the ABAP char utilities. This is just a sample piece of code on how to declare and use:
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    DATA:  ws_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    data:    c_newline           TYPE x VALUE '0D'.  [ it is zero D, for carriage return ]
    ws_lf = c_newline.
        CONCATENATE it_tab-maktx
                    ws_lf
                    ws_template
                    INTO it_notificatn-template.
    Hope this helps...
    Regards
    Subramanian

  • Replace hex character in a string with another hex character

    Hi Guys,
    Heres a problem scenario, hex character 92 looks very much like hex character 27 (apostrophe).
    I need to write a program that can replace all hex character 92 to hex 27 in a string.
    Being a novice on the regular expressions, I would appreciate if somebody can show
    the exact syntax to to perform this replacement.
    Many Thanks
    -Anil

    I don't think you need to use regex to do this:
    String s = something();
    char a = 0x27;
    char b = 0x92;
    s.replace(a,b);
    And don't forget that since Strings are immutable you need:
    s = s.replace(a,b);to do anything useful.

  • How to sum space delimited hex values in a string, and do other stuff?

    Hello
    I am trying to write a Bourne shell script that takes a non-constant-length character string as input, converts each character to hexidecimal value, sums each value, takes the two's complement of the sum, logically ANDS it with FF, and if any of the resultant "nibbles" are a-f, print/save that nibble as A-F, for later display as a two-character-long character string
    For example, assume a variable (as in non-constant) length variable $A
    A="w04:0;2"
    the road that I started down was to define
    B=$( echo $A | od -An -t x1 -N"${#A}" )
    # for this example, $B=77 30 34 3a 30 3b 32
    It's the middle part where I need some magic. What I want to do is add the whitespace-delimited hex values of this string, for this example
    C=77+30+34+3a+30+3b+32
    so for this example, $C=1b2
    then take two's complement of $C; for this example, $TWOS_COMP=ffff ffff ffff ffe4e
    and logically AND it with FF; for this example, almost-final answer is 4e
    then save final result as uppercase character string variable (for this example, variable's contents would be 4E)
    Is what I'm trying to do intuitively obvious to any of you gurus out there, that could rattle off an answer? I'm okay with trashing my approach thus far and trying something totally different, within the constraint that it run inside a Bourne shell script.
    Thanx in advance, if anybody can help!

    I've made progress. I've converted each character of a non-constant-length string $A into a space-delimited string of hex values, added them up, and retained the least significant byte (i.e., the 8 least significant bits). Here's how:
    B=$( echo $A | od -An -t x1 -N"${#A}" )
    D=0
    for C in $B; do
      C=0x$C
      D=$(($D + $C))
    done
    D=$(($D & 16#FF))
    D=`echo "ibase=10;obase=16;$D" | bc`
    The missing piece now is how to take the two's complement of $D. Anybody out there with any ideas on how to handle the two's complement piece inside a Bourne shell?
    Thanx

  • I want to take a series of hex characters in a string control and produce an HDLC string indicator for example if the data string control is 3F27 then the HDLC string indicator is 7E003F2700B57E

    I want to take a series of hex characters in a string control and produce an HDLC string indicator for example if the data string control is 3F27 then the HDLC string indicator is 7E003F2700B57E

    "thanks for your help "
    Does that mean you figured it out already?
    If not, see this thread for some HDLC related code.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=146859&query.id=3388#M146859
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Concatenate Hex'04' to text string

    Hi
    I need to concatenate Hex'04' to text string. How can I use class cl_abap_char_utilities to realize it?
    Thanks,
    Crystal
    Edited by: Crystal Yu on Feb 8, 2008 8:15 PM
    Edited by: Crystal Yu on Feb 8, 2008 8:16 PM

    Hello Peter,
    use a single TextField and concatenate the string before putting it into the context. FormCalc or JavaScript won't be needed then.
    A good way to determine where the problem resides is to create an addition WD based
    TextView and display the same data there. If it shows up with data there and with no
    data in the form, then the problem resides in the form rather than in the WD context.
    Best regards,
    Thomas

  • Generate unique 10 char string

    Hi,
    i have to generate a unique 10 char string ( a string with length of 10 ) which has numbers and alphabets with no special characters, is there any code of doing it
    Ashish

    class UniqueString {
      private static final int NUM_CHARS = 10;
      private static int[] lastString = new int[NUM_CHARS];
      private static final String chars =
    "0123456789abcdefghijklmonpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
      static String getUnique() {   
         char[] buf = new char[NUM_CHARS];   
         carry(lastString, buf.length-1);
         for(int i=0;i<buf.length;i++) {
           buf[i] = chars.charAt(lastString);
    return new String(buf);
    private static void carry(int[] ca, int index) {
    if(ca[index]==(chars.length()-1)) {
    ca[index]=0;
    carry(ca,--index);
    else ca[index]= ca[index]+1;
    public static void main(String[] args) {
    for(int i=0;i<10000;i++)
         System.out.println(UniqueString.getUnique());
    Guarenteed to be unique within one VM instance.
    matfud

  • One Char String - performance

    Hi-ya all
    Two questions, both performance related.
    1. What would be the fastest way to produce a one char string, is there anything faster than new String(char + "").
    2. What would be the fastest way to get an uppercase from a char, is there anything better than a switch and or set of if/elses, for example some sort of fiddle factor?
    thanks

    Character.toString(char)
    Character.toUpperCase(char)

  • Bit char string...need help

    Hi I am trying to convert a bit char string to something useful.  Basically I have an activex tool that allows me acess to a serial port based scale.
    I send a weight request command and it sends me this gibberish:
    °®°° ìb ÇR
    Thank I try to do a tostring() and get this:
    \u00b0\u00ae\u00b0\u00b0, on line 1, column 21, is not a valid identifer name.
    Hmm.. anyone have to deal with bitchar strings coming from serioal ports or know what i am dealing with here?
    Thanks
    Frank

    Basically you need to access the string as a byte array - I think
    there's a method getBytes() that you can apply to a string.
    Mack

  • How to replace mixed chars string

    Hi All,
    I want to replace mixed chars string from each row and want to replace with new string.
    Ex : The existing string might be in different cases like "Abc string", "abc string", "aBC string". I want to search for all these string types and want to replace with new string "Abc string".
    Could anyone give suggestions on this.
    Thanks,
    Prakash

    [url http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/functions149.htm#i1305521]REGEXP_REPLACE supports case insensitive replacing.
    REGEXP_REPLACE(source_string,'abc string','Abc string',1,0,'i')The *'i'* specifies case insensitive replacing, so it will find all of "Abc string", "abc string", "aBC string" :-)

  • Char. strings w/o text elements will not be translated:

    Hi ,
    I have a few constants in my program.
    But when i declare them as
    text(12) type c value ' hello world',
    In the code inspector i encounter "Char. strings w/o text elements will not be translated:" error.
    Can somebody h

    Hi,
    Text elements are required for Translating purpose. You have declared a free string but haven't declared the corresponding text element for that string. Thus the error. Please double click on the string and create the text element to get rid of the error in code inspector. This is not a mandatory thing but should be done.
    Hope it helps.
    Regards,
    R

  • Need Hex conversion to char for 4 digits.

    I need to read a file in and translate some of the characters into integers. I need the hex value from the character. Problem is, when using Cp850 which is the encoding of the file, some characters show as ? instead of the proper character.
    A simple output shows the problem where only 4 digit hex values will not appear correctly. You can view the character set and values at the following URL http://www.microsoft.com/globaldev/reference/oem/850.htm
    Here is a simple app to show the problem.
    public class EncodingTest {
         public static void main(String[] args) throws Exception {
              String encoding = "Cp850"; //args[ 0 ];
              byte[] b = new byte[256];
              for (int i = 0; i < 256; i++)
                   b[i] = (byte)i;
              byte c[] = new byte[1];
              String x = new String(b, encoding);
              for (int i = 0; i < x.length(); i++) {
                   c[0] = b;
                   if (x.charAt(i) != i)
                        System.out.println(i + " -> " + (int)x.charAt(i) + "->" + (new String(c, encoding)));
    How to I get character 176 for example to show correctly? I tried to post the output from the app but all of the characters showed as ?.

    Well, if you want to convert int or char values to hex, just do the following:
    Integer.toHexString(int value);
    Now, about your charset problem, I tried it and found out that you will definetly not be able to print strange characters in DOS.
    I'll show you my example, it might help you; it prints out good in my computer...
    public class EncodingTest {
        public static void main(String[] args) throws Exception {
            String encoding = "Cp850"; //args[ 0 ];
            byte[] b = new byte[256];
            for (int i = 0; i < 256; i++)
                b[i] = (byte) i;
            byte c[] = new byte[1];
            String x = new String(b, encoding);
            for (int i = 0; i < x.length(); i++) {
                c[0] = b;
    if (x.charAt(i) != i)
    System.out.println(i + " -> " + Integer.toHexString((int)x.charAt(i)) + "-> " + (int)x.charAt(i) + "->" + (char) i + "->" + (new String(c, encoding)));

  • Exporting char(string) to excel file using GUI_DOWNLOAD

    Dear Team,
    When i am trying to export Data of type Char(like 12345678987654321)  , after export it convert this data to Floating format(scientific n1E+n2) which is not my desired  output .i need to change it using excel cell format control.
    suggest me how can i handle this..
    Thanks in Advance*.

    Hello Santosh,
    Play with the below importing parameters in the function module "GUI_DOWNLOAD".
    WK1_N_FORMAT - Format for value columns in files of the type WK1
    WK1_N_SIZE - Column width for value columns in files of the type WK1
    WK1_T_FORMAT - Format for text columns for files of the type WK1
    WK1_T_SIZE - Column width for text columns for files of the type WK1.
    It might help you I guess. Also read the documentation of those importing parameters by clicking on the long text green icon after the description in the IMPORTING parameters tab of the function module.
    Regards,
    TP

  • Changing a char-string into decimal

    i have a problem:
    over my serial connection i just get strings in char but i need decimal numbers!
    can you help me!
    thx wiesi

    What do you mean "a normal number"? This is a number, 97, and it's inside an array. What do you expect this number to be? To extract it from the array you have various options, from using an index array function to using an auto indexed for loop.
    If your problem is with using the array, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide.
    Try to take over the world!

Maybe you are looking for

  • How's playback from external hard drives and 802.11g?

    I'm thinking about putting my movies on an external Firewire hard drive connected to my iMac Intel Core 2 Duo. Does it make a difference in playback jumpiness if any with: 1. The movies on an external Firewire hard drive connected to my Mac? 2. The m

  • Shuffle doesn't work correctly on PS4 app

    On PlayStation 4 when I use shuffle on playlists which have songs from multiple artists it only plays one artist at a time. For example I have a Rock-playlist containing Disco Ensemble, Billy Talent and Offspring. When I hit play, it starts playing D

  • Dynamic type cast

    I want to cast an object to the class of another object whose class is not known statically. Is there anyway to do it in a fully dynamic way ? I tought about something like this : Boolean b1 = new Boolean (true); Boolean b2 // now suppose, I forget t

  • InterMedia Misconfigured

    I get the following message while trying to configure iFS. " Intermedia seems to be misconfigured...errors during recompilation/revalidation of CTXSYS.CONTEXT ORA-29835:ODCIGETINTERFACES routine does not return the required interface(s)". For info, t

  • Premiere Pro CC - XML exports timebase always off, 24 as 30

    I constantly edit offline RED footage as ProRes proxys, and when I export an XML of the final sequence to relink, EVERY time the XML has all the clips as <timebase>30</timebase>, despite the fact that the media is always 23.976 fps in a 23.976 sequen