MMCC MASTHEAD




MMCC's PL/B notes
  •    Notes home
  •    Intro
  •    History
  •    Article index
  •    MMCC Standards

    v1.10
  • Mid-Michigan Computer Consultants, Inc.
    509 Center
    Bay City, Michigan

    Sales (989) 892-9242             Support (989) 686-8860


    ANSI Standard PL/B Language
    MMCC Programming Standards
    NOTE TO OUR READERS
    This web resource is written for our own use. But we feel strongly that the PL/B language should be shared with the software community. So feel free to use this at will! BUT PLEASE... if you find errors or omissions or have a better way to do something. TELL US! Dialog helps us all. Send e-mail to: support@mmcctech.com


    STANDARDS
    Every programming organization should have standards. Some of these will be industry wide, others will relate only to the organization.

    MMCC personnell have been programming PL/B (formerly Databus) for 30 years. Over that period we have developed a number of internal standards which have served us well.

    If we were to start over, some of these procedures and standards would be changed. But they've been in place for many years and have served us well. The standards are enhanced over time, but old code is never broken.

    This document is intended to describe the standards for our own staff, but others viewing this page may find the information useful.

    SOURCE FILE FOLDER ORGANIZATION

    Back to Standards Index

    BACKUP PROCEDURES
    Backups are normally written to CD. By organizing systems under the MMCC-WIN folder, that entire folder can be written to a CD and get all of our systems.

    The CD backups are essentially COPIES of the files. There is no compression or anything. And we use CD's rather than DVD's so that the backups are available on just about any computer.

    NOTE: When you just drag a CD folder onto your desktop, the files are considered to be READ-ONLY on the CD. That attribute usually comes across during the drag and drop. You should explore to the folder, select ALL, look at properties, and turn off the "read-only" check box. If you don't you won't be able to run the programs.

    There are several backup sets CD's. The WIN (source code) backup contains the most volitile stuff and is done very frequently. The other sets are various data files, test data, client data. They are done less frequently.

    The contents of each backup sets is listed in SGK's continuing TIME log files. Since those files go back a long way, there are many copies of these lists. A printed copy is in the white book on SGK's desk at home. Basically the organization is:
    • WIN:
      • MMCC-DA5: Time and PT system
      • MMCC-WIN: Source code for all systems
      • MMCCMENU: Bat files and shortcuts that typically appear on WIN desktop
      • MyDocuments: Main folder for all EXCEL, Publisher and Word Processing files.
    • DA2:
      • MMCC-DA2: Less frequently used customer data folders and time archive folders.
    • DAT:
      • MMCC-DAT: Actively used data folders including
        • ADDRLIST
        • YMCA
        • SHOP-SYS (including Homespun Peddler)
        • TIMEDATA (various old time files) PTSYSTEM (just an old copy of Emily's data)
    • DA3:
      • MMCC-DA3: Bargain times folder including all photos and data.
        This is backed up twice each time a book is run. One copy is sent back to Doug at Bargain Times, the other copy goes in the CD file cabinet in the home office. Sometimes a copy is taken to the office.
    • DA4:
      • MMCC-DA4: Other less frequently used client systems including Car Wash Village and Toughman.
        Toughman is not current. I've asked the gals down in Arkansas to regularly run a backup to our file manager. I then pull that ZIP and keep it on my system.
    • DA6:
      • MMCC-DA6: Other less frequently used client systems:
        • PMSYS: some of the dental clients (there are only 3 left)
        • PJ: Diesel Fuel Injection's data
    • FULL DOS: This was the entire DOS machine before it died. There is one main backup remaining in SGK's bag plus a batch of old ones. Most of those systems are dead, or they have been moved to Windows. We keep this CD around just in case!
    • FULL WWW:
      • MMCC-WWW: All of the web sites that SGK maintains. This is the master copy. Because they're also on the web servers, that could be considered a backup as well.
    • NETSCAPE:
      • From the Old Gateway. That's the last thing running on that server.
        THe only thing I'd want is the e-mail folders.
        I have NOT backed it up in a long time because Norton Antivirus balked the last time I tried to bring it over the network. I think that there was a virus in the TRASH folder.
        I should REALLY try it again some time!
    • RABC: This is the entire real estate book system. It's backed up each time a book is printed. The copies go in the CD cabinet in the home office. Some are taken to the office.
      • MLS-BOOK: the last real estate book.
      • RABCyyyy: yearly picture folders
      • RABCMAPS: map pictures
      • RABC-PEOPLE: realtor pictures
    Backups are done almost daily. Sometimes multiple backups are made in the same day. (Burning a CD is fast).

    The MASTER SYSTEM resides on the support office Compaq. Two duplicate development machines are at the main office. One is the File Manager, the other is in the northeast corner of the MMCC room. Another dupliccate is kept on the support department's laptop. These dupliccate machines are updated on a sporadic basis (primarily when some work must be done at the office). When updated, the entire folder for a system is copied from CD to the target machine overwriting everything in that folder.

    Backup CD's are kept in multiple locations. The most current backup is kept with the supervisor in his kit. The second level backup is at the support office. The third level backup is at the main office in two of the desks in the MMCC room. Backups are rotated to the main office at least weekly, if not more frequently.

    Note that the backups at the office are semi-organized. Each time a backup set is taken up there, all of the CD's are just put into the plastic CD container that has the most recent backups. Backups for everything go in these containers. If you need them, pay attention to the dates written on the CD's.

    Because everything is burned to a write once CD, the copies at the office provide a snapshot in time. You can go back many generations if necessary to get an older version of a program!


    Back to
    Standards Index

    WORKFLOW and INFRASTRUCTURE
    Most development work is done at the support office. The working environment is based on two Windows 98 computers networked together:
    • Computer 1 is the master containing all source code, test data, and support programs.
    • Computer 2 is simply used for editing. For many years it was an old DOS machine.

    Using two computers means that the program source code can be open at all times on the second computer while compiles and testing are being done on computer 1. It's a real luxury to be able to look at the source at the same time as running the test without needing to click from window to window.

    Of course multiple windows on one machine will work. That's the way the duplicate development systems work.

    During development, computer 1 typically has several windows open:
    • A command prompt (DOS) window is open for running the compiles using the ACB.BAT procedure. We'll usually enter the command ACB SHOP2010 to run the compile. After the compile completes, you can tap F3 to repeat the command.
    • The PL/B Designer is often running in another window. This allows us to modify the PLForms easily while testing.
    • The application is usually running in another window. We'll be testing and looking at the running program on one monitor and working through the code on the second machine's monitor.
    Computer 2 almost never has more than one window open. And that window is a command prompt (DOS) window in which we run the ancient TED text editor for program editing.

    YES WE KNOW... we're way out of date. The Visual PL/B IDE development environment is fantastic and we should probably be using it. But we've been doing it this way for 30 years and it works well for us!


    Back to
    Standards Index

    COMPILE PROCEDURES
    Each system folder contains an ACB.BAT batch file. (The meaning of "ACB" has been lost over time. It's not significant other than being the standard name).

    Each system may have an ACB-ALL.BAT as well. If it exists it will be a list of CALLs to the standard ACB procedure, one call for each program. You can run this procedure to compile everything.

    Note that the ACB-ALL.bat procedure SETs an environment variable called ACSTOP=P. See the note below in the ACB.BAT procedure about the PRT-AC program.

    An example of the Standard ACB.BAT file is shown below and described after the example:

    
    @ECHO OFF
    echo ------------------------------------------------------------------
    echo            PL/B WIN Compile Procedure             
    echo ------------------------------------------------------------------
    
    REVDATE
    map z: /d
    subst z: c:\mmcc-win\sundb
    
    @ECHO on
    \SUNBELT\PLBWIN.87\CODE\PLBCON \SUNBELT\PLBWIN.87\CODE\plbcmp %1 %2 %3 %4 -ZG
    @ECHO off
    
    @IF ERRORLEVEL=4 goto BADRUN
    
    REVDATE
    IF "%ACSTOP%"=="P" PRT-AC %1.PLC was OK
    GOTO EXITIT
    
    :BADRUN
    IF "%ACSTOP%"=="S" PAUSE
    IF "%ACSTOP%"=="P" PRT-AC %1.PLC compile error
    
    :EXITIT
    REM get rid of subst to avoid potential conflict with MAP
    subst z: /d
    


    The procedure starts with an ECHO signon.

    REVDATE: This is a DOS style PL/B program. The bat file is run from a command prompt (DOS) window. It assumes that SUNDBSYS has been loaded and is running in that DOS session window. We start SUNDBSYS when the window is opened and then forget it.

    Revdate is a tiny program that does a couple of things. First it writes three small code files which can be used as includes in all of our PL/B programs. Secondly, it looks at the previous value of the files and computes the elapsed time. We run a REVDATE before the compile and another one after.

    The three files written by REVDATE are:
  • REVISION.DBS
  • REVISION.PLS
  • REVDATE.COP (left over from our COBOL days)

    The PL/B REVISION files contain two variables:
    REV      INIT     "0.0"
    REVDATE  INIT     "10/12/2005 12:24:08"
             TITLE    "10/12/2005 12:24:08"
    
    This whole thing goes back to the days before we could get the compile date and time from as part of the language. We needed some way to know when the program was compiled. Every program displays this value in the title bar so we can always know exactly when the program was last changed.

    map z: /d
    subst z: c:\mmcc-win\sundb


    The map z: /d is a hold over from when the SUNDB folder ran on the DOS machine and we used a 3rd party network to connect the machines. (In fact, we STILL use that network on some systems.) The MAP is just to get rid of the z: in case it's still mapped.

    The SUBST Z: C:\mmcc-win\sundb is the new technique in use since putting everything on the same computer. This allows our source to remain unchanged using the Z: to get include units.

    @ECHO on
    \SUNBELT\PLBWIN.87\CODE\PLBCON \SUNBELT\PLBWIN.87\CODE\plbcmp %1 %2 %3 %4 -ZG
    @ECHO off


    We turn on the echo just to be able to see the command for the compiler. The compile is run under PLBCON which allows us to run from the command prompt (DOS) window. We give the full path to both PLBCON and to PLBCMP.

    The %1 %2 %3 %4 are for parameters on the command line. On the command ACB SHOP1020 the SHOP1020 takes the %1 position and names the program. We can add additional compiler commands after that if we wish.

    The -ZG parameter tells the compiler to "Allow GUI statements". That may well be a default by now. We've used it since the beginning.

    @IF ERRORLEVEL=4 goto BADRUN

    The compiler sets ERRORLEVEL 4 if the compile fails. The IF statement jumps to the BADRUN label if the compile fails.

    If it's been a while since you read a .BAT file, the @ at the beginning of the line turns off the ECHO for the line regardless of the default value for ECHO.

    REVDATE
    IF "%ACSTOP%"=="P" PRT-AC %1.PLC was OK
    GOTO EXITIT


    When the compile is successful we fall into the statements above. We do a final REVDATE which also computes and displays the elapsed time for the compile. (The compiler tells us that now, but in the early days it did not and we wanted to know how long the compile takes.

    The IF statement checks to see if the environment variable ACSTOP is set to the value P. If it is then we want to print a line to LPT1 saying that the compile was successful. The PRT-AC program is one of the old DOS PL/B programs running under SUNDBSYS.

    After checking the print request, we jump to the EXITIT tag to wrap up.

    :BADRUN
    IF "%ACSTOP%"=="S" PAUSE
    IF "%ACSTOP%"=="P" PRT-AC %1.PLC compile error


    If the compile failed, control would have jumpped to the :BADRUN tag. We check the ACSTOP environment variable again. If it's set then we pause the batch job. The user can do a CTRL-C to kill the batch run or tap enter to continue. If he continues then we check the ACSTOP again and print the compile error line to LPT1 if it's set.

    :EXITIT
    REM get rid of subst to avoid potential conflict with MAP
    subst z: /d


    The :EXITIT tag is the common wrap up. We clear the SUBST to drive Z: using the /d parameter. This prevents it from conflicting with other batch files we might run. It also insures that the SUBST is not left over for other DOS windows.


  • Back to
    Standards Index

    DESKTOP SHORTCUTS
    We keep a number of short cuts on the desktop for the development machines. Typically we'll browse to the program in question and right drag a program name to the desktop. When we drop it we choose the "create shortcut" menu option. Then we can modify the properties as approiriate.

    Typical shortcuts include:
    • PLB Designer for working on forms
    • PLB Help shortcuts for both the compiler and the run time.
    • DOS window. (We find the one in START or START/ACCESSORIES and right drag it to the desktop and make a copy. We then change the START IN property to start at the C:\ root.)
    • System run short cuts for various user level systems. These are described next:
    For testing and for running on client machines we create PLBWIN runtime shortcuts as follows.
    • First we browse to the SUNBELT\PLBWIN.nn and find the PLBWIN application. We right drag that to the desktop and choose create shortcut. That gives us a base shortcut to the PLBWIN runtime.

    • With the shortcut on the desktop we modify the properties as follows by "TARGET" to specify the INI file to be used and by changing the "START IN" to the user's data folder. The properties would end up something like:
          Target:   C:\Sunbelt\plbwin.87\code\PLBWIN.EXE -i plb-sgk.ini answer
          Start In: C:\mmcc-win\shop-sys\peddler
      
      On a user's system everything is stored in a single folder at the root. Each port would have it's own INI file with a unique port number (see the next section). The shortcut in this case would be:
          Target:   PLBWIN.EXE -i plb-sgk-nn.ini answer
          Start In: C:\mmcc-win\shop-sys\peddler
      
    The "-i plb-sgk.ini", or "-i plb-sgk-nn.ini", on the target line points to the PLB INI file to be used for this shortcut. A typical INI file would be something like the following example. Note that the "SHOP_xxx" lines in this INI are unique to a given system. Each of our software systems uses these parameters to set some basic contidions.

    The most important system specific INI parameter is the xxxx_PORT line. This identifies the port number being used. In a multi-user system, each port would have it's own desktop shortcut which would point to a unique INI file. Each of those files would identify a different port number. We use this port numbering scheme within our programs. (And, sorry, the highest port number is 99.)
    [environment]
    PLB_TERM=ansi
    PLB_SYSTEM=c:\SUNBELT\PLBWIN.87\CODE
    PLB_PATH=c:\MMCC-win\SHOP-SYS;C:\MMCC-WIN\UTIL-PLB
    PLBWIN_ICON=HOMESPNw.ICO
    [SHOP-SYS]
    SHOP_SYS=HSP
    SHOP_PORT=01
    SHOP_PORTNAME=Stephen's W/98 machine
    SHOP_SUPERVISOR=Y
    SHOP_HISTPATH=[
    SHOP_HISTDRIVE=[
    SHOP_PICPATH=[
    SHOP_PICDRIVE=[
    SHOP_FILEPATH=[
    SHOP_DIAG=N
    


    Back to
    Standards Index

    PROGRAM and FILE NAMING CONVENTIONS
    Almost all program and file names use the 8.3 naming convention from the DOS days. We've stuck with that because it works for us and is just about universial. As we move farther and farther away from the DOS days, some data file names are now longer.

    PROGRAM NAMES started with a very formal organization. The first 4 bytes identified the system, version and type of module. The last four bytes was the serial number and was organized in a somewhat functional way:
    • The first 2 bytes were the system like PD for dental, PJ for the diesel, FR for Freddy.
    • The 3rd byte was to be the version (0, 1, 2, etc.). That was never really implemented.
    • The 4th byte indicated the type of module being named: P was a program, I was an include unit, etc.
    • The last 4 bytes were the program number and they were roughly organized into functions. The 1000 series was maintenance, 2000's were reports, 4000's were daily procedures, etc.
    As we moved into the Windows world that formality has not been followed with new systems. Now the first few bytes define the system, but we don't worry about a version. Examples include "SHOP" for the point of sale system, "ODA-" for the resort management system, etc.

    We have continued to maintain the program number and functional series idea. But even that has eroded. In the DOS world it was very useful based on the way we did menus. The program number closely paralleled the menu from which the program was called.

    In the windows world menus are graphical and we have tooltips which allow us to identify the program name. We're much less rigid now.

    One thing that we do use is an "X" in a program name or number to designate a "loadmod". For example, ODAX20AR is a load mod in the ODA system.

    FILE NAME conventions have and continue to be well defined and closely followed. The name is made up of a three byte "CLIENT ID" followed by a 2 byte file type and a 3 character file ID.

    The file ID identifies the primary file in the first 2 bytes and secondary indexes in the third byte. When talking about a file we'll typically just call it by these letters: the FM file, the FMA file, the PM file, etc.

    For example, take the dental system:
    • xxx Client ID such as JAD, CEB, RWH.
    • D0 Dental data, version 0
    • xxx specific file:
          FM0 Family master
          FMA Family Master, alpha index
          PM0 Patient master
          DC0 Detail charges
    In more recent, Windows, systems the last 5 digits are not as tightly controlled, but they are consistent within any given system.

    The CLIENT ID concept is significant. Every CLIENT is assigned a unique 3 byte ID. All of their data files start with those 3 bytes. This allows us to put multiple client data sets in the same folder and still segregate them.

    When we execute the first program in a given system, the first thing it asks for is a System ID. That is the 3 byte Client ID. The program confirms that those files exist then stores the 3 byte ID in common. All programs then build file names using that common value for opening files.

    In many cases we'll put two data sets on a client's computer. One is named with the client's ID, the other is named TST for testing. For client "BAR", we can copy "BAR*.txt" to TST*.txt, index the TST files, and we have a testing data set. The client can execute the software and log on to either his live data or the TST data.

    Refer to the indexing program in the
    standard programs section for notes on how to index those files.

    The old DOS programs gave the user the ability to set some standard screen colors. It was common practice to set the screen background color to something awful for the test system. This insureed that everyone knew just by looking if they were in the test data set.

    The Windows systems have limited color controls for the user to set. We do, in some cases, identify the TST data set in the menu and set the background color to a nasty red.


    Back to Standards Index
    CONTENTS

    v1.10
    Send e-mail to MMCC.

    Write to MMCC Technical Support at:
    MMCC, Inc.
    600 W. Midland
    Bay City, MI 48708
    (989) 686-8860
    | Home   |

    © 2003 MMCC, Inc. All Rights Reserved.

    Report problems or suggestions to support@mmcctech.com
    Started 06/20/2003