Progress/400
Product Guide
Using the LOOKUP and SUBSTRING Functions with Send Data
When using the SUBSTRING function to process send data in conjunction with a LOOKUP function, do not use the following syntax:
The entry-list variable contains a list of values known to be in the first position, but this syntax fails. If you reassign the send-data variable to another CHARACTER variable within the same procedure as the LOOKUP function, the syntax works correctly.
If you use the SUBSTRING function without doing a LOOKUP, as shown in the following syntax, the SUBSTRING function works correctly:
RECEIVE DATA QUEUE (rcvdtaqe.p) API
Table 11–19 describes the parameters that you must pass to the RECEIVE DATA QUEUE API. You can use the same variable names or names of your own choice. Note that you must pass all of these parameters to the API, and they must be in the same order as in Table 11–19.
Table 11–19: RECEIVE DATA QUEUE (rcvdtaqe.p) Parameters Parameter Name Parameter Type and Data Type Value db-name INPUTCHARACTER The name of a connected DB2/400 database that contains the QDTAQ-ENTRY table. The database must be connected before the call to the API because an alias will be defined for the database that allows any DB2/400 database to use the API. que-name INPUTCHARACTER The name of the data queue on the AS/400. This data queue must have been created before using the API. library-name INPUTCHARACTER The library name where the data queue resides. key-data INPUTCHARACTER If the data queue was created to use a key, the data for the key.If the data queue is not keyed, assign this parameter to blank. key-length INPUTINTEGER If the data queue was created to use a key, the length of the key specified when the data queue was created.If the data queue is not keyed, assign 0 to this parameter. key-order INPUTCHARACTER The operand for the key data. The parameter can contain one of the following values: EQ, GE, GT, LE, LT, NE, =, >=, <, <=, <, <>.If the data queue is not keyed, assign blanks to this parameter. wait-time INPUTINTEGER The amount of time, in seconds to wait for an entry.If a negative number is specified, the API waits until an entry is available.If zero is specified, the API returns immediately.A positive number specifies the number of seconds that the API should wait. sender-Data INPUT/OUTPUTCHARACTER Notifies the API whether the sender data is wanted and should be returned. Assign Y to the variable if you want data and N or blank if you do not.The maximum length available is 64 bytes but the maximum length returned is 56: the first eight bytes are not valid toProgress and are removed before being returned. See the IBM System API Reference for an explanation of the first eight bytes. entry-data OUTPUTCHARACTER The entry removed from the data queue. You must know what the data will contain in order to process it with the SUBSTRING function for use in your procedure. Be careful about having the hex character zero in the data:Progress interprets the hex character zero as a NULL and the end of the data.For additional information on using the SUBSTRING function, see the "Using the LOOKUP and SUBSTRING Functions with Send Data" section. Status OUTPUTINTEGER A return parameter that indicates whether the entry has been placed on the data queue.
The following example illustrates calling the RECEIVE DATA QUEUE API from your code:
To verify that an entry has been received, check the value of the OUTPUT parameter. Table 11–20 lists possible return values.
Data Queue Coding Examples
The examples in this section illustrate how to send and receive entries from unkeyed and keyed data queues.
The first example sends and receives an entry from an unkeyed data queue:
This example sends and receives an entry from a keyed data queue. This data queue was created with a key length of 10 and a request for sender information:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |