Announcement

Collapse
No announcement yet.

Reg : convert character data to hex

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reg : convert character data to hex

    Hi

    any one knows how to convert character data to hex convert..

    Thanx in advance

    magesh

  • #2
    Re: Reg : convert character data to hex

    magesh,

    Code:
     H DEBUG OPTION( *SRCSTMT : *NODEBUGIO ) DATFMT(*USA/)         
     H BNDDIR( 'QC2LE' )                                           
      /If Defined( *CRTBNDRPG )                                    
     H DFTACTGRP ( *NO ) ACTGRP( *CALLER )                         
      /EndIf                                                       
                                                                   
     D ToHex           PR                  EXTPROC('cvthc')        
     D  szHexVal                  65535A   OPTIONS(*VARSIZE)       
     D  szCharVal                 65535A   CONST OPTIONS(*VARSIZE) 
     D  nSrcLen                      10I 0 VALUE                   
                                                                   
     D FromHex         PR                  EXTPROC('cvtch')        
     D  szCharVal                 65535A   OPTIONS(*VARSIZE)       
     D  szHexVal                  65535A   CONST OPTIONS(*VARSIZE) 
     D  nSrcLen                      10I 0 VALUE                   
                                                                   
                                                                   
     D Alpha           S          65535A                           
     D Alpha2          S          65535A                           
     D Hex             S          65535A                           
     D Hex2            S          65535A                           
                                                                   
      /FREE                                                        
                                                                   
       Alpha = 'Test Data';                   
       Hex = *BLANKS;                         
       ToHex( Hex : Alpha : %LEN( Alpha ) );  
       FromHex( Alpha2 : Hex : %LEN( Hex ) ); 
                                              
       *INLR = *ON;                           
                                              
      /END-FREE
    HTH,
    MdnghtPgmr
    "Tis better to be thought a fool then to open one's mouth and remove all doubt." - Benjamin Franklin

    Comment

    Working...
    X