Operating System - OpenVMS
1748250 Members
3218 Online
108760 Solutions
New Discussion юеВ

Re: VMS Problem with Cobol - ACCEPT PROTECTED interferes with DISPLAY

 
SOLVED
Go to solution
H.Becker
Honored Contributor

Re: VMS Problem with Cobol - ACCEPT PROTECTED interferes with DISPLAY

On OpenVMS/Alpha V8.3 and COBOL V2.8-1286 there are no smg$ routines in the main (cobol) image. This can be verified with a linker map file. "protected" seems to trigger a call to DCOB$SCR_ACCEPT - and I don't think this is news, as this can be seen in the linker map as well. But there are smg$routines in the DEC$COBRTL, their names can be retrieved:

 

$ pipe cob nla0:/list=sys$output |search sys$pipe "Page 1"
                                Source Listing                  26-FEB-2015 13:26:26  Compaq COBOL V2.8-1286            Page 1
$
$ search x.cob accept
    ACCEPT WS_TEXT protected.
$ cob x
$ link x
$ xpd x.exe
eXternal Procedure and Data list (Alpha), version 1.8
DEC$COBRTL:
offset 0x1e0 maps to DCOB$SIGNAL_HANDLER, type is procedure
offset 0x3b0 maps to DCOB$SCR_ACCEPT, type is procedure
offset 0x240 maps to DCOB$MAIN, type is procedure
offset 0x70 maps to DCOB$CALLED, type is procedure
offset 0x10 maps to DCOB$ACC_DISPLAY, type is procedure
offset 0xb0 maps to DCOB$$REGISTER_NAMES, type is procedure
SYS$PUBLIC_VECTORS:
offset 0x11a0 maps to SYS$NATIVE_TO_TRANSLATED, type is procedure
$
$ pipe xpd sys$share:DEC$COBRTL.exe |search sys$pipe smg
SMGSHR:
offset 0x510 maps to SMG$GET_TERM_DATA, type is procedure
offset 0x500 maps to SMG$INIT_TERM_TABLE_BY_TYPE, type is procedure
offset 0x40 maps to SMG$SET_KEYPAD_MODE, type is procedure
offset 0x550 maps to SMG$READ_KEYSTROKE, type is procedure
offset 0x0 maps to SMG$CREATE_VIRTUAL_KEYBOARD, type is procedure
$

 

John Gillings
Honored Contributor

Re: VMS Problem with Cobol - ACCEPT PROTECTED interferes with DISPLAY

David,

   Here's an example. There are 3 reads so you can test line recall and editing. Note that READ_COMPOSED can also prompt. See documentation.

 

IDENTIFICATION DIVISION.
PROGRAM-ID. DBN1_COB.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS_TEXT PIC X(30).
01 WS_KBD PIC 99999 COMP.
**************************************************.****************
PROCEDURE DIVISION.
**************************************************.****************
MAIN SECTION.
MAIN10-START.



    CALL 'SMG$CREATE_VIRTUAL_KEYBOARD' USING BY REFERENCE WS_KBD.
    DISPLAY "Hello 1".
    CALL 'SMG$READ_COMPOSED_LINE' USING BY REFERENCE WS_KBD, OMITTED, BY DESCRIPTOR WS_TEXT.
    DISPLAY "Hello 2",WS_TEXT.
    CALL 'SMG$READ_COMPOSED_LINE' USING BY REFERENCE WS_KBD, OMITTED, BY DESCRIPTOR WS_TEXT.
    DISPLAY "Hello 3",WS_TEXT.
    CALL 'SMG$READ_COMPOSED_LINE' USING BY REFERENCE WS_KBD, OMITTED, BY DESCRIPTOR WS_TEXT.



MAIN99-EXIT.
    STOP RUN.

 You need to be a bit careful, as SMG has dependencies. If there will be any SMG output, the SMG$CREATE_PASTEBOARD call needs to preceed  SMG$CREATE_VIRTUAL_KEYBOARD.

A crucible of informative mistakes
davidbn123
Occasional Advisor
Solution

Re: VMS Problem with Cobol - ACCEPT PROTECTED interferes with DISPLAY

Thanks again - I will take a look at the SMG documentation then and see whether I can replace the Accepts with SMG calls