In this example, two applications, named INQUIRIES and RETRIEVALS, communicate with each other by means of external Automatic Entries.
The INQUIRIES application allows users to inquire on product details, using an <<ispec>> class called PINQ. PINQ has the following properties:
(Name) | PINQ |
Alias | PINQ |
Stereotype | Ispec |
PresentationType | Fixed, Combo, or Graphic |
IsExternal | False |
Has persistent members | No (None of the attributes of the class are persistent) |
Has keys | No (none of the attributes of the class is a key) |
All product details are stored in the RETRIEVALS application, in the <<ispec>> class called PROD. PROD in RETRIEVALS has the following properties:
(Name) | PROD |
Alias | PROD |
Stereotype | Ispec |
PresentationType | None |
IsExternal | False |
Has persistent members | Yes (the class owns persistent attributes) |
Has keys | One (O-PRODN) |
To enable INQUIRIES to perform the external Automatic Entries, it also has a matching <<external ispec>> class called PROD.
Note: NB: PROD records are not stored in the database of the INQUIRIES application.
PROD in INQUIRIES has the following properties:
(Name) | PROD |
Alias | PROD |
Stereotype | External Ispec |
PresentationType | Not Applicable |
IsExternal | True |
Has persistent members | No (the class does not own persistent attributes) |
Has keys | No |
In this example, PINQ sends an inquiry to PROD, which extracts the required information from the RETRIEVALS database, and sends the results of the inquiry back to PINQ.
Conventions
The following naming conventions are used throughout this example:
Attributes that have Direction set to InOut and Persistence set to No start with IN-(for example, IN-PRICE).
Attributes that have Direction set to InOut and Persistence set to Yes start with IO-(for example, IO-PRODN).
Attributes that have Direction set to None and Persistence set to Yes start with OU- (for example, OU-DATE).
Ispecs Attributes and Options
The PROD Ispec must have its AutomaticEntryCapable attribute set to True. The following attributes make up the PROD <<ispec>> class in the RETRIEVALS application:
Attribute | IO-PRODN |
(Name) | IO-PRODN |
IsKey | Yes |
Direction | InOut |
Persistence | Yes |
Type | Number |
Length | 10 |
Decimals | 0 |
Description | Product Name |
Attribute | IO-PRICE |
(Name) | IO-PRICE |
IsKey | No |
Direction | InOut |
Persistence | Yes |
Type | Number |
Length | 8 |
Decimals | 2 |
Description | Selling Price |
The Agile Business Suite requires that a server <<Ispec>> class in a destination application must have an exact counterpart in the client application. For this reason, the PROD <<Ispec>> class must also be defined in the INQUIRIES application, with identical attributes, so that the Automatic Entry Buffers match.
Attribute | IO-PRODN |
(Name) | IOPRODN |
IsKey | No |
Direction | InOut |
Persistence | No |
Type | Number |
Length | 10 |
Decimals | 0 |
Description | Product Name |
Attribute | IO-PRICE |
(Name) | IOPRICE |
IsKey | No |
Direction | InOut |
Persistence | No |
Type | Number |
Length | 8 |
Decimals | 2 |
Description | Selling Price |
The PROD <<ispec>> class in INQUIRIES must have the IsExternal property set to true. This enables you to define PROD in the INQUIRIES application with attributes that are not persistent, indicating that a database structure is not required. It must also have the AutomaticEntryCapable property set to True.
The PINQ <<ispec>> class performs the external Automatic Entry and exists only in the INQUIRIES application, with the following attributes:
Attribute | IN-MAINT |
(Name) | IN-MAINT |
IsKey | No |
Direction | InOut |
Persistence | No |
Type | String |
Length | 3 |
Description |
Attribute | IN-PRODN |
(Name) | IN-PRODN |
IsKey | No |
Direction | InOut |
Persistence | No |
Type | Number |
Length | 10 |
Decimals | 0 |
Description | Product Name |
Attribute | IN-PRICE |
(Name) | IN-PRICE |
IsKey | No |
Direction | InOut |
Persistence | No |
Type | Number |
Length | 8 |
Decimals | 2 |
Description | Selling Price |
Ispec Logic
PROD Ispec in INQUIRIES Application
As the PROD Ispec in the INQUIRIES application is only present to define the mappings of the Automatic Entry Buffers, it requires no Ispec logic.
PINQ Memo Component in INQUIRIES Application
This logic is defined within PINQ Main logic.
When an inquiry request is keyed and transmitted, the screen items have the following values.
Item Name | Value |
---|---|
IN-Maint IN-PRODN IN-PRICE | INQ A Product Name No value |
Firstly, the external Automatic Entry is set up and sent using the following logic:
GLB.DESTINATION := "RETRIEVALS" PROD_Auto.initialize() PROD_Auto.setmaint(IN-MAINT) PROD_Auto.IO_PRODN := IN-PRODN PROD_Auto.Send()
This is the equivalent of the AUTO.ENTRY; and AUTO; WRITE commands from EAE, used with an External Automatic Entry.
The client application now awaits a response from RETRIEVALS, or from the HUB mechanism.
When the response is received, Glb.Status and Glb.HubStatus are checked to establish the result of the external Automatic Entry. Glb.Status is checked to see if a valid response containing data was returned. If so, the returned data is available in the Automatic Entry Buffer.
If the response is valid, the data is moved from the buffer to the screen memory, and the screen memory area is displayed to the user by a Recall command for the current <<Ispec>> class, as shown in the following logic:
If Glb.Status = "DATA" IN-PRICE := PROD_Auto.IO-PRICE Recall EndExit
Glb.Status is then checked again to see if a valid response without data was returned, as in the following logic:
If Glb.Status = Glb.Spaces ME ATTENTION "No data returned" EndExit
The following conditional logic shows the handling of an error or unsuccessful external Automatic Entry.
Note: Message displays must be coded in reverse order. For readability reasons only, they are shown here in the order they are intended to be displayed.
If Glb.Status = "*****" If Glb.Hubstatus = "SECURITY.ERROR" ME ERROR "You have insuffient security to perform" ME ERROR "this action on the RETRIEVALS application" EndExit ME ERROR "Rejected by the RETRIEVALS Ispec. Glb.Error was" ME; ERROR (set on the server system) EndExit If Glb.Status = "NODB" ME ERROR "RETRIEVALS system could not be accessed" EndExit If Glb.Status = "BUSY" ME ERROR "Insufficient resources were available to" ME ERROR "process or deliver the external Auto Entry" EndExit If Glb.Status = "TOUT" ME ERROR "The timeout period was exceeded" ME ERROR "before a response was received" EndExit If Glb.Status = "BLOCK" ME ERROR "RETRIEVALS access was incomplete -" ME ERROR "RETRIEVALS database may have undefined result)" EndExit
PROD Ispec in RETRIEVALS Application
The following PROD <<Ispec>> class logic in the RETRIEVALS application processes the external Automatic Entry and replies to it. This logic is activated when a transaction is received from PINQ in the INQUIRIES application. (PINQ initiated the transaction by using the PROD_Auto.Store() method.)
If MAINT = "INQ" IO-PRICE := PROD.IO-PRICE RECALL EndExit
Agile Business Suite has performed an automatic retrieval of the appropriate PROD record based on the Ordinate value received with the transaction, and that record is available in the database memory area. The IO-PRICE item is then moved from the database memory area to the screen memory area.
As the transaction was initiated by a different application (automatically identified from the Glb.Origin value), the Recall command causes the screen memory area to be passed into the PROD_Auto Automatic Entry Buffer instance in RETRIEVALS. It is then passed across to the PROD_Auto Automatic Entry Buffer instance in INQUIRIES, which can be assigned to another instance of PROD and be accessed, as shown earlier.
Note: The code for PROD in the RETRIEVALS application is exactly the same whether handling a transaction entered directly from a terminal connected to the RETRIEVALS, or handling a transaction passed by an external Automatic Entry. This is because the Agile Business Suite identifies the origin of the transaction, and ensures it is returned to the appropriate application.