.CONVERT BYTES TO HEX

This subroutine converts a field to hexidecimal characters.


Usage:

      PASS         <hex_result>               FIELD            SHARE? Y
      PASS         <data>                     FIELD            SHARE? N
      PASS         <no_chars>                 FIELD            SHARE? N
      GOSUB    --- .CONVERT BYTES TO HEX
      *        Check for errors
      IF       --- .CONVERT BYTES TO HEX      NE

Description:

This subroutine converts a field to hexidecimal characters. The first 2 parameters are required, the <no_chars> is optional. If any required parameters are missing, the subroutine will CANCEL.

<hex_result> returns the hexidecimal characters corresponding to the data in <data> (Required). This must be PASSed Share "Y" to return the value.

<data> is the data you want converted to hexidecimal (Required).

<no_chars> is the number of characters of <data> to convert (Optional). If not PASSed, it will default to the length of <data>.

If <data> is not a simple alpha field, it will converted to a simple alpha field first (according to the rules of the SET statement), then that will be converted to hexidecimal.

If <hex_result> is not large enough to contain the result, --- .CONVERT BYTES TO HEX will contain 'Data was truncated'.

Comments:

Read what other users have said about this page or add your own comments.


-- JeanNeron - 2012-02-03


This topic: Main > WebHome > APPX510Features > APPXRuntimeSubroutineAPI > 0LASubrConvertBytesToHex
Topic revision: r2 - 2012-02-10 - JeanNeron
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback