Highlighted
Absent Member.
Absent Member.
299 views

[archive] Configurable escape codes

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread http://www.acucorp.com/support/supported/customer_forum/showthread.php?t=1057

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Configurable escape codes

so once you have the 07 1B, you then move x'07 1B' to apertura-cajon ... is this what you are doing?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Configurable escape codes

You can use the HEX2ASCII library routine to do this.


01  hex-string     pic x(4).
01  ascii-chars    pic x(2).

move "071B" to hex-string.  | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.

** now ascii-chars will contain the two bytes with hex values 07 and 1B

The routine requires a 4-digit input and provides 2-digit output, so for setting a single character you could do this:


01  hex-string.
    03  hex-char       pic x(2).
    03  filler         pic x(2) value "00".
01  ascii-chars.
    03  ascii-char     pic x.
    03  filler         pic x.

move "07" to hex-char.    | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.
move ascii-char to apertura-cajon1.


Of course, you should read the full documentation in Appendix I... 🙂
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Configurable escape codes

OK - I remember this post now.

Look at the example on my post using the redefines clause.

Also, word of warning - if you're trying to send hex codes to a printer then it appears to be very much hit and miss and thats even if you do actually use the spooler-direct clause

Personally we ended up going towards a 3rd party dll for the cash drawer interface
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.