Copyright © TIBCO Software Inc. All rights reserved
Copyright © TIBCO Software Inc. All rights reserved


Chapter 4 Using the Adapter : FileSubscriber Usage Guidelines

FileSubscriber Usage Guidelines
This section discusses the following FileSubscriber usage guidelines:
Receiving Numeric Data Types
This section explains how FileSubscriber can be configured to handle the numeric data types supported by the adapter.
FileSubscriber can be configured to create non-text files by using the isBinary=true parameter in the FileType section and two field parameter tags in the FILE_LINE element. As a result, FileSubscriber can process non-text data types. The numeric data types are converted from incoming TIBCO data types of either INTEGER, UNSIGNED INTEGER, SHORT, UNSIGNED SHORT, FLOAT, or STRING into the desired target data type that is specified in the convertTo parameter. Because there can be a loss of precision when converting from FLOAT values, it might be preferable to specify STRING as the published data type. The numeric data type to be used for the output record for each field is specified by the tag convertTo in a field parameter of the FILE_LINE element.
To support zoned, binary, packed, and floating-point data types:
1.
Set the isBinary parameter in the FILE_OPTIONS element to true.
2.
Set the convertTo and precision tabs in the FILE_LINE element to desired values.
Since the fields of data type BINARY(COMP, COMP-4) are being published as INTEGER, mention the type="INTEGER" and convertTo="BINARY".
Adding Header and Trailer Records
You can add a header record or a trailer record, or both, to an output file. The added records can contain any text string and variable data.
To add a header record, use the fileHeader parameter in the FILE_OPTIONS element of the FileSubscriber configuration file. To add a trailer record, use the fileTrailer parameter in the FILE_OPTIONS element of the FileSubscriber configuration file. For each of these parameters, a text string and up to three variables — the number of records, a blank field, and the date and time — can be specified in the following format:
 
  fileHeader=”<text>|[%<fieldWidth>,NUMBER_OF_RECORDS%]|
    %<fieldWidth>,BLANK%]|[<text>|%<fieldWidth>,DATE_TIME%]”
 
 fileTrailer=”<text>|[%<fieldWidth>,NUMBER_OF_RECORDS%]|
    %<fieldWidth>,BLANK%]|[<text>|%<fieldWidth>,DATE_TIME%]”
where
<text> is any alphanumeric descriptive string. If included, it can appear anywhere within the quotation marks but must not be included within the square brackets ([ ]).
%<fieldWidth> is the number of characters in the related field; % is a C type substitution
NUMBER_OF_RECORDS is replaced with the number of records in the output file. If there are no errors, this number have to correspond to the number of messages received to generate the file.
Because the adapter receives records into a work file then generates the final output file, the NUMBER_OF_RECORDS variable can be used when specifying a header record.
DATE_TIME is the date and time in the format YYYYMMDDHHMMSS.
BLANK is a blank field that can be used to provide a space between the other variables.
FileHeader Example
Suppose you want to add a header record to an output file that shows the number of records received and the date and time that the output file was created, with two spaces between the fields. You would include the following parameters in the FILE_OPTIONS element of the FileSubscriber configuration file as follow:
 
  FILE_OPTIONS = { prefix=”test”,
  fileHeader=”[%4,NUMBER_OF_RECORDS%][%2,BLANK%][%14,DATE_TIME%]”,
  subscribeSubjectName=…

Copyright © TIBCO Software Inc. All rights reserved
Copyright © TIBCO Software Inc. All rights reserved