Host Transport Protocol “WORM” (Document Archiving)

This DDE transport protocol enables Host users to transfer new documents to the PC on demand. The Host software determines which printouts are documents to be archived, and should retain all relevant print images until reasonably confident these have been secured by the PC (usually for about one day).

The WORM Pool

One way to do this, which minimises the coding required in individual applications, is to pass each print line to an intercept procedure. This procedure forwards the line to the printer, just as the application would have done in the absence of the intercept. But in addition, if the application has attached to the archive, it adds the line to a file we call the WORM Pool (and provides some warning mechanism should the file be nearing full status). Under this scenario, all the application need do is to attach itself to the archive prior to printing each document, and to detach on completion. Attachment incorporates presenting the Document Tag (see below) to an attachment procedure, which adds the tag to the WORM Pool.

The Host has only one WORM Pool. In the general case this might serve up to 15 printers at any one time, with the records from separate printers being interleaved (multiplexed) during concurrent printouts. A custom program transfers the outstanding contents of the WORM Pool to the PC in chronological sequence by establishing dynamic data exchange under protocol WORM. This protocol uses the concept of a slot number to identify data within the WORM Pool. The slot number is used to ensure accurate synchronisation between Host and PC. The protocol supports a reset capability (should synchronisation be lost) and allows document transfer to be interrupted and resumed at will.

In a real-time environment, the absence of any outstanding WORM Pool records to pass to the PC does not imply all documents are completely printed! If a semaphore counts how many printers are currently attached, evidently all documents are complete only when the semaphore is zero.

Intercepting print lines en route to the printer ensures the accuracy of the archives. If a document is reprinted by the Host it is of no consequence if each copy is archived (document tags do not have to be unique). Indeed this is advisable if there is any chance that the reprinted text may differ from the original.

Document Tags

The tag consolidates all the key fields the PC will use to retrieve the document. Where serial numbers are used these are expected to be issued strictly chronologically without gaps within or between document issue dates.

Document Tag: Schema 2

PIC XDocument Type (user defined), e.g.:
VALUE "I" if Invoice
VALUE "C" if Credit Note
VALUE "S" if Statement
PIC XSchema No (user defined), this Document Type:
VALUE "1" if first edition.
PIC 9(6)Document Issue Date (YYMMDD)
PIC 9(9)Document Serial Number
VALUE SPACES if not used
PIC XFlag 1 (e.g. Serial No suffix or Department Code)
VALUE SPACE if not used
PIC XFlag 2 (e.g. Reprint Indicator)
VALUE SPACE if not used
PIC X(12)Reference (usually Account Number)
VALUE SPACES if not used

Document Tag: Schema 3

This schema has identical format to Schema 2 but should be used where the Document Serial Number is issued independently by each group represented by the value of Flag 1.

Document Tag: Schema 1 (obsolete but supported)

PIC XXDocument Type & Schema No, as Tag Schema 2
PIC X(6)Account Number
PIC 9(6)Document Issue Date (YYMMDD)
PIC 9(5)Document Serial Number (overwritten by Account Number digits if Document Type="S")
PIC XFlag 1, as Tag Schema 2
PIC XFlag 2, as Tag Schema 2
PIC X(6)Reference (e.g. Date of Supply)

Protocol Syntax

The WORM protocol supports two operating modes:

  1. The Host activates DDE by sending the Title frame:
    PIC X(4)VALUE "WORM"
    PIC XXSoftware Version Tag:
    VALUE "S1" if Simplex Protocol.
    VALUE "M1" if Multiplex Protocol.
    PIC 99Host Identification:
    VALUE 0 if Main Processor.
    VALUE 1 if Backup Processor.
    PIC 99(this field present in Multiplex Protocol only)
    Maximum number of printers attached to WORM Pool at one time (not to exceed 15).
    PIC 9(w)(Select any width w in the range 1 to 9 digits)
    Identification Number of last WORM Pool Slot sent to PC in previous run.
    VALUE 0 forces reset (see note).
    PIC 9(w)(width w as previous field)
    Maximum Slot Number in WORM Pool.

    WORM Pool slots are numbered consecutively from slot number 1. When the maximum slot number is reached, numbering wraps back to slot 1 (so the WORM Pool is always filled with the most recent data). The PC compares the last slot sent previous run with its own information and (after consulting the user about any discrepancy) may issue a Reset message frame at step 2 below. However, this check may be pre-empted by setting the field to 0 thus advising the PC to expect slot 1 next

  2. Either the PC sends GS if it is ready to receive the next data frame (go to step 3),
    or the PC sends a Message frame (see below) if it is ready to receive the next data frame (process the message and go to step 3),
    or the PC sends US if it did not receive the previous frame correctly (Host must repeat previous frame and return to step 2),
    or the PC sends ESC (program terminates DDE).
  3. Either the Host sends the oldest outstanding record in the WORM Pool:
    PIC 99(this field present in Multiplex Protocol only)
    Printer Number.
    PIC XXVALUE "T2" if Document Tag (Schema 2).
    VALUE "T3" if Document Tag (Schema 3).
    Line Feed count if Line Feeds+Print Image.
    VALUE "00" if Form Feed+Print Image.
    VALUE "T0" if Vertical Tab+Print Image.
    PIC X(132max)Document Tag or Print Image
    (variable length text with optional Space Compression).

    Space compression significantly reduces transfer time by encoding any run of 2 to 97 consecutive spaces into two ASCII bytes. The first byte is the Space Run indicator DEL (7Fhex). The second byte is generated by adding 1Ehex to the number of spaces (in binary), yielding an ASCII result in the range 20hex:7Fhex. Trailing spaces should be discarded.

    or the Host sends a Condition Code (see below).
  4. If step 3 indicated the WORM Pool is empty, the PC will sleep for four seconds or until ESC is pressed.
  5. Go to step 2 but do not consider data sent at step 3 as acknowledged until the PC indicates it is ready to receive the next data block.

Message Codes (PC to Host)

Reset

PIC XXVALUE "WR"
PIC 9(w)(width w is same as presented in the Title frame at step 1)
Revised Identification Number of last WORM Pool Slot sent to PC.

Requests that the Host sends WORM Pool records beginning from the slot following the specified slot number.

Condition Codes (Host to PC)

Done

 (this is an empty frame)

Issued when there are no outstanding records in the WORM Pool and no Host applications are attached to the archives.

Wait

PIC XVALUE "Z"

Issued when there are no outstanding records in the WORM Pool but at least one Host application is attached to the archives.

Disengage

PIC XXVALUE "ZD"

Requests immediate termination of DDE, regardless of whether any outstanding records remain in the WORM Pool. If the PC accepts this request it sends ESC at step 2.

The Protocol Handbook