If you know the EBCDIC value for any character, you can enter it using this macro. The PC5250 emulation in Client Access and Personal Communications does not have a Hex function that can be mapped to the keyboard. This function existed on the 5250 keyboards, and this macro gives the user the same ability, viz., to enter any character between x40 and xFE, either by entering the decimal value 64 -254, or the hex value, x40 - xfe, either upper or lowercase.
LANGUAGE=VBSCRIPT
[PCOMM SCRIPT HEADER]
LANGUAGE = VBSCRIPT
DESCRIPTION=Hex input
[PCOMM SCRIPT SOURCE]
Option Explicit
Dim input_value, hex_value
autECLSession.SetConnectionByName (ThisSessionName)
subHex_
Sub subHex_()
input_value = InputBox("Enter a decimal number between 64 and 254, or a hex value between x40 and xFE (either uppercase or lowercase")
If input_value = "" Then
MsgBox ("invalid input")
Exit Sub
ElseIf (IsNumeric(input_value) Or _
(Len(Trim(input_value)) = 3 And _
UCase(Left(input_value, 1)) = "X") And _
IsNumeric("&H" & Mid(input_value, 2, 2))) Then
If (UCase(Left(input_value, 1)) = "X") Then
input_value = "&h" & Mid(input_value, 2, 2)
End If
If (input_value >= 64 And input_value <= 254) Then
hex_value = Hex(input_value)
Else
MsgBox ("value '" & input_value & "' out of range")
Exit Sub
End If
Else
MsgBox ("non numeric input '" & input_value & "'")
Exit Sub
End If
autECLMacro "apl " & Hex(input_value)
End Sub
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
This was first published in April 2002