MMCC's PL/B notes v1.10 |
509 Center Bay City, Michigan Sales (989) 892-9242             Support (989) 686-8860 MMCC Programming Standards
|
PL/B PROGRAM ORGANIZATION
Every MMCC program has a similar organization. Understanding this general consistency makes it easier to maintain programs that one is not familiar with or has not worked on in years.PROGRAM STRUCTURE
The standards now in use have been used since the early 1980's. Every effort has been made to insure that old programs do not break as new standards are added. That has the less desirable effect of sometimes making new programs look archaic or causing them to use an older form that could be done better with newer forms. We accept that as a necessary evil.
This article includes the following topics:
- Program structure
- Standard include modules
- Field Name conventions
- Back to Standards Index
The typical MMCC PL/B program organization is:.......................................... . program name date written . . general description of what it does . TRAPTIME EQU 0 General EQU's for special routines. OLDSTUFF EQU 0 (more described below) GHCCOMMON EQU 0 . INCLUDE Z:COMMON Standard include units INCLUDE REVISION.DBS (more described below) INCLUDE PLBEQU.INC INCLUDE PLBMETH.INC INCLUDE Z:PRINT-WK . Local "working storage" items and variables . MAIN_FORM PLFORM xxxxxx ... other plforms here . ALIO EQU 0 File equate list CFIO EQU 1 (more described below) HCIO EQU 2 XCIO EQU 3 . INCLUDE xxxxIOFD.pls File descriptions for ALL files . INCLUDE Z:DATEGREG Date routines . INCLUDE xxxxOPEN file opening routines . ....................... . Program initialization Mainline calls to processing sub-routines end of job wrapup MOVE CURRPROG, PRIORPG MOVE NEXTPROT, CURRPROG CHAIN CURRPROG . ....................... . Processing sub-routines . ....................... . INCLUDE xxxxIO.pls standard I/O routines INCLUDE Z:TRAPNEW.PLS INCLUDE Z:GO-SLOW.PLS INCLUDE xxxx other general purpose routines. . ....................... .pagehead INCLUDE Z:PRINT-DO .... program specific page headings RETURN . ....................... . print_do_trailer .... program specific page bottom if needed RETURNEach of the above items is defined below.
................................................... . FM-X1240 10/09/2003 . FORMAT 2 LISTING VIEWER . Browser Style . LOADMOD . This program does..... .
%IF OLDSTUFF > 0 old code that's left in for example %ENDIFThere are a number of standard EQU's which apprear in almost all programs. The most frequently used are listed below and then described:
INC_PLBWIN_WORK EQU 1 COLOR_PLS EQU 1 TRAPTIME EQU 0 ;throwback to old DOS "TRAPNEW" include OLDSTUFF EQU 0 ; EXAMPLE EQU 0INC_PLBWIN_WORK tells the COMMONWK routine if we need all the PLBWIN work areas. The old DOS programs don't need those and to have them in a program waste space in that old, memory sensitive environment.
%IF OLDSTUFF > 0 .... old code %ENDIF
The COMMON unit resides in the SUNDB folder and is the same for every MMCC system. This is boog, but we found we needed some way to have different common storage in certain systems. Point of Sale might need something that Dental does not.COMMONWK
The PRIVCOM inlude unit is the answer. It allows individual systems to append additional common storage items to the standard common items. All common storage must be defined at the top of the program. Having COMMON include PRIVCOM keeps all the common items together. Because it's also the first item in every program, common is preserved and protected in all programs within a system.
Besides common storage items, there are many working areas that are useful in almost all of our programs. Some things are as simple as the variable ONE which is just the number one. Others include SPACE and SPACES, and the large string TITLE_LINE.INC_PLBWIN_WORK EQU
Z:COMMONWK defines all of these commonly used data variables and constants. They are not in common storage, but are just part of the user data area of memory.
The COMMONWK unit is found in the SUNDB folder so the same common work items are available to every program and every system.
COMMONWK.PLS is a PLS unit. Both COMMON.DBS and COMMON.PLS include COMMONWK.PLS using the full name. This allows us to have a single unit which is included in all programs.
Old DOS programs do not have a large UDA (User Data Area). It was easy to run out of RAM in DOS programs. PLBWIN, on the other hand, has lots of UDA memory!Back to Standards Index
The COMMONWK unit uses a %IF compiler directive to selectively exclude variables which have evolved in the Windows era from the old DOS programs. The EQU is defined in the COMMON.DBS and COMMON.PLS units.
For normal programs it is not necessary to define the INC_PLBWIN_WORK equate since it's in the COMMON unit. "Loadmods" (separately compiled programs) are not allowed to define or acccess common storage so they do not include the COMMON unit. Therefore they must define the INC_PLBWIN_WORK explictely.
STANDARD INCLUDE MODULES
FIELD NAME CONVENTIONS
v1.10 |
Send e-mail to MMCC. |