gtpa2m0p | Application Programming |
The first application program given control by TPF is usually called the input message editor or the application message editor, but the function is normally much broader than a data edit. The task varies with the complexity of the application, the variety of messages expected, and application design. Minimally, this program module must have an awareness of all the message types expected, exception conditions that may occur, and the logic to determine the appropriate program path. A good design is to make the input editor a component of a package of programs controlling all input and output message activity. The functions of this package would include:
This design is consistent with the top-down concept of structured programming. Figure 5 shows an overview of the process flow for such a package.
Figure 5. Application Message Control Package
As previously mentioned, the nature of the input and its variations will
determine the type of edit required. Applications with limited message
types may contain the complete edit in several program segments, which then
pass control to the processing routines. When there are many message
types or format variations, a more sophisticated approach will be
necessary. For example, the text of the message may contain a specific
character at a given position, which identifies its format and content.
In this case, the editor could access a table such as Table 4, which matches action codes to editing program
routines.
Table 4. Action Code Table (Example)
Action Code | Edit Routine |
---|---|
/ | Edit routine A |
% | Edit routine B |
$ | Edit routine C |
* | Edit routine D |
1 | Edit routine E |
2 | Edit routine F |
For variations within message types, additional action codes could be used
to further define the expected format. Each message might contain, for
example, primary, secondary, or tertiary action codes. Ideally, the
action code is in the first position of message text. The edit program
segment activated for a given primary action code can then test any additional
codes by means of a subtable or whatever logic is most efficient for the
expected message mix. Ultimately, each final routine in the edit
process is aware of the appropriate program to call to continue
processing. For example: