• No results found

Tfile Conversion

In document jql (Page 133-136)

Tfile codes provide a method for retrieving data fields from any other file to which the user has access.

COMMAND SYNTAX

T[*|DICT]file-specifier;c{n};{i-fmc};{o-fmc}

SYNTAX ELEMENTS

* or

DICT Indicates the use of the dictionary of the specified file, rather than the data section.

file-specifier identifies the reference file by name in the format file-name{,data-section-name}.

c- specifies a translation code, which can be any one of the following:

C If reference record does not exist or the specified FMC is null, output the value unchanged.

I Inputs verify: Functions as a C code for output and as a V code for input.

O Outputs verify: Functions as a C code for input and as a V code for output.

V Reference record must exist and the specified FMC must contain a translatable value. If the record does not exist or the FMC contains a null, an error message will be output.

X If reference record does not exist or the specified FMC is null, return a null

n specifies a value mark count to return one specific value from a multivalued field.

Returns all values if omitted.

i fmc the field number for input translation. which if omitted or contains a null value, no input translation takes place.

o fmc is the field number for output translation. If the value is null, no output translation takes place.

Comments: Uses the current data value as the record key for searching the specified reference file.

Returns a data field or a single value from a data field, from the record

Use Tfile codes in fields 7 or 8 of the data definition record. Use field 8 if translation of a multivalued field or comparisons and sorts are required.

If you apply selection criteria, you can either use field 8, or field 7 and set up special records in the reference file to perform any input translation you require.

The special records in the reference file have as record keys values that the field subject to translation may be compared with in a jQL sentence. Field i-fmc within these records contains the translate value that will be compared to values on file. Typically, values in a jQL sentence are output values, so that the special input translation records are effectively the inverse of the output translation records.

Tfile codes can be “embedded” in other conversion codes but you must still follow the syntactical conventions of the “host” code. For Example, if you include a Tfile code in an F code conversion, enclose the Tfile code in parentheses.

Output conversion is valid. The Tfile code has a parameter (o-fmc) that specifies the field in the translation record to use for output conversion.

Input conversion is valid. The Tfile code has a parameter (i-fmc) that specifies the field in the translation record to use for input conversion.

EXAMPLE 1 TSALES;X;;2

Using this Tfile code in field 8 of a data definition record, which also has a 0 in field 2, will cause the key of the current record to be used as the key when accessing the reference file SALES; returns null if the record cannot be found; returns the value of field 2 if the record is found.

EXAMPLE 2 TSALES;C;;2

Using this Tfile code in field 8 of a data definition record, which also has a 6 in field 2, will cause the content of field 6 from the current record to be used as the key when accessing the reference file SALES. If the record cannot be found, or if found, field two is null, returns the content of field 6 of the current record. If the record is found, and field 2 contains a value, it returns that value.

EXAMPLE 3 A;3(TSALES;X;;2)

Using this embedded Tfile code in field 8 of a data definition record will cause the use of field 3 of the current record as the key when accessing field 2 of the reference file SALES. Returns null if the record cannot be found; returns the value of field 2 if the record is found.

U Conversion

Use the U code to execute a system subroutine to process values.

COMMAND SYNTAX Uxxxx

SYNTAX ELEMENTS

XXXX The hexadecimal identity of the routine.

Comments: jBASE user exits are customized routines specially produced to perform extraordinary processing.

Input Conversion: Routine dependent

Chapter 6 Default Data Definition Records

When issuing a jQL Command without containing specific references to data definition records, nor do you suppress the output of the report detail, the system will attempt to locate any default data definition records, which may be set up.

For Example: if you issue the Command “LIST SALES”, the system will look in the dictionary of the SALES file for a data definition record named “1”. If it finds “1”, this will become the default output for column two. The system will then look for a data definition record named “2” and so until the next data definition record is not found. If “1” is not found in the file dictionary, the system will search the default dictionaries for the same sequence of data definition records.

When you issue a jQL Command, which does not contain specific references to data definition records, the system will first attempt to locate each data definition record in the dictionary of the file (or in the file specified in a USING clause). If no data definition is found in the dictionary (or the file specified in a USING clause), the system will look for the data definition in the file defined by the JEDIFILENAME_MD environment variable.

For Example: if you issue the Command “LIST SALES VALUE”, the system will look in the dictionary of the SALES file for a data definition record named “VALUE”. If it cannot find

“VALUE” in the file dictionary, the system will look in the file specified by the

JEDIFILENAME_MD environment variable. In this way, you can set up data-specific, file-specific or account-specific defaults for use with any jQL Command.

In document jql (Page 133-136)

Related documents