home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / TXCHEK.ZIP / PROFCHEK.CBL next >
Text File  |  1990-07-06  |  5KB  |  121 lines

  1.       $SET ANS85
  2.       ******************************************************************
  3.       *                                                                *
  4.       *     PROFCHEK - use EHHLAPI to examine OS/2 EE Comms Manager    *
  5.       *     Presentation Space before invoking SEND (which can hang    *
  6.       *     if IND$FILE cannot be executed at the host).               *
  7.       *                                                                *
  8.       *     Compile this with Micro Focus COBOL/2 v1.2 or above        *
  9.       *                                                                *
  10.       ******************************************************************
  11.       *                                                                *
  12.       *     return-code = 0 means at profs main menu (or interrupt)    *
  13.       *                  10 means other mainframe menu                 *
  14.       *                  20 means HLLAPI not working                   *
  15.       *                                                                *
  16.       ******************************************************************
  17.       *                                                                *
  18.       *     use this program in a batch file thus:                     *
  19.       *                                                                *
  20.       *         @profchek                                              *
  21.       *         @if errorlevel 10 goto donothing                       *
  22.       *         send  %1.%2 %1 %2 (ascii crlf lrecl 80                 *
  23.       *         :donothing                                             *
  24.       *                                                                *
  25.       ******************************************************************
  26.       *                                                                *
  27.       *     use the following as a DEF file when linking:              *
  28.       *                                                                *
  29.       *         NAME    profchek      NOTWINDOWCOMPAT                  *
  30.       *         PROTMODE                                               *
  31.       *         STACKSIZE   16384                                      *
  32.       *         IMPORTS                                                *
  33.       *             ACS3EHAP.HLLAPI                                    *
  34.       *                                                                *
  35.       ******************************************************************
  36.  
  37.  
  38.        program-id.  progchek.
  39.  
  40.        special-names.
  41.            call-convention 3 is os2api.
  42.  
  43.        working-storage section.
  44.        01 h-fun             pic xx   comp-5.
  45.        01 h-len             pic xx   comp-5.
  46.        01 h-rc              pic xx   comp-5.
  47.        01 h-dat             pic x(1920).
  48.  
  49.        78 flag-true         value 1.
  50.        78 flag-false        value 0.
  51.        01 main-menu-flag    pic 9.
  52.        88 main-menu         value flag-true.
  53.  
  54.        procedure division.
  55.            move flag-false to main-menu-flag
  56.            move zero to h-rc.
  57.  
  58.       *
  59.       * Connect to Presentation Space "A"
  60.       *
  61.            move 1   to h-fun
  62.                        h-len
  63.            move "A" to h-dat
  64.            perform call-hll-api
  65.       *
  66.       * Copy Presentation Space to string
  67.       *
  68.            move 5     to h-fun
  69.            move 1920  to h-len
  70.            move space to h-dat
  71.            perform call-hll-api
  72.       *
  73.       * Check for main menu label
  74.       *
  75.            if (h-dat (78:3) = "A00"
  76.              or h-dat (78:3) = "S00")
  77.                move flag-true to main-menu-flag
  78.            else
  79.                perform make-beep
  80.                display "profs menu: " h-dat (78:3)
  81.            end-if
  82.       *
  83.       * Disconnect Presentation Space
  84.       *
  85.            move 2     to h-fun
  86.            move zero  to h-len
  87.            perform call-hll-api
  88.       *
  89.       * Return the result
  90.       *
  91.            if main-menu
  92.                move 0 to return-code
  93.            else
  94.                move 10 to return-code
  95.            end-if
  96.            stop run.
  97.  
  98.  
  99.       *****************************************************************
  100.       *
  101.       *     SUBROUTINES
  102.       *
  103.       *****************************************************************
  104.  
  105.        call-hll-api.
  106.            call os2api "__hllapi" using by reference h-fun
  107.                                         by reference h-dat
  108.                                         by reference h-len
  109.                                         by reference h-rc
  110.            if h-rc not = zero
  111.                display "hllapi return code bad: " h-rc
  112.                move 20 to return-code
  113.                stop run
  114.            end-if
  115.            exit.
  116.  
  117.        make-beep.
  118.            call os2api "__dosbeep"  using by value 1046 size 2
  119.                                           by value 200 size 2
  120.            exit.
  121.