list of chapters    previous chapter   next chapter

Appendix A - Powerbase as an Impulse server


Appendix A - Powerbase as an Impulse server

The following is a description of the Impulse "methods" understood by Powerbase, given in the standard format recommended by Computer Concepts. Users wishing to write their own Impulse tasks to communicate with Powerbase will need this information. They will also need details of the SWIs to which Impulse will respond, and this information is obtainable from Computer Concepts.

Description:

GetPathname specifies an "object" i.e. a Powerbase database. If Powerbase has the required database open it replies with the full pathname of the object, otherwise it returns an error message. Example of use:

:Powerbase !Elements GetPathname (returns pathname of !Elements )

R6 points to pathname when calling task is decoding reply.

Selection <string> tells Powerbase about a field, or group of fields, in which the caller is interested. The fields are specified as a list of tags, separated by any suitable character (e.g. "/" or ","). The same separator must appear at the very end of the tag-list. Powerbase replies with the maximum data-length of the combined fields in the selection. Example of use:

:Powerbase Selection NAME/SYM/Z/

R6 points to a string which gives data-length.

ParseQuery <string> informs Powerbase of the criteria to be used in selecting records to transmit to the caller. The parameter is a standard Powerbase search formula and Powerbase replies with the title which would normally appear at the head of one of its printed lists. Example of use:

:Powerbase ParseQuery GP=T

R6 points to returned title.

GetField <tag> requests from Powerbase the data in the specified field of the next record which matches the preceding ParseQuery command. When Powerbase replies to the GetField command the calling task should respond with an Impulse_FetchData, specifying the address and length of the buffer to be used, and then wait for an Impulse_Receive event (reason code &204) before reading the buffer. Example of use:

:Powerbase GetField NAME

GetRecord [<key>] (The square brackets signify that the key is optional: they are not part of the command.) Sent without a key it requests from Powerbase the next record which matches the preceding ParseQuery command. If the primary key of a record in the database is appended then Powerbase will return the record corresponding to that key. The key must be separated from the GetRecord by a space. The calling task must follow the procedure described above for GetField. Powerbase will transmit the fields specified in the Selection command, using the same separator as was used in that command. Receipt of data may be followed by another GetRecord command, returning the next matching record and so on, a zero-length response signifying that there are no more matching records. If using keys to request specific records you should end by sending *** as a key to tell Powerbase that the dialogue is finished. This command and the one below operate only on Subfile 0 of the Powerbase database. Example of use:

:Powerbase GetRecord ACTI

PutRecord informs Powerbase that the caller wishes to write a record to the current Powerbase database. It should be sent as message type &200. A Selection command should have been previously sent to tell Powerbase what fields to expect and what separator is to be used. Powerbase will then reply with a GetRecord command (reason code &201) which the caller should acknowledge with message type &202, specifying the maximum length of the data which will be sent. Wait for event &203 which is a request by Powerbase for the caller to transmit the data. The caller should then do so with Impulse_TransmitData, specifying the buffer address and the length of data being sent. This may be immediately followed by another PutRecord.

ExpandCode <string> requests the expanded form of a code used in a field linked to a validation table. The parameter string consists of the code itself, then a space, then the name of the validation table with the number of the linked column appended. Example of use:

:Powerbase ExpandCode T Group0

GetExpanded <string> combines the functions of GetField and ExpandCode, i.e. it requests the expanded form of the contents of a specified field. The parameter is the tag of the field. It is not necessary to supply the name of the validation table or number of the linked column since Powerbase can determine these from the entry in the Link file linking the field to the table. By default the second column of the table (i.e. column 1) is used to supply the expanded string, but this may be overridden by appending the relevant column number preceded by a comma as in the second example. Remember that the first column is numbered 0. Examples of use:

:Powerbase GetExpanded GP
:Powerbase GetExpanded GP,2

NextMatch is designed to remove the restriction whereby only the data from a single record can be merged into a given document. All it does is tell Powerbase to access the next record matching the search formula in the Merge window and interpret subsequent Merge commands by taking data from that record.

}



top of page   list of chapters    previous chapter   next chapter