Jackson Structured Programming Glossary

Home

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.

ItemDescription
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
  • that the specification exists
  • that a programming language has already chosen
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
  • Presume "Friendly demon" when drawing data structures to avoid a dynamic structure.
  • be optimistic when deciding which branch to take.
  • continue until proven incorrect
  • return to branch point, at the same time, handling any side effects of being on the wrong leg. Side effects can be:
    • Neutral
    • Beneficial
    • Intolerable
  • continue down other path

Backtracking is used both for selection or iteration (sometimes assumes that another execution of the loop is required).

Which path?
  • Use POSIT/ADMIT rules
  • The choice which path to navigate first must be chosen so that the quit statements can be correctly placed.
  • Posit rules:
    • posit the specific structure and admit the general structure
    • posit non-existence and admit existence (e.g. errors)
    • if neither of the above applies try both orderings of the selection and posit the branch in which it is easier to disprove the original selection. See Posit Ordering Rules.

See example (5).

Basic Design Procedure Steps
Benefits
  • JSP creates understandable and maintainable programs.
  • JSP creates reliable programs.
  • JSP provides standardised documentation.
  • JSP provides a commona and professional way of writing.
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
  • you cannot consider data streams in isolation
  • merging a number of files
  • 2 or more files consumed simultaneously
  • sorted on same key
  • operations depend on presence/absence of records on other files.

Standard collating solution:

  • The operations are:
    "IDENT:=1" and "IDENT+1" are replaced by "GET-NEXT-KEY" (if EOF is encountered then NEXT-KEY will be given a high value)
  • The selection conditions are:
    (file1-rec = Nextkey) & (file2-rec = next-key) ..... file1 and file2
    (file1-rec = Nextkey) & (file2-rec <> next-key) ..... file1 only
    (file1-rec <> Nextkey) & (file2-rec = next-key) ..... file2 only
    (else)
  • The iteration condition is:
    while not ((file1-rec = high-valuse) & (file2-rec = high values))
  • data on neither file is the usual "KULL" component if ALL possible key values are to be processed.
  • The "NULL" component is usually not present as absence of key from both files requires no processing.
  • the next key value is found by comparing key values on both files and choosing the lowest number.

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
Sometimes several reads (one or more) alternate with several writes. The first of the reads can be put beside the last write; the rest can be allocated according to the single read ahead rule. This is a simple modification of the conversational constraint rule.

Other constraints
In principle, there could be other patterns of constraints between the reads and i/o operations on the other data streams. By examining the constraint, one could see how far the reads could be shifted forward, and thus establish a suitable read rule. In practice other constraints are extremely rare.

Correctness
  • no mixed components (e.g. see body box)
  • JSP guarantees that programs are free from particular types of errors, i.e. wrong sequence of operations.
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

  • definition of terms
  • data structure defines VALID data
  • invalid data would leave the program in an undefined state
  • human input may not be correct and these are errors
  • we could ELABORATE the structure to take care of errors
  • Method
  • start with a good structure
  • elaborate for favoured errors
  • make distinction between GOOD and ERROR at the appropriate level
Errors of Corruption

Valid Structure:

 

Corruption:

 
Errors of Insertion

Valid Structure:

 

Insertion:

 
Errors of Misordering

Valid Structure:

 

Misordering:

 
Errors of Omission

Valid Structure:

 

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
     B;
A end

Iteration:
A consists of zero or more whole B's.

A is an iteration of B.

BNF
<A>::= {<B>}

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.

See Recognition difficulties in iteration.

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
  • there is another instance of the iteration
  • there is no other instance of the iteration

(a)

 

(b)

 

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.

Method
  • determine number (M) of records to read
  • choose an implementation of Mread
  • allocate M Mread operations in place of the single Sread immediately following the open for the data stream
  • replace all other Sread operations by Mread
  • write required conditions referring to the NEXT, NEXT + 1, records etc.
Conditions under which Mread can be used
  • the number of records to be read in advance is fixed
  • there is sufficient storage space available to hold the records
  • Mread is sufficient to evaluate ALL conditions
Summary
  • multiple read ahead can only be used when the recognition difficulty can be solved by examining a fixed number of records ahead
  • the extra records made available by Mread are for examination only, and cannot be processed before becoming current
  • multiple read ahead can be used to solve problems in iteration components, as well as selection components
  • single read ahead is a way to solve most recognition difficulties.
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

See 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

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
  See backtracking and iteration quits.
POSIT Ordering Rules.

1) POSIT the specific structure, ADMIT the general structure which includes the specific.

 

'X1' and 'X2' are good strings, but are also instances of error string!

If we reverse the order of the parts, text reads:
      C-String posit(error string)
      C-String admit(good string)
      C-String end
there will be nowhere to place the quit statements.

2) POSIT non-existence, ADMIT existence.

 

Step 1 of backtracking:
   C-TYPE-3-FILE seq
      C-LEFT-PART itr while (CODE NE 3)
      C-LEFT-PART end
           ...
      C-REC-3 seq
           ...
      C-REC-3 end
      C-RIGHT-PART itr while (not FILE-eof)
           ...
      C-RIGHT-PART end
   C-TYPE-3-FILE seq

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:

 

TYPE-X-FILE text:
      C-TYPE-X-FILE itr while (not EOF)
      C-REC-3 seq
           ...
      C-REC-3 end
      C-TYPE-X-FILE end

The hypothesis is disproved if a REC-NE3 has code=3.
      C-TYPE-X-FILE itr while (not EOF)
      C-REC-NE3 seq
      C-FILE quit (code=3)
           ...
      C-REC-NE3 end
      C-TYPE-X-FILE end

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.

(a)

 

(b)

   PREC posit
      quit PREC if E1
          process G1
      quit PREC if E2
          process G2
      quit PREC if E3
           ...
          write to file-a
      PREC admit
      PF1 sel G1
          process G1
      PF1 alt E1
          process E1
      PF1 end
      PF2 sel G2
           ...
          write to file-b
   PREC end

     PGEN seq
      PSW:='p'
      PF1 sel G1
          process G1
      PF1 alt E1
      PSW:='a'
          process E1
      PF1 end
      PF2 sel G2
           ...
      PFn end
      PWT sel PSW='p'
          write to file-a
      PWT sel PSW='a'
          write to file-b
      PWT end
   PGEN end

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.

  • After designing a program you may want to use it as a subroutine.
    • the program will not have immediate access to pinputs or means of disposal to outputs
    • coding may be introduced at the implementation stage

Dishwasher example

  • two approaches:
    • input all plates to A, then input all plates to b (this requires holding area for plates)
      2 programs, with a file inbetween ('A' runs to completion, then 'B')
    • One plate at a time is passed through both machines (no holding area required)
      Record passes from A to B and control switches.

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.
B suspends when it wants to read back to it (sic). A resumes when control is passed back to it.

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
see read operations.

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 Fortran the formatted read may have to be placed in the zero read ahead position.
  • In some on-line environments there can appear to be a separate read for each write operation, but since we place the records beside the writes for these problems, no difficulty arises.
  • Several different read operations are usually needed in a database programming problem. Single read ahead can usually be applied within parts of the structure in which only one read operatrion is used.

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:

e.g

 

e.g

 

Here you have to read ahead a fixed number of times to tell if it's B or C.

 

Here you have to read ahead a variable number of records.

  • conditions cannot be evaluated with just the next record.
  • try ro avoid dynamic thinking when drawing up data structures
  • static structure is a simpler and more direct representation of the problem.

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:

  1. soluble by reading ahead a fixed number of records (>1)
  2. soluble by reading ahead a variable number of records
  3. Soluble only by executing operations other than read operations on the input data stream. e.g.: read input stream FA, compress them, write to output file of limited size. I can output, do; else don't and write error message.

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:

First, suppose that it is convenient to posit that thre is another instance of the iterated part A. The text will be:
   P seq
      P-BDY itr (for ever)
            A seq
           ...
      P-BDY quit
           ...
      P-BDY quit
           ...
            A end
      P-BDY end
      B seq
           ...
      B end
   P end

The quits are placed within the program component A at points where the hypothesis that the data being processed represents another instance of A can be proved false. The quits are implemented as unconditional branches to the 'P-BDYend' and the side effects of partially executing another instance of A before quitting are handled, in the normal way, before continuing with the next program component, B.

     

Now suppose that it is more convenient to posit that there is not another iterated part A. The text becomes:
   P seq
      P-BDY (itr)
            A seq
           ...
            A end
      P-BDY end
      B seq
           ...
      P-BDY quit
           ...
      P-BDY quit
           ...
      B end
   P end

The quits are placed within the program component B at points where the hypothesis that the data being processed represents B rather than another instance of the iterated part A can be proved false. This backtracking construct is implemented by coding an unconditional branch to the label 'B Seq' immediately before the label at 'P-BDY(itr)'. The quits are implemented as conditional branches to the label 'P-BDY(itr)'and the side effects of partially executing the program component B are dealt with before continuing with the program component B.

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
     B;
A alt
     C;
A alt
     D;
A end

Selection:
A consists of either one B, one C or one D.

A is a selection of B, C or D.

BNF
<A>::= <B>|<C>|<D>

Examples

C-MVT-RECORD-BODY select (MOVEMENTTYPE="N")
     subtract MVTQTY from TOTQTY;
C-MVT-RECORD-BODY alt (MOVEMENTTYPE="P")
     add MVTQTY to TOTQTY;
C-MVT-RECORD-BODY end

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
     B;
     C;
     D;
A end

Sequence:
A consists of one B, followed by one C, followed by one D.

A is a sequence of B, C, D.

BNF
<A>::= <B><C><D>

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:

  • database file as seen by a particular program
  • sequence of messages from an on-line terminal
  • sequence of interrupts of a particular type
  • elements of a table (or array) accessed by incrementing a subscript
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.

  • neutral
  • beneficient
  • intolerable

Three methods:

  • Note/Restore:
    • remember variable etc. and restore to this state if admit
  • Do/Undo:
    • do normally in posit and undo at start of admit
    • may have to include 'undo' processing with each quit
    • quits may need to be regularised (tailored to what done) i.e. ensure the same state whenever quit is used
  • Pretend/Really:
    • in posit side pretend to do it (e.g. build up output record)
    • really do it at end of posit (e.g. write output rec)
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.

  • one after open
  • one after each consumed component

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:-

  1. There is an eof or a structurally recognisable last record. (Since we now read (n+1) times for (n) records, there must be something returned on the last read. In many environments we have to simulate the "eof" record.
  2. There must be no constraints on the way reads are interleaved with I/O operations on other files.

See conversational constraint.

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'.

      

Valid data:
     soup, helping, helping, ice cream
     pate, ice cream
     ice cream
     helping, helping, helping, ice cream

Invalid data:
     soup, pate, helping, ice cream
     helping, helping

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
  1. see constructs.
    • data structures are the fist step in the design process and musst be completed before moving on to subsequent steps.
    • incorrect data structures will show up in later stage of design and will need to be re-designed
    • picture of data drawn before considering dynamics
    • A correct structure makes it difficult to do things in the wrong order or the wrong umber of times (as opposed to a flowchart)
    • Verification of correctness made if all steps of the method can be completed
    • simple method producing easily understood results
    • more vigorous method
    • gives standardised documentation
    • use of null component
    • illustration of a terminal conversation
    • batch solutions can be used on-line
    • JSP guarantees tht programs are free from particular types of errors i.e. wrong sequence of operations.
    • Normally switches are introduced and start making logic incomprehensible. JSP avoids this as far as possible.
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.

  • Purpose: identify data streams
  • Unidirectional streams - e.g. terminal conversation has 2 streams
  • No splits: stream may not merge or split (OK in JSD)
  • A circle represents a data stream
  • each arrow represents the direction of the flow of the data
  • A rectangle represents a 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

      

no conditions can be evaluated outside "rec" based on next record (recognition difficulty)

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.