Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cobol key map

Status
Not open for further replies.

butler

MIS
Oct 12, 1998
88
0
0
US
Greetings,

I have a handheld wireless device (Blackberry 7510) running telnet vt100 emulation. I am using this to access a microfocus cobol application running on IBM/AIX. The problem is, I can't get function keys F5-F12 to work.

I have tried running keybcf from from the Blackberry, but still not luck. Does anyone know a little more about key maps that they could share?

Thanks much,
--bill
 
Try this program.
Code:
       IDENTIFICATION DIVISION.
       PROGRAM-ID.     PRTCBL.
       AUTHOR.         J C FAIRFIELD.
       DATE-WRITTEN.   MAY, 1991.
       DATE-COMPILED.
      *>
      *> This program displays the scancode it gets from keystokes.
      *>

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-CHARS.
           05  WS-CHAR1        PIC X.
           05  WS-CHAR2        PIC X.
       01  REDEFINES WS-CHARS.
           05  WS-BYTE1        PIC X COMP-X.
           05  WS-BYTE2        PIC X COMP-X.

       01  WS-HEX              PIC XXXX.
       01  REDEFINES WS-HEX.
           05  WS-HEX1         PIC X COMP-X.
           05  WS-HEX2         PIC X COMP-X.
           05  WS-HEX3         PIC X COMP-X.
           05  WS-HEX4         PIC X COMP-X.

       PROCEDURE DIVISION.
           PERFORM UNTIL WS-CHARS = X'0300'
               CALL 'CBL_READ_KBD_CHAR' USING WS-CHAR1
               IF WS-CHAR1 = LOW-VALUE
                   CALL 'CBL_READ_KBD_CHAR' USING WS-CHAR2
               ELSE
                   MOVE LOW-VALUE TO WS-CHAR2
               END-IF
               DIVIDE WS-BYTE1 BY 16 GIVING WS-HEX1 REMAINDER WS-HEX2
               DIVIDE WS-BYTE2 BY 16 GIVING WS-HEX3 REMAINDER WS-HEX4
               INSPECT WS-HEX CONVERTING
                   X'000102030405060708090A0B0C0D0E0F' 
                   TO '0123456789ABCDEF'
               DISPLAY WS-HEX
           END-PERFORM
           STOP RUN
           .
 
VT100 emulation handle only F1-F4 function keys.
If you need F5-F12 function keys you need emulate VT200.
 
The application is sending key codes for all function keys from F1 thru F24, but it's documentation says its VT100, and it registers itself with unix as vt100.

Can I just change the TERM=vt100 to TERM=vt200??

I am going to try that COBOL program today. Here is what the telnet application guy tells me the program is sending:

F1 = 1B 4F 50
F2 = 1B 4F 51
F3 = 1B 4F 52
F4 = 1B 4F 53
F5 = 1B 4F 54
F6 = 1B 4F 55
F7 = 1B 4F 56
F8 = 1B 4F 57
F9 = 1B 4F 58
F10 = 1B 4F 59
F11 = 1B 4F 5A
F12 = 1B 4F 5B
F13 = 1B 4F 5C
F14 = 1B 4F 5D
F15 = 1B 4F 5E
F16 = 1B 4F 5F
F17 = 1B 4F 60
F18 = 1B 4F 61
F19 = 1B 4F 62
F20 = 1B 4F 63
F21 = 1B 4F 64
F22 = 1B 4F 65
F23 = 1B 4F 66
F24 = 1B 4F 67
 
Greetings,

Using a debugger, I stepped thru the lagacy cobol software I am trying to access with the vt emulation. Here is the code if uses to pick up Fkeys:

03 DISK-ERR PIC XX.
...
ACCEPT SH-2 ESCAPE GO TO 015-EOJ.
ACCEPT DISK-ERR FROM ESCAPE KEY.

The expected return codes for the lagacy app are ESC="01", F1="02", F2="03", etc.

But when I use webrabbit's program for an F1, I get 'FF 01 09' as expected. I don't understand what my legacy stuff is doing? It is picking up the Fkeys above F4, but string value is not what is expected...

--bill
 
The syntax you show is Microsoft COBOL syntax. Micro Focus supports it, but I don't know how well, especially with a terminal emulater. Microsoft has not made a COBOL compiler for 25 years.

Here is a program which shows what ADIS (Accecpt/Display Interface System) see the keys as. You may need to run ADISCF to update your ADIS keystroke mappings.

Code:
       IDENTIFICATION DIVISION.
       PROGRAM-ID.     SCANADIS.
       AUTHOR.         J C FAIRFIELD.
       DATE-WRITTEN.   01/03/96
       DATE-COMPILED.
      *
      * Displays the ADIS status it gets from keystokes.
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       78  ADIS                        VALUE X'AF'.
       77  READ-CHAR-VIA-ADIS          PIC X(01) VALUE   26 COMP-X.

       01  CRT-STATUS.
           05  WS-CHAR1        PIC X.
           05  WS-CHAR2        PIC X.
           05  WS-CHAR3        PIC X.
       01  REDEFINES CRT-STATUS.
           05  WS-BYTE1        PIC X COMP-X.
           05  WS-BYTE2        PIC X COMP-X.
           05  WS-BYTE3        PIC X COMP-X.

       01  WS-HEX              PIC X(06).
       01  REDEFINES WS-HEX.
           05  WS-HEX1         PIC X COMP-X.
           05  WS-HEX2         PIC X COMP-X.
           05  WS-HEX3         PIC X COMP-X.
           05  WS-HEX4         PIC X COMP-X.
           05  WS-HEX5         PIC X COMP-X.
           05  WS-HEX6         PIC X COMP-X.

       PROCEDURE DIVISION.
           PERFORM UNTIL EXIT
               CALL ADIS USING READ-CHAR-VIA-ADIS CRT-STATUS
               DIVIDE WS-BYTE1 BY 16 GIVING WS-HEX1 REMAINDER WS-HEX2
               DIVIDE WS-BYTE2 BY 16 GIVING WS-HEX3 REMAINDER WS-HEX4
               DIVIDE WS-BYTE3 BY 16 GIVING WS-HEX5 REMAINDER WS-HEX6
               INSPECT WS-HEX CONVERTING
                   X'000102030405060708090A0B0C0D0E0F'
                   TO '0123456789ABCDEF'
               DISPLAY WS-HEX
           END-PERFORM
           STOP RUN
           .
I would use the results of these two programs to write (a) routine(s) to produce the results you want. Put the routine(s) in a copybook so you can have them in every program.
 
BTW, to get the ADIS termination key status from an accept, use the following syntax:
Code:
Environment Division.
Configuration Section.
Special-Names.
   CRT Status is CRT-STATUS.
. . .
77  CRT-STATUS  Pic X(03).
    88  F1  Value X'xxxxxx'.
    etc.
. . .
    Accept . . . from CRT.
    If F1
        . . .
    End-If
The values you get from this syntax may differ from those you get from SCANADIS in the first byte. Use the debugger to verify.
 
Yes, Microsoft had a COBOL compiler for the Apple 2e using their CPM card which I used from about 1975. Also, their version 1.0 COBOL for the PC was an implementation of the same compiler. That's the reason for some of the weird syntax such as COMP-0. We tried to convert the system to a TRS-80 model 4. We did convert it to an IBM-XT using Microsoft COBOL 1.0. We later dropped support for the Apple.

Even Micro Focus did not have a full implementation of COBOL-74 until about 1981. That was the year we were searching for a COBOL compiler for the IBM-XT. When we sent an inquiry to Micro Focus, they included as an afterthought a brocure for their "new" fully ANSI-74 compliant COBOL compiler. That was the one we bought.

The 74 standards had some quirks. One was that you could not do a NUMERIC test on a COMP-3 field. So I wondered what would happen if I tried to do arithmetic with a non-numeric COMP-3 field.
Code:
    77  A PIC X VALUE HIGH-VALUE.
    77  B REDEFINES A PIC 9 COMP-3.
    77  C PIC 99.
    . . . 
    ADD 1 TO B GIVING C
    DISPLAY C
The answer was 16!
 
FYI,
As far as "COMP-3" fields go, they have NEVER (and are still not) part of any ANSI or ISO COBOL Standard. Therefore, it was just as "undefined" to do an ADD with a COMP-3 field as it would be to do an IF NUMERIC class test.

The '85 Standard added the USAGE PACKED-DECIMAL phrase (as processor dependent) and that was NOT allowed in the IF NUMERIC class test.

The '02 Standard *does* allow for IF NUMERIC class test on numeric fields. Interestingly enough (and contrary to many/most extensions to the '85 Standard)

an IF NUMERIC on a BINARY field yields a "false" - IF the contents of the field do not match the PICTURE clause (quite commonly valid for "NOTRUNC" type extensions).

Bill Klein
 
Actually, COMP-? is permitted by the 74 and 85 standards. The 85 standard prohibits a NUMERIC test on any COMP[-?] field. Permitting a NUMERIC test on numeric fields and having it fail when the field does not match the picture makes sense. What other purpose would a NUMERIC test have on a binary field anyway?

PACKED-DECIMAL and BINARY match the spirit of COBOL much better than COMP-3, -4, etc. One early version of COBOL allowed the SIZE phrase (specifying the number of bytes)with COMP, eliminating the need for PICTURE.
 
Can you give me some reference for your statement

Actually, COMP-? is permitted by the 74 and 85 standards.

"COMP-? (or computational-?) is only "permited" to the extent that ANY extension is permitted in the Standard.

COMP-? *was* (as I recall) included in the JOD - but *never* in the ANSI/ISO Standard.

As far as the IF NUMERIC class test, it was specific about being non-numetic - but that has nothing to do with allowing

USAGE COMP-?

Bill Klein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top