A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Under construction. Note: this data is several years old and probably needs updating.
| Item | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| A | ||||||||||
| Admit | See backtracking | |||||||||
| Allocate Operations | Allocation operations is the second part of the operations step in the Basic Design Structure. It involves taking each operation in the list and allocating it to a program component. | |||||||||
| Assumptions |
| |||||||||
| Back to top | ||||||||||
| B | ||||||||||
| Backtracking | This technique is used to handle those recognition difficulties where the program cannot determine, even by looking several records ahead, which data structure component to use next. It makes a choice based on an assumption, and if the assumption proves wrong, the program doubles back on its tracking. Method
Backtracking is used both for selection or iteration (sometimes assumes that another execution of the loop is required). Which path?
See example (5). | |||||||||
| Basic Design Procedure | Steps
| |||||||||
| Benefits |
| |||||||||
| Body Box | A body box is an additional box introduced to preserve the formal correctness of the program structure. For example, the following is illegal:
as the component Prog consists of a mixture of sequenced parts. The solution is:
| |||||||||
| Books | B.J.Holmes "Structured Programming in COBOL" 2nd Edition. DP Publications Ltd. ISBN 1-870941-82-9. | |||||||||
| Boundary Clash | A boundary clash is one particular type of structure clash. In a boundary clash, components at a higher level of two data structures correspond and also components at a lower level, but there are components at an intermediate level which do not correspond. The intermediate components define boundaries in the two data structures and these boundaries cannot be synchronised. For example, supposed you wanted to convert a file comprising one record for each month, each containing spaces for figures for 31 days, to a file containing weekly records, each with space for 7 days' figures.
What about the record level for read operations and write operations?
Solurion: an intermediate file:
No serious design work can begin on the individual programs ina a boundary clash situation until the intermediate file is completely specified. Inversion may be used to eliminate the intermediate file. | |||||||||
| Back to top | ||||||||||
| C | ||||||||||
| Checking | Checking data structures - see defining structures. | |||||||||
| Collating |
Standard collating solution:
Conclusion By using JSP collate solution any number of files can easily be considered. | |||||||||
| Component | A component is part of a tree structure, either a data structure or a program structure. There are sequence, selection, iteration and elementary components (leaves) (including body boxes). | |||||||||
| Conditions | Conditions are added to the structure text in the text step. A condition is required for each iteration and for each part of a selection. The condition determines whether the program should execute the iterated part again, or shich of the selected parts it should choose. The possibility of writing conditions on iterations is intuitively connected with the read-ahead rule. | |||||||||
| Constructs | Basic construct summary:
| |||||||||
| Conversational constraint | If F is an input and G is an output of P, then F and G satisfy the conversational constraint in P if on every execution of P the reads on F strictly alternate with the writes on G. The conversational constraint means that the reads must alternate with the writes on another data stream. This constraint is normally imposed by the problem, not by the implementation environment. This constraint means that we can never use the multiple read ahead rule and sometimes not even the single read ahead rule. A read can never be shifted beyond the write on the other data streams. The following rule puts the reads as far forward as possible, given the constraint. "In the body of the program allocate a read immediately after the write on the other stream. At the beginning and end of the program allocate reads according to whether this program begins or ends the conversation." (If the program starts by reading, then there will be an initial read at the beginning of the program; if the program ends by writing, there will be no read besife the final write.) Modified conversational constraint Other constraints | |||||||||
| Correctness |
| |||||||||
| Correspondences | Two components (from different data structures) correspond if there is some functional relationship between the components which means that the instances of the components in the two structures will always occur the same number of times and in the same order. If no component corresponds, there may have been an error at the data step (see defining structures). | |||||||||
| Back to top | ||||||||||
| D | ||||||||||
| Data Step | The data step is the first step in the Basic Design Structure. In the data step the designer draws a tree structure diagram for each data stream of the program. If the data step has not been correctly carried out, there may be no correspondence (see defining structures). |
|||||||||
| Data Stream | A data stream is a serial set of records input to, or output from, a program. A data stream may be implemented by a physical serial device, such as a magnetic tape drive. It may also be implemented by a direct access device, such as a disk drive, from which records are read serially. A data stream may also be a set of records or segments in a database, or a set of messages input at, or displayed on, an on-line terminal. | |||||||||
| Data Structure | A data structure is a hierarchical tree structure describing a data stream. It is defined by a tree structure diagram.
It is often convenient not to produce data structures for directly accessed files. The data structure for a file depends on the function of the program that processes the file. | |||||||||
| Defining structures | When we draw a structure diagram for a file, we are defining how we want to regard that file. For different purposes we may wish to define different data structures for the same file. Suppose, for example, that we have a file of transaction records, sorted into groups, each group having a header record. Then, for purposes of analysing or summarising the transaction groups we will wish to impose the structure:
but for purposes of simply copying the file from input to output we will wish to impose the structure:
The choice of structure, then, depends on the purposes for which we define it. If in error we define a structure which is not fit for its purpose, our error will be revealed either at the program step or at the operations step; this is one reason why we must carry out all of the steps of the design procedure carefully and conscientiously. | |||||||||
| Dismemberment | Dismemberment is a technique for breaking up a program which has been inverted to run under a TP monitor into separate modules. ADismemberment is used when the inverted program is too large for acceptable efficency. | |||||||||
| Back to top | ||||||||||
| E | ||||||||||
| Elementary Component | An Elementary Component is a component of a data or program structure which is considered to be indivisible. An Elementary Component therefore has no parts, and no lower-level structure. Also called leaf. | |||||||||
| Equivalent Main Program | An Equivalent Main Program for a subroutine is a main program which can be inverted with respect to one or more of its data streams to give the subroutine. If an original specification asks you to design a subroutine, you will usually do so by designing the Equivalent Main Program and then inverting it to give the specified subroutine. | |||||||||
| Errors | Errors in the structure definition will be realised either at the program step or the operations step (see "defining structures"). Errors vs. Invalidity
| |||||||||
| Errors of Corruption |
| |||||||||
| Errors of Insertion |
| |||||||||
| Errors of Misordering |
| |||||||||
| Errors of Omission |
| |||||||||
| Expanding a Program | You expand a program by redrawing its system network diagram so that instead of containing only one program it contains several. The new system network must have exactly the same input and output data streams as the old. Any new data streams must be intermediate data streams which are both produced and consumed by programs within the network. The commonest reason for expanding a program is to resolve a structure clash. | |||||||||
| Back to top | ||||||||||
| F | ||||||||||
| Back to top | ||||||||||
| G | ||||||||||
| Group ID Rule | If a structure contains a component which is a group of records all having the same value of a (usually sorted) identifier, then there must be an operation which stores the values of the identifier. | |||||||||
| Back to top | ||||||||||
| H | ||||||||||
| Back to top | ||||||||||
| I | ||||||||||
| Interleaving Clash | An interleaving clash is one particular kind of structure clash. In an interleaving clash one data stream consists of several data streams interleaved. Each of the interleaved data streams contains data for one identified entity, and the interleaving data has preserved the correct order of its records. | |||||||||
| Invalid | see Errors. | |||||||||
| Inversion | See Program inversion. | |||||||||
| Iteration | Structure diagram
Structure text A iter Iteration: A is an iteration of B. BNF Note: no plurals (e.g. Record *, not Records *) An iteration consists of zero or more occurrences of a component. Program components cannot be reordered in iteration, as they can in selection, to make the posit part appear first in the program text and ensure that quits are implemented as forward branches. | |||||||||
| Iteration Component | An iteration component is a component of a data or program structure. It has only one part, and consists of zero or more components of that part. In a tree structure diagram, an asterisk is placed in the upper right corner of the box representing the iterated part. | |||||||||
| Iteration Quits | POSIT
Iterate forever, quit when get B. When you want to posit (left) there is another instance of P-body, but have to posit (right) There are no more instances of P-body, for example (a) (such as with PDF). Then you have to use a false structure (b) as above. Posit '*' and quit to '+' until correct 'Actual B' then admit to B.<.p> With selection you can swap around, but not with iteration. | |||||||||
| Back to top | ||||||||||
| J | ||||||||||
| Back to top | ||||||||||
| K | ||||||||||
| Back to top | ||||||||||
| L | ||||||||||
| Leaf | Elementary component of a tree structure. | |||||||||
| Linear Network | A linear network is a network in which no program has more than one intermediate data stream as input or more than one intermediate data stream as output. The programs are therefore strung out in a line, each pair of adjacent programs being connected by one intermediate data stream. | |||||||||
| Back to top | ||||||||||
| M | ||||||||||
| Main Program | A main program is one which has been implemented so that in a single invocation it consumes and produces the whole of each of its input and output data streams. Usually (but not necessarily) it will be an OPTIONS (MAIN) procedure in IBM PL/1 or a program (rather than a subprogram) in COBOL. | |||||||||
| Multiple Read Ahead | Multiple Read Ahead is a scheme for allocating reads to a program structure. Using Multiple Read Ahead to read in records ahead, n reads are allocated at the beginning of the program after the open and one read to the end of each component which consumes one record.
| |||||||||
| Back to top | ||||||||||
| N | ||||||||||
| Networks | Implementing a network of programs as a single module.
| |||||||||
| Non-tree Network | A non-tree network is one which contains at least two programs between which there is more than one path within the network. Implementation of a non-tree network is more constrained than implementation of a tree network. You cannot usually invert the programs of a non-tree network in such a way that physical intermediate files are entirely eliminated. | |||||||||
| Non-variable State Subroutines | ||||||||||
| Null |
| |||||||||
| Back to top | ||||||||||
| O | ||||||||||
| Operations Step | The operations step is the third step in the Basic Design Procedure. It has two parts. In the first part the designer forms the operations list, working from output operations. In the second part the designer allocates each operation of the list to its rightful place in the program structure.
| |||||||||
| Ordering clash | An ordering clash is one particular type of structure clash. In an ordering clash, components which are functionally related cannot be corresponded because they occur in a different order in the two structures. The essence of an ordering clash is a difference in the sequencing of data. | |||||||||
| Back to top | ||||||||||
| P | ||||||||||
PDF stands for Program Development Facility. It is a software development tool that helps you to produce structured programs. You can draw and edit the data and program structures, add operations and conditions, and it will automatically generate the procedure division of a COBOL program.It will also output paginated structures to print. | ||||||||||
| Philosophy | "The best design for a program is one which reflects the structure of the problem to be solved." If the problem is to process specified inputs to produce specified outputs, the design should be based on the structure of the inputs and outputs. | |||||||||
| POSIT |
|
|||||||||
| POSIT Ordering Rules. | 1) POSIT the specific structure, ADMIT the general structure which includes the specific.
2) POSIT non-existence, ADMIT existence.
You can't put QUIT on C=LEFT-PART because of its condition (code<>3). You could put quit if EOF on C-REC-3, but would have to rewrite the condition on C-LEFT-PART as itr while (not EOF) and (code<>3). Not clear or easy. If you reverse it, you get:
3) If placing the QUIT statement is not transparently simple, re-order the parts and try placing the QUIT statements with the new order. | |||||||||
| POSIT Switch | There is a significant case of backtracking selection in which difficulties of handling beneficent side-effects combine with an obvious opportunity for optimisation. Suppose we have to process a file which may contain many errors, diagnosing as many of the errors as possible. A good record is to be written to file-a, a bad record to fil-b. Then, if the fields are F1, F2, etc., represented as G1, G2, etc., when they are good and E1, E2, etc. when they are bad, we have the structure:
Clearly, the processing of the good fields in GOODCARD is a beneficial side-effect, we would prefer not to start again in BADCARD. Further, it is clear that BADCARD must contain virtually all of the coding that appears in GOODCARD. There is therefore some disincentive to solving the problem in the simplest way. We would prefer not to write A below.
So instead we devise a more general component which contains both the posit and the aadmit parts as special cases. In order to know which one of them is currently instantiated, we introduce a "posit switch". When this has the value 'p', the general component is doing duty for the posit part; when it has the value 'a', for the admit part. The quit statement is implemented by setting the value 'a', initially, because by definition we choose the posit part first, the value 'p' is set. Finally, the write operation is chosen according to which part is being executed at the finish. The result is (b) above. | |||||||||
| Program Inversion | Program Inversion is an implementation technique used at the coding stage. If a program P has an input data stream A, then inversion of P with respect to A gives a subroutine PA which consumes one record of A on each invocation. The record is passed to PA as a parameter by the calling program, or may be in working-storage if PA is a COBOL section. Similarly, if a program P has an output data stream B, then inversion of P with respect to B gives a subroutine PB which produces one record of B on each invocation. Structure and design of P are not affected by inversion at the implementation stage.
Dishwasher example
F is a physical file. A writes to F. B reads from F. Invert A with respect to its input
A suspends when it writes to F. B resumes when input is available. Invert A with respect to its output
A is a subroutine of A. Reads in B become calls to A. Writes in A become returns to B. | |||||||||
| Program Step | The program step is the second step in the Basic Design Procedure. In the program step the designer forms a single program structure from all of the data structures, and verifies that the program structure is correct. Errors in the data structure may be found at this step (see defining structure). | |||||||||
| Program Structure | A program structure is a tree structure, representing in a tree structure diagram. It is formed by merging the data structures of the program so that corresponding data structure components give rise to a single program structure component. | |||||||||
| Back to top | ||||||||||
| Q | ||||||||||
| QS | See text pointer. | |||||||||
| Quit | See backtracking. Backward quits are not supported by PDF or JSP-COBOL. | |||||||||
| Back to top | ||||||||||
| R | ||||||||||
| Read-ahead Rule | Effect At any point in the program structure which is not inside a "consume input record" component, the next record is available, and condition tests can be made on it, as soon as execution enters a "consume input record" component, what was the next record becomes, effectively, the current record for processing; just before execution leaves the "consume input record" component, the READ operations allocated there replaces the current record by a new next record, which is now available for conditiion testing. | |||||||||
| Read Allocation | See: The normal allocation rules (how often? ... once per ... , etc.) place the read operation at the beginning of a consume record component. From the point of view of allocation this is fine. However, it does mean that any record is not available until it is about to be processed. In particular it is not available for the evaluation of any conditions outside the C_REC component. With the reads in this position there will be recognition difficulties at most of the selections and iterations in the program. To avoid at east some of these difficulties we consider allocating reads so that records are available sooner. That way conditions can be written and evaluated at the head of iterations and selections. The different read rules which we use place the reads further forward in the structure than the beginning of each C-REC component. We may think of a modified read rule as the result of shifting reads forward from the initial position, which we call thezero read ahead position to distinguish it from the others.
see conversational constraint | |||||||||
| Read operations | In "read allocation" we assumed that the same read operation is used to access all the records in the data stream. In some environments a variety of records are needed:
In cases of difficulty one can always revert to the zero read ahead position. | |||||||||
| Recognition difficulty | A recognition difficulty occurs when an input data stream cannot be correctly interpreted by reading only one record ahead. It is then necessary to read more than one record ahead or to use the backtracking technique. See:
A recognition difficulty is present if it is not possible to write conditions on all selection and iteration components which depend only on program local variables and on the next record of each input stream. Classes:
| |||||||||
| Recognition difficulties in iteration | Recognition difficulties can occur in iteration components just as in selection components. The data required to evaluate whether or not another instance of the iterated part is present may not be accessible at the moment in the program when the evaluation has to be made. The principles of solution are the same in the iteration case as the selection case. Multiple Read Ahead may be used when the condition only requires access to a fixed number of records. Backtracking can also be used, and must be when a fixed number of records is not enough. Backtracking technique is applied just as before: first a program is designed as though therer were no recognition difficulty, then quits are inserted at those points where the positied path may be proved the wrong one; finally the side effects of partial execution of the wrong path are handled; the side effects may beneficial, neutral or intolerable. As with backtracking in selection, there is a choice about which path to 'posit' and which to 'admit'. Whereas in selection the choice concerned which part of a 2 part selection to 'posit' and which to 'admit', in iteration the choice is whether to posit that there is another instance of the iterated part or whether to posit that there is not another instance. Consider the following example:
The choice, whether to posit an iterated part or posit no more iterated parts, can be made by applying the 'posit ordering rules' as for backtracking in selection. Note, however, that the program components cannot be ordered in iteration, as they can in selection, to make the posit part appear first in the program text and ensure that quits are implemented as forward branches. | |||||||||
| Rules | See:
| |||||||||
| Back to top | ||||||||||
| S | ||||||||||
| Selection | Structure diagram
Structure text A select Selection: A is a selection of B, C or D. BNF Examples C-MVT-RECORD-BODY select (MOVEMENTTYPE="N") | |||||||||
| Selection component | A selection component is a component of a data or program structure. It has two or more parts, and consists of exactly one occurrence of one of those parts. In a tree structure diagram, a small circle is placed in the upper right corners of the parts of a selection component. | |||||||||
| Sequence | Structure diagram
Structure text A seq Sequence: A is a sequence of B, C, D. BNF | |||||||||
| Serial Data Stream | A serial data stream is one whose records are consumed or produced in a definite order. Examples of serial data streams include:
| |||||||||
| Side Effect | Side effects occur when using the backtracking technique for solving recognition difficulties. The term refers to an operation or series of operations executed between the point where an assumption was made and the point where the assumption was proved incorrect. Identifying and dealing with side effects is part of the backtracking procedure.
Three methods:
| |||||||||
| Simple Program | A simple program is one which can be designed using only the Basic Design Procedure. The key characteristic of a simple program is that there are enough data correspondences for a single program structure to be formed correctly from them. | |||||||||
| Single Read Ahead |
Single read ahead is a scheme for allocating reads to a program structure. One read is allocated at the begining of a program after the open, and one read is allocated at the end of each component which consumes on record. It solves many recognition difficulties.
The most common read allocation rule is the single read ahead rule(SRA):- "Allocate one read immediately after the open; allocate a read at the end of each component which completely consumes an input." The effect of this rule is that throughout the structure one record is available for the evaluation of conditions. The single read ahead can be used when:-
| |||||||||
| State Vector | The state vector of a program is the set of its variables which must be remembered during program execution. This set includes the program text pointer. When a program is inverted, its state vector must be remembered from one inverted program to the next. | |||||||||
| Steps |
| |||||||||
| Structure Clash | ||||||||||
| Structure Diagram | A structure diagram is used to show data and program tree structures. It has a simple top-level box. The parts of the top level components are shown as boxes on the next level, and so on for as many levels as required. The top-levle component is called the 'root' of the tree, and the lowest-level elementary components are called its 'leaves'.
Choice of structure depends on the purpose for which it was designed. There could be more than one view of the data.
| |||||||||
| Structure Text | Structure text is a formal kind of pseudo-code. The beginning and end of each non-elementary component of the structure is marked by the component name followed by a keyword. For eample, a sequence begins with the component name followed by 'seq' and ends wiith the component name followed by 'end'. | |||||||||
| Structure Verification Procedure | The structure verification procedure is used to verify that one structure (such as a program structure) embodies another (such as a data structure). The procedure is to delete those parts of the first structure which do not derive from the second structure. It is then possible to verify that the result of these deletions is the same as the second structure. | |||||||||
| Summary of Basic Method |
| |||||||||
| System Network Diagram | A system network diagram shows how a set of programs and data streams are connected to form a system. Each program is represented by a rectangle, and each data stream by a circle. Arrows connecting circles to rectangles indiciate which data streams are input and output from each program.
| |||||||||
| Back to top | ||||||||||
| T | ||||||||||
| Text Pointer | The text pointer of a program is the variable which points to the instruction to be executed. In a main program the text pointer has a physical existence only at the machine level, and is hiden from the programmer. In an inverted program the text pointer appears as an explicit variable, conventionally named QS. | |||||||||
| Text Step | The text step is the fourth and last step in the Basic Design Procedure. It has two parts. In the first part the designer transcribes the program structure diagram into structure text. In the second part the designer adds conditions to the structure text for the iteration and selection components. | |||||||||
| Tree Network | A tree network is one in which there is only one path between any two programs. A tree network may be implemented, using program inversion, so that there are no physical intermediate data streams. | |||||||||
| Back to top | ||||||||||
| U | ||||||||||
| Back to top | ||||||||||
| V | ||||||||||
| Variable State Subroutine | A Variable State Subroutine is a subroutine which, when invoked, returns results which depend not only on the calling parameters, but also on the history of the previous invocations. A Variable State Subroutine when invoked returns results which depend on parameters AND previous calls. A non-Variable State Subroutine when called returns results which only depend on parameters of the call. Designing a Variable State Subroutine
|
|||||||||
| Back to top | ||||||||||
| W | ||||||||||
| Back to top | ||||||||||
| X | ||||||||||
| Back to top | ||||||||||
| Y | ||||||||||
| Back to top | ||||||||||
| Z | ||||||||||
| Zero Read Ahead |
Zero read ahead is a scheme for allocating reads to a program structure. One read is allocated to the beginning of each component which consumes a record.
|
Back to top Home Serious Stuff
© 2001. Copyright Sue Nethercott.