Created On:  10 January 2013

Problem:

Customer was converting an application from Net Express to Visual COBOL. The application was using Dialog System and the extension called DSHTML which allows you to display Windows Help files in the .CHM format from within Dialog System screens.

Customer installed the Visual COBOL Compatibility Addpack to provide support for Dialog System in Visual COBOL but the DSHTML support was not available. How can an application using Dialog System and DSHTML callouts be run in Visual COBOL?

Resolution:

The Dialog System extension DSHTML was made available in a file named DSHTML.CBL which exists in the Net Express\base\Examples\DialogSystem\HTMLHELP folder.

If you wish to run your Visual COBOL Dialog System applications that use DSHTML then you must copy the DSHTML.CBLfile from Net Express and compile it as a .DLL in Visual COBOL and make it available to your application.

A demo program has been attached to this article which uses DSHTML in Visual COBOL.

Example:
*----------------------------------------------------------------
*                              HTMLDEMO
*
* This example demonstrates how to use context sensitive help in
* a Dialog System application. This program was converted from
* Net Express where it resided in the examples folder HTMLHELP.
*
* This example uses the Dialog System extension DSHTML which is
* available in Net Express and is now available in Visual COBOL.
* In order to run the demo or to use Windows .CHM files in your
* application you need to compile the DSHTML.CBL file from Net
* Express into DSHTML.DLL and make it available to your Visual
* COBOL application. I have included it here as part of the demo
* in project DSHTML. This .dll must also be linked to the file
* htmlhelp.lib which is delivered with the Microsoft Help Tool-
* kit. I have included this file in the folder c:\htmldemo\dshtml
* for convenience. 
*
* To use Dialog System with Visual COBOL you also need to install
* the Visual COBOL Compatibility Addpack which is available for
* download on the Product Updates page of the Supportline web
* site.
*----------------------------------------------------------------
 id division.
 program-id. htmldemo.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 78 dialog-system VALUE "DSGRUN".
 01 Display-Error.
    03 Display-Error-No PIC 9(4) comp-5.
    03 Display-Details-1 PIC 9(4) comp-5.
    03 Display-Details-2 PIC 9(4) comp-5.
 01 ProcPtr Procedure-pointer.
 COPY "DS-CNTRL.MF".
 COPY "htmldemo.CPB".
 PROCEDURE DIVISION.
*---------------------------------------------------------------*
 Main-Process SECTION.
    PERFORM Program-Initialize
    PERFORM Program-Body UNTIL EXIT-FLAG-TRUE
    PERFORM Program-Terminate
    .
*---------------------------------------------------------------*
 Program-Initialize SECTION.
    INITIALIZE Ds-Control-Block
    INITIALIZE Data-block
    MOVE Data-block-version-no
       TO Ds-Data-Block-Version-No
    MOVE Version-no TO Ds-Version-No
    MOVE Ds-New-Set TO Ds-Control
    MOVE "htmldemo" TO Ds-Set-Name
* help file name must be null terminated
    String "htmldemo.chm"
      x"00"
      into DSONLINE-HELP-FILE
    End-String
    .
*---------------------------------------------------------------*
 Program-Body SECTION.
    PERFORM Call-Dialog-System
    .
*---------------------------------------------------------------*
 Program-Terminate SECTION.
    MOVE DS-QUIT-SET TO DS-CONTROL
    PERFORM Call-Dialog-System
    STOP RUN
    .
*---------------------------------------------------------------*
 Call-Dialog-System SECTION.
    CALL dialog-system USING Ds-Control-Block,
      Data-Block
    IF NOT Ds-No-Error
       MOVE Ds-System-Error TO Display-error
       DISPLAY "DS ERROR NO: " Display-error-no
       DISPLAY "Error Details(1) : " Display-Details-1
       DISPLAY "Error Details(2) : " Display-Details-2
       PERFORM Program-Terminate
    END-IF
    .