Language Considerations

Presentation Manager applications may be written using the following programming languages:

  • Assembler language
  • C"
  • COBOL (OS/2 Version 1.2 and above)
  • FORTRAN (OS/2 Version 1.2 and above)

    The use of Assembler language should be avoided wherever possible. While coding to such a low-level language may provide significant performance improvements in critical applications, it is typically more costly in terms of programmer productivity and subsequent code maintenance. Assembler code is also less portable than that written using higher-level languages.

    The requirements of the Presentation Manager execution environment restrict the use of the COBOL and FORTRAN languages. Presentation Manager requires window procedures to be reentrant, and neither FORTRAN nor COBOL support the creation of reentrant code. In addition, much of the default message processing provided by Presentation Manager results in synchronous messages being sent to window procedures. This practice is effectively a recursive subroutine call, and requires window procedures to be written in a language that supports recursion. Neither COBOL nor FORTRAN provide such support.

    In order to create COBOL or FORTRAN source code that executes in the Presentation Manager environment, the application developer must adopt one of two solutions:

  • Create a "C" program to provide the Presentation Manager windowing and dialog management functions, and combine this program with called COBOL or FORTRAN subprograms to perform the actual processing for the application.

  • Create a "winproc-less" application, where a main routine written in COBOL or FORTRAN creates a message-processing loop, captures and explicitly processes all message classes. Such an application has no window procedures.

  • Use the "language support window procedure" provided with the OS/2 Programmer's Toolkit under OS/2 Version 1.3, which provides processing for most message classes and returns selected messages to the application for processing.

    Where the use of COBOL or FORTRAN is unavoidable, solution (1) above is recommended, since it provides additional flexibility, maintains SAA conformance, retains much of the object-oriented nature of the application, and allows the best use to be made of existing host COBOL or FORTRAN application code, since the subprograms used are invoked using standard language conventions, and data is passed to them using a normal parameter list and returned the same way. The subprograms therefore interact with the calling application in much the same way as an ISPF dialog, minimizing the requirement for modification of existing code and reducing the need to retrain application developers.

    Object-oriented programming languages such as Smalltalk and C++ are becoming increasingly popular for the creation of object-oriented code, and are well-suited to the Presentation Manager application model. Organizations may wish to investigate the viability of these languages for particular development projects and environments.


    [Back: Building a Presentation Manager Application]
    [Next: Function and Data Types]