Add HEX key to PC5250

iSeries Access PC5250 keyboard does not have the Hex key that the old 5250 keyboard did. Assign this script to a key to get this function back.

To create the script, go to Edit->Preferences->Macro/Script... in the emulator. Click on the Customize button. Then go to File->New->VB Script. Paste the code below into the edit window and save it. I call it HEX.MAC.

Now go to the keyboard mapping editor of PC5250 and assign this macro to a key combination like Shift-Ctrl-X.

If you want to be able to enter display attributes, change the lower limit to 32 (x20) as needed.


Option Explicit

Dim input_value, hex_value

autECLSession.SetConnectionByName (ThisSessionName)


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)
        MsgBox ("value '" & input_value & "' out of range")
        Exit Sub
    End If

    MsgBox ("non numeric input '" & input_value & "'")
    Exit Sub
End If

autECLMacro "apl " & Hex(input_value)
End Sub



The Best Web Links: Tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Read this Search400.com Featured Topic: Monitoring your iSeries system .

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

This was first published in September 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.