DECEDI_FETCH(3) — Subroutines
Name
DECEDI_FETCH − This enables the caller to fetch one or more files from the DEC/EDI Server. These files may have come directly from the Communications Service, through the translator, or from the mapper.
The type of file being fetched must be specified, and can be one of the following:
•Application_file -- files are fetched from the Mapper on the Server. These files are also known as structured files.
•Transmission_file -- files are fetched from the Communications Service on the Server, bypassing any translation or mapping. These files are also known as unstructured files.
•Document -- files are fetched from the Translation Service on the Server. These files are also known as ’ihf’ files.
C Binding
#include <decedi_api_def.h>
unsigned long int DECEDI_FETCH (application,
overrides,
test_indicator,
relationship_flag,
files)
char ∗application;
decedi_t_item_list overrides;
unsigned long int ∗test_indicator;
unsigned long int ∗relationship_flag;
decedi_t_item_list files;
Arguments
application
The name of the client application submitting the request to the Server. This is a null-terminated character string. This argument is used by DEC/EDI as a means of authenticating the request; the client application must be registered as an authorized application on the Server. Applications are registered by using the CommandCenter Services Editor. For more information, refer to DEC/EDI Configuring.
overrides
An item list specifying the overrides to apply to all files in this request. Build the item list by using one or more calls to DECEDI_ADD_ITEM_LIST. Valid item identifier values for the item list are shown in Table 1.
Note that there are ’File overrides’ in addition to these command overrides. The File overrides apply to each specific file fetched, whereas command overrides apply to the entire command. See the ’files’ argument for further information.
Table 1: DECEDI_FETCH Override Item Identifiers
| Value | Description |
| ----- | ----------- |
| DECEDI_ITM_LINK_ID | Connection ID if bypassing the Mapping and Translation Services. The value associated with this is a character string. This item is mandatory when the file type (DECEDI_ITM_FILE_TYPE) is DECEDI_FILE_TYPE_TRANSMISSION_FILE. |
| DECEDI_ITM_TEST_INDICATOR | Specifies whether to select test submissions or live submissions. If not specified, then any test indicator value can be matched. The value associated with this item is an integer containing one of the allowed values specified in Table 2. |
test_indicator
A returned flag indicating the test indicator of the selected files. The valid values for this flag are shown in Table 2.
Table 2: Values for Test Indicator
| Value | Description |
| ----- | ----------- |
| DECEDI_LIVE | Files in this request are live business files. |
| DECEDI_MAPPER_TEST | Files in this request are to be tested through to the mapper but no further. |
| DECEDI_PARTNER_TEST | Files in this request are test files from the sending partner. |
Note that only one test indicator type can be returned per call.
relationship_flag
Not currently used.
files
An item list specifying the files to be fetched in this request. Build the item list using one or more calls to DECEDI_ADD_ITEM_LIST. The valid item identifier values for the item list are shown in Table 3.
Note that the DECEDI_ITM_FILE_NAME must be the first file item for each file.
Table 3: DECEDI_FETCH File Override Identifiers
| Value | Description |
| ----- | ----------- |
| DECEDI_ITM_BUSINESS_REFERENCES | User application references to be added into the document audit trail for later tracking and reporting. This is a string value containing up to 5 values, each separated by a comma. Empty values are allowed so the user can target save references to one or more particular slots in the 5 available. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE) or internal format files (DECEDI_FILE_TYPE_DOCUMENT). |
| DECEDI_ITM_COMMENT | Comment to be added to the mapping audit trail. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_DEBUG | Specification of the file on the client to which the mapper debug output is to be written. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_NO_DEBUG | Specifies that there is to be no mapper debug output. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_ERROR_LOG | Specification of the file on the client to which the error log output is to be written. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_NO_ERROR_LOG | Specifies that there is to be no error log file. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_FILE_NAME | Specifies the location and name of the file that the client wishes to fetch into. The value associated with this is a string. This must be the first file item for each file. This item is mandatory and must be placed first in the item list. |
| DECEDI_ITM_FILE_TYPE | Indicates the type of the file to be fetched. The Server handles files differently, depending on the file type. The value associated with this identifier is an unsigned integer. The valid values for this flag are given in Table 4. If not specified then DECEDI_FILE_TYPE_APPLICATION_FILE is assumed. |
| DECEDI_ITM_IO_DEBUG | Specification of the file on the client to which the mapper I/O debug output is to be written. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_NO_IO_DEBUG | Specifies that there is to be no mapper I/O debug output. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_INTERNAL_REF | Return the Server’s internal reference for this object. The value associated with this will be a string that is long enough to hold the returned string. The flag attribute DECEDI_WRITEABLE must be specified when adding this value to the item list. |
| DECEDI_ITM_LOCAL_TEST | Specification of the input file on the Server to use when the mapper is in local test mode. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_NO_LOCAL_TEST | Specifies that the mapper is not to use local test mode. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_MATCH_FLAG | Flag indicating how the mapper should match documents. The value associated with this identifier is an unsigned integer. The valid values for this flag are given in Table 5. If not specified then DECEDI_MATCH_ALL is assumed. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_OBJECT_NAME | Identifies the type of object. It is used by the mapper and for internal-format files (in-house files) to distinguish different objects destined for the same application. The value associated with this identifier is a character string. This item is not applicable for transmission files (DECEDI_ITM_FILE_TYPE_TRANSMISSION_FILE). |
| DECEDI_ITM_OUTPUT_FILE | Specification of the file on the client to which the screen output from the mapper is to be written. The value associated with this is a character string. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_PARTNER_NAME | Identifies the partner who sent the file or the objects which are derived from it. The value associated with this identifier is a character string. This item is not applicable for transmission files(DECEDI_ITM_FILE_TYPE_TRANSMISSION_FILE). |
| DECEDI_ITM_RESTART_FROM | Document number from which mapping is to restart. The value associated with this is an unsigned integer. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
| DECEDI_ITM_RETURN_STATUS | Specifies where to place the result of the request for this particular file. The value associated with this will be an unsigned integer. The possible values returned in this field are given in Table 6. The flag attribute DECEDI_WRITEABLE must be specified when adding this value to the item list. |
| DECEDI_ITM_TABLE_NAME | Name of the mapping table to use if the file is going via the mapper. The value associated with this is a character string. This item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE) and is mandatory. |
| DECEDI_ITM_TIMEOUT | Maximum number of seconds to wait for the file to become available. If not specified a timeout of zero seconds is assumed. The value associated with this will be an unsigned integer. |
| DECEDI_ITM_TRACKING_REF | User-defined tracking reference associated with this file. The Server will use these values when auditing information about objects, and to respond to requests made by the DECEDI_TRACK call. The value associated with this is a character string. |
| DECEDI_ITM_NAMED_APPLICATION | Indicates that the application name specified as an argument is to be passed to the mapper. By default, the mapper obtains application names from within the map. This optional item is applicable only when DECEDI_ITM_FILE_TYPE specifies structured application files (DECEDI_FILE_TYPE_APPLICATION_FILE). |
Table 4: Values for DECEDI_FETCH File
| Value | Description |
| ----- | ----------- |
| DECEDI_FILE_TYPE_DOCUMENT | Document files will bypass the mapper and be sent directly to the application. These files are also known as In-house files. (DECEDI_FILE_TYPE_IHF) |
| DECEDI_FILE_TYPE_APPLICATION_FILE | Application_file documents will go through the mapper and their resultant application files will be placed in the required file. These files are also known as Structured files. (DECEDI_FILE_TYPE_STRUCTURED) |
| DECEDI_FILE_TYPE_TRANSMISSION_FILE | Transmission_file documents will bypass the mapper and be placed directly in the required file. These files are also known as Unstructured files. (DECEDI_FILE_TYPE_UNSTRUCTURED) |
Table 5: Values for Match Flag
| Value | Description |
| ----- | ----------- |
| DECEDI_MATCH_ALL | Match all documents found. |
| DECEDI_MATCH_FIRST | Match first document found. |
Table 6: Return Values for DECEDI_FETCH
| Value | Description |
| ----- | ----------- |
| DECEDI_RETURN_CREATE_FAILED | One of the output files specified in the request could not be created. |
| DECEDI_RETURN_OPEN_FAILED | One of the input files specified in the request could not be opened. |
| DECEDI_RETURN_MAP_FAILED | File was not fetched because the mapping failed. |
| DECEDI_RETURN_MAP_NOOUTPUT | The requested file map ran successfully but produced no output. Other files in the request will be processed. |
| DECEDI_RETURN_NOMORE | No files were found matching the specification. |
| DECEDI_RETURN_MAP_PARTIAL | A file in the request was only partially mapped. Details of what the mapper found can be obtained from the mapper output files, if specified. Other files in the request will be processed. |
| DECEDI_RETURN_SUCCESS | File was successfully fetched. |
Description
This routine issues a request to the Server to fetch one or more files from the Server. It then waits for the Server to fulfill the request and return the results.
Construct the request using one or more calls to DECEDI_ADD_ITEM_LIST. Once this call has been completed, use DECEDI_FREE_ITEM_LIST to release the associated item lists.
Return Values
DECEDI_BADITMLST
The request was rejected because the call had invalid, or missing item lists.
DECEDI_BADPARAM
The request was rejected because the call had invalid, or missing parameters.
DECEDI_INSUFVMInsufficient virtual memory available to complete request.
DECEDI_INTERROR
Internal error
DECEDI_NOCLIENTLIC
No active client license present
DECEDI_NOEDISYSEDI server system not running
DECEDI_NOTAUTHNot authorized to access the EDI server system
DECEDI_OPENINPERR
Could not open one of the input files
DECEDI_OPENOUTERR
Could not open one of the output files
DECEDI_ORBBADNODE
Bad server selection node
DECEDI_ORBBUSYObjectBroker busy.
DECEDI_ORBCOMMFAIL
Communications to server failed.
DECEDI_ORBDOWN
ObjectBroker not running
DECEDI_ORBERROR
ObjectBroker failure
DECEDI_ORBSAKERR
ObjectBroker "SAK" error.
DECEDI_ORBSRVDIED
Server process died
DECEDI_ORBSRVNOTFND
No server found
DECEDI_ORBTIMEOUT
Server timeout
DECEDI_ORBVERMISM
ObjectBroker version mismatch
DECEDI_SRVERROR
Server error
DECEDI_SUCCESSThe request was successfully processed by the server.
DECEDI_WARNINGNot all the request was successfully processed. Check the individual file statuses.
DECEDI_ZEROMATCH
No records matched
Example
#include <decedi_api_def.h>
unsigned long int status;
decedi_t_item_list item_list = (decedi_t_item_list) NULL;
decedi_t_ulong file_status;
unsigned long int test_indicator;
unsigned long int relationship;
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned long int) DECEDI_ITM_FILE_NAME,
(unsigned long int) DECEDI_STRING,
(unsigned long int) strlen("test_file.dat"),
(char ∗) "test_file.dat",
(unsigned long int) DECEDI_READ_ONLY);
if (status != DECEDI_SUCCESS)
{
}
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned long int) DECEDI_ITM_PARTNER_NAME,
(unsigned long int) DECEDI_STRING,
(unsigned long int) strlen("THEIR-APPLICATION"),
(char ∗) "THEIR-APPLICATION",
(unsigned long int) DECEDI_READ_ONLY);
if (status != DECEDI_SUCCESS)
{
}
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned long int) DECEDI_ITM_TRACKING_REF,
(unsigned long int) DECEDI_STRING,
(unsigned long int) strlen("INVOICE #1234"),
(char ∗) "INVOICE #1234",
(unsigned long int) DECEDI_READ_ONLY);
if (status != DECEDI_SUCCESS)
{
}
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned int) DECEDI_ITM_TABLE_NAME,
(unsigned int) DECEDI_STRING,
(unsigned int) strlen("MY_MAP"),
(char ∗) "MY_MAP",
(unsigned long int) DECEDI_READ_ONLY);
if (status != DECEDI_SUCCESS)
{
}
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned long int) DECEDI_ITM_RETURN_STATUS,
(unsigned long int) DECEDI_UINTEGER,
(unsigned long int) sizeof(file_status),
(char ∗) &file_status,
(unsigned long int) DECEDI_WRITEABLE);
if (status != DECEDI_SUCCESS)
{
}
status = DECEDI_FETCH ( "MY-APPLICATION", /∗ Application name ∗/
(decedi_t_item_list) NULL, /∗ Overrides ∗/
&test_indicator, /∗ Test Indicator ∗/
&relationship, /∗ Relationship ∗/
item_list); /∗ Files to be fetched ∗/
status = DECEDI_FREE_ITEM_LIST(&item_list);