PROGRAM statement

Rewritten August 2015

PROGRAM progname, vmajor.vminor {vsub} (vedit) {,flag}

The optional PROGRAM statement embeds a header in the compiled object code (RUN, LIT, SBX) containing the specified version and flag. The version information may be retrieved both within the running program and from external program files, and is obviously very useful in keeping track of which versions of each module that you have installed or running.

Parameters

progname

name of the program (1-10 RAD50-compatible characters). Note that it doesn't actually get embedded in the compiled code though, so it mainly servers as a source code documentation.

vmajor

major version (0-255).

vminor

minor version (0-15).

vsub

sub-version (A-O).

vedit

edit number (0-4095).

flag

optional flag, default is -1. The only allowed value other than -1 is -2, which causes the program to be allowed to run even if the job is not currently logged in. This is necessary for LOG.LIT, and is otherwise convenient for command programs which may be specified directly on the ashell startup command line. Note however that such a program should then use XCALL LOG or some equivalent mechanism to establish a current directory before accessing files.

Examples:

program MYPROG,1.0(100)

PROGRAM anotherprg,234.15B(4001),-2

 

Comments:

Given the fairly large range of vedit values (0-4095), it's a useful convenience to treat it as unique identifier for source code changes, leaving the vmajor, vminor and vsub values to be used for higher level purposes (marketing, general releases, etc.) Both of the program editors VUE and APN have macro functions to help streamline the process of associating changes in the edit number with source code comments which programmers should take advantage of. For VUE, the command is Control+_ E, which increments the vedit number in the program statement, if found, or in a comment consisting of ";VEDIT=###", and inserts an edit history node. For APN, you can define your own macro via the Text Clip system. The standard release comes with two related macros, "prog" for creating a skeleton program header and "eh" for entering a new edit history item.

See Also:

•   DIR.LIT: /V switch to display program file versions

•   GETVER.SBR:  get version of current running program

•   SOSLIB:[907,10]:Fn'FileVer get version from file

•   VERSYS.LIT: additional version info