In this section: |
Sequential data sources formatted in the following ways are recognized:
Free-format is a type of comma-delimited data source in which a record can span multiple lines and is terminated by a comma-dollar sign (,$) character combination.
Note: SET HOLDLIST is not supported for delimited files.
You can describe two types of sequential data sources:
Fixed-format data sources are sequential data sources in which each field occupies a predefined position in the record. You describe the record format in the Master File.
For example, a fixed-format record might look like this:
1352334556George Eliot The Mill on the Floss H
The simplest form of a fixed-record data source can be described by providing just field declarations. For example, suppose you have a data source for a library that consists of the following components:
This data source might be described with the seven field declarations shown here:
FIELDNAME = PUBNO ,ALIAS = PN ,USAGE = A10 ,ACTUAL = A10 ,$ FIELDNAME = AUTHOR ,ALIAS = AT ,USAGE = A25 ,ACTUAL = A25 ,$ FIELDNAME = TITLE ,ALIAS = TL ,USAGE = A50 ,ACTUAL = A50 ,$ FIELDNAME = BINDING ,ALIAS = BI ,USAGE = A1 ,ACTUAL = A1 ,$ FIELDNAME = PRICE ,ALIAS = PR ,USAGE = D8.2N ,ACTUAL = D8 ,$ FIELDNAME = SERIAL ,ALIAS = SN ,USAGE = A15 ,ACTUAL = A15 ,$ FIELDNAME = SYNOPSIS ,ALIAS = SYN ,USAGE = A150 ,ACTUAL = A150 ,$
Note:
You must describe the entire record. The values for field name and alias can be omitted for fields that do not need to be accessed. This is significant when using existing data sources, because they frequently contain information that you do not need for your requests. You describe only the fields to include in your reports or calculations, and use filler fields to represent the rest of the logical record length (LRECL) of the data source.
In the above example, the book synopsis is hardly necessary for most reports. The synopsis can therefore be replaced with a filler field, as follows:
FIELDNAME = FILLER, ALIAS = FILL1, USAGE = A150, ACTUAL = A150,$
Fillers of this form may contain up to 4095 characters. If you need to describe larger areas, use several filler fields together:
FIELDNAME = FILLER,,A256,A256,$ FIELDNAME = FILLER,,A200,A200,$
The field name FILLER is no different than any other field name. To prevent access to the data in the field, you can use a blank field name. For example:
FIELDNAME =,,A200,A200,$
It is recommended that you include file and segment attributes, even for simple data sources, to complete your documentation. The example below shows the Master File for the library data source with file and segment declarations added.
FILENAME = LIBRARY1, SUFFIX = FIX,$ SEGNAME = BOOKS, SEGTYPE = S0,$ FIELDNAME = PUBNO ,ALIAS = PN ,USAGE = A10 ,ACTUAL = A10 ,$ FIELDNAME = AUTHOR ,ALIAS = AT ,USAGE = A25 ,ACTUAL = A25 ,$ FIELDNAME = TITLE ,ALIAS = TL ,USAGE = A50 ,ACTUAL = A50 ,$ FIELDNAME = BINDING ,ALIAS = BI ,USAGE = A1 ,ACTUAL = A1 ,$ FIELDNAME = PRICE ,ALIAS = PR ,USAGE = D8.2N ,ACTUAL = D8 ,$ FIELDNAME = SERIAL ,ALIAS = SN ,USAGE = A15 ,ACTUAL = A15 ,$ FIELDNAME = FILLER ,ALIAS = FILL1 ,USAGE = A150 ,ACTUAL = A150 ,$
Reference: |
Master Files for comma-delimited and tab-delimited sequential data sources can have SUFFIX values of COM, COMT, TAB, or TABT. Comma-delimited data sources are sequential data sources in which field values are separated by commas. Tab-delimited data sources are sequential data sources in which field values are separated by tabs.
Note: SET HOLDLIST is not supported for delimited files.
You can also create delimited files using any token as the delimiter. For information, see Describing a Token-Delimited Data Source.
You can use the SET HNODATA command to specify how to propagate missing data to these data sources when you create them using the HOLD command. For more information, see the Developing Applications manual.
For the SUFFIX values of COM, COMT, TAB and TABT, if the data is numeric and has a zoned format (ACTUAL=Zn), the data must be unsigned (can not contain a positive or negative value).
A Master File containing the attribute SUFFIX=COM can be used to access two styles of comma-delimited sequential data sources:
Note that the setting PCOMMA=ON is required in conjunction with the SUFFIX=COM Master File when accessing this type of data source in order to interpret the double quotation marks around character values correctly. Without this setting, the double quotation marks are considered characters within the field, not delimiters enclosing the field values.
A Master File containing the attribute SUFFIX=COMT can be used to access comma-delimited sequential data sources in which all of the following conditions are met:
A Master File containing the attribute SUFFIX=TAB can be used to access tab-delimited sequential data sources in which all of the following conditions are met:
A Master File containing the attribute SUFFIX=TABT can be used to access tab-delimited sequential data sources in which all of the following conditions are met:
A common type of external structure is a comma-delimited sequential data source. These data sources are a convenient way to maintain low volumes of data, since the fields in a record are separated from one another by commas rather than being padded with blanks or zeroes to fixed field lengths. Comma-delimited data sources must be stored as physical sequential data sources.
Note: SET HOLDLIST is not supported for delimited files.
The report request language processes free-format comma-delimited data sources the same way it processes fixed-format data sources. The same procedure is used to describe these data sources in a comma-delimited Master File. The only difference is that the file suffix is changed to COM, as shown:
FILENAME = filename, SUFFIX = COM,$
Note: Free-format comma-delimited data sources do not have character fields enclosed in double quotation marks, and use the comma-dollar sign character combination to terminate the record.
You can use the system editor to change values, add new records, and delete records. Since the number of data fields on a line varies depending on the presence or absence of fields and the actual length of the data values, a logical record may be one or several lines. Hence, you need to use a terminator character to signal the end of the logical record. This is a dollar sign following the last comma (,$).
A section of comma-delimited data might look like this:
PUBNO=1352334556, AUTHOR='Eliot, George', TITLE='The Mill on the Floss', BINDING=H,$
The order in which the data values are described in the Master File plays an important role in comma-delimited data sources. If the data values are typed in their natural order, then only commas between the values are necessary. If a value is out of its natural order, then it is identified by its name or alias and an equal sign preceding it, for example, AUTHOR= 'Eliot, George'.
If a logical record contains every data field, it contains the same number of commas used as delimiters as there are data fields. It also has a dollar sign following the last comma, signaling the end of the logical record. Thus, a logical record containing ten data fields contains ten commas as delimiters, plus a dollar sign record terminator.
A logical record may occupy as many lines in the data source as is necessary to contain the data. A record terminator (,$) must follow the last physical field.
Each record need not contain every data field, however. The identity of a data field that might be out of sequence can be provided in one of the following ways:
Thus, the following statements are all equivalent:
BI=H, PRICE=17.95,$ BI=H, PR=17.95,$ BI=H, P=17.95,$
Information Builders |