Features Added in FOCUS 7.7.07

In this section:

The following features were added as of FOCUS 7.7.07.

SET FLOATMAPPING: Expanded Numeric Functionality

SET FLOATMAPPING enables you to take advantage of decimal-based precision numbers available in DB2 and Oracle, and extends that functionality to all numeric processing for floating point numbers. With this processing, you gain both precision, including improved rounding, and enhanced performance.

The syntax is

SET FLOATMAPPING = {D|M|X}

where:

D

Uses the standard double-precision processing. This is the default value.

M

Uses a new internal format that provides decimal precision for double-precision floating point numbers up to 16 digits.

X

Uses a new internal format that provides decimal precision for double-precision floating point numbers up to 34 digits.

Note: If the field is passed to a HOLD file, the internal data types X or M will be propagated to the USAGE and ACTUAL formats in the HOLD Master File.

PARTITION_AGGR: Creating Rolling Calculations

How to:

Reference:

Using the PARTITION_AGGR function, you can generate rolling calculations based on a block of rows from the internal matrix of a TABLE request. In order to specify how to determine the limits of the rolling calculations, you specify a partition of the data based on either a sort field or the entire TABLE. Within either type of break, you can start calculating from the beginning of the break or a number of rows prior to the current row. You can stop the rolling calculation at the current row or the end of the partition.

By default, the field values used in the calculations are the summed values of a measure in the request. Certain prefix operators can be used to add a column to the internal matrix and use that column in the rolling calculations. The rolling calculation can be SUM, AVE, CNT, MIN, MAX, FST, or LST.

Syntax: How to Generate Rolling Calculations Using PARTITION_AGGR

PARTITION_AGGR([prefix.]measure,{sortfield|TABLE},from,to,operation)

where:

prefix.

Defines an aggregation operator to apply to the measure before using it in the rolling calculation. Valid operators are:

  • SUM. which calculates the sum of the measure field values. SUM is the default operator.
  • CNT. which calculates a count of the measure field values.
  • AVE. which calculates the average of the measure field values.
  • MIN. which calculates the minimum of the measure field values.
  • MAX. which calculates the maximum of the measure field values.
  • FST. which retrieves the first value of the measure field.
  • LST. which retrieves the last value of the measure field.

Note: The operators PCT., RPCT., TOT., MDN., and DST. are not supported. COMPUTEs that reference those unsupported operators are also not supported.

measure

Is the measure field to be aggregated. It can be a real field in the request or a calculated value generated with the COMPUTE command, as long as the COMPUTE does not reference an unsupported prefix operator.

sortfield

Is a BY or ACROSS field that defines the boundary of the partition. Operations will not cross a boundary. In the request the BY HIGHEST phrase to sort high-to-low is supported. ACROSS COLUMNS AND is also supported, but BY ROWS OVER and FOR are not supported.

Specifying TABLE as the boundary makes the partition boundary the entire internal matrix.

For example, if the sort is BY YEAR BY MONTH, with data from both 2014 and 2015, specifying the boundary as YEAR means that January 2015 - 2 will be valued as zero (0) or MISSING, as two months prior to January 2015 would cross the YEAR boundary. However, specifying TABLE as the boundary and requesting - 2 months would return the data for November 2014.

from

Identifies the starting point for the rolling calculation. Valid values are:

  • -n, which starts the calculation n rows back from the current row.
  • B, which starts the calculation at the beginning of the current sort break (the first line with the same sort field value as the current line).
to

Identifies the ending point of the rolling calculation. Valid values are:

  • C, which ends the rolling calculation at the current row in the internal matrix.
  • E, which ends the rolling calculation at the end of the sort break (the last line with the same sort value as the current row.)
operation

Specifies the rolling calculation used on the values in the internal matrix. Supported operations are:

  • SUM. which calculates a rolling sum.
  • AVE. which calculates a rolling average.
  • CNT. which counts the rows in the partition.
  • MIN. which returns the minimum value in the partition.
  • MAX, which returns the maximum value in the partition.
  • FST. which returns the first value in the partition.
  • LST. which returns the last value in the partition.

The calculation is performed prior to any WHERE TOTAL tests, but after WHERE_GROUPED tests.

Example: Calculating a Rolling Average

The following request calculates a rolling average of the current line and the previous line in the internal matrix within the quarter.

TABLE FILE WFLITE
SUM COGS_US 
COMPUTE AVE1/D12.2M = PARTITION_AGGR(COGS_US, TIME_QTR, -1, C, AVE);
BY BUSINESS_REGION
BY TIME_QTR
BY TIME_MTH
WHERE BUSINESS_REGION EQ 'North America' OR 'South America'
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image. Within each quarter, the first average is just the value from Q1, as going back 1 would cross a boundary. The second average is calculated using the first two rows within that quarter, and the third average is calculated using rows 2 and 3 within the quarter.

The following changes the rolling average to start from the beginning of the sort break.

COMPUTE AVE1/D12.2M = PARTITION_AGGR(COGS_US, TIME_QTR ,B, C, AVE);

The output is shown in the following image. Within each quarter, the first average is just the value from Q1, as going back would cross a boundary. The second average is calculated using the first two rows within that quarter, and the third average is calculated using rows 1 through 3 within the quarter.

The following command uses the partition boundary TABLE.

COMPUTE AVE1/D12.2M = PARTITION_AGGR(COGS_US, TABLE, B, C, AVE);

The output is shown in the following image. The rolling average keeps adding the next row to the average until a break in the business region sort field.

Reference: Usage Notes for PARTITION_AGGR

  • Fields referenced in the PARTITION_AGGR parameters but not previously mentioned in the request, will not be counted in column notation or propagated to HOLD files.
  • Using the WITHIN phrase for a sum is the same as computing PARTITION_AGGR on the WITHIN sort field from B (beginning of sort break) to E (end of sort break) using SUM, as in the following example.
    TABLE FILE WFLITE
    SUM COGS_US WITHIN TIME_QTR AS 'WITHIN Qtr'
    COMPUTE PART_WITHIN_QTR/D12.2M = PARTITION_AGGR(COGS_US, TIME_QTR, B, E, SUM); 
    BY BUSINESS_REGION AS Region
    BY TIME_QTR
    BY TIME_MTH
    WHERE BUSINESS_REGION EQ 'North America' OR 'South America'
    ON TABLE SET PAGE NOPAGE
    END

    The output is shown in the following image.

    With other types of calculations, the results are not the same. For example, the following request calculates the average within quarter using the WITHIN phrase and the average with quarter using PARTITION_AGGR.

    TABLE FILE WFLITE
    SUM  COGS_US AS Cost 
    CNT.COGS_US AS Count AVE.COGS_US WITHIN TIME_QTR AS 'Ave Within'
    COMPUTE PART_WITHIN_QTR/D12.2M = PARTITION_AGGR(COGS_US, TIME_QTR, B, E, AVE); 
    BY BUSINESS_REGION AS Region
    BY TIME_QTR 
    ON TIME_QTR SUBTOTAL COGS_US CNT.COGS_US
    BY TIME_MTH
    WHERE BUSINESS_REGION EQ 'North America'
    ON TABLE SET PAGE NOPAGE
    END

    The output is shown in the following image. The average using the WITHIN phrase divides the total cost for the quarter by the total count of instances for the quarter (for example, $435,992.00/1514 =$287.97), while PARTITION_AGGR divides the total cost for the quarter by the number of report rows in the quarter (for example, $435,992.00/3 = $145,330.67).

  • If you use PARTITION_AGGR to perform operations for specific time periods using an offset, for example, an operation on the quarters for different years, you must make sure that every quarter is represented. If some quarters are missing for some years, the offset will not access the correct data. In this case, generate a HOLD file that has every quarter represented for every year (you can use BY QUARTER ROWS OVER 1 OVER 2 OVER 3 OVER 4) and use PARTITION_AGGR on the HOLD file.

PARTITION_REF: Using Prior Field Values in Calculations

How to:

Reference:

Use of LAST in a calculation retrieves the LAST value of the specified field the last time this calculation was performed. The PARTITION_REF function enables you to specify both how many rows back to go in order to retrieve a prior value, and a sort break within which the prior value calculation will be contained.

Syntax: How to Retrieve Prior Field Values for Use in a Calculation

PARTITION_REF([prefix.]field, {sortfield|TABLE}, -offset)

where:

prefix

Is optional. If used, it can be one of the following aggregation operators:

  • AVE. Average
  • MAX. Maximum
  • MIN. Minimum
  • CNT. Count
  • SUM. Sum
field

Is the field whose prior value is to be retrieved.

{srtfield|TABLE}

Is the sort break within which to go back to retrieve the value. TABLE means retrieve the value without regard to sort breaks. Operations will not cross a partition boundary.

The Sort field may use BY HIGHEST to indicate a HIGH-TO-LOW sort. ACROSS COLUMNS AND is supported. BY ROWS OVER and FOR are not supported.

-offset

Is the integer number of records back to go to retrieve the value.

If the offset is prior to the partition boundary sort value, the return will be the default value for the field. The calculation is performed prior to any WHERE TOTAL tests, but after WHERE_GROUPED tests.

Example: Retrieving a Previous Record With PARTITION_REF

The following request retrieves the previous record within the sort field PRODUCT_CATEGORY.

TABLE FILE WFLITE
SUM DAYSDELAYED
COMPUTE NEWDAYS/I5=PARTITION_REF(DAYSDELAYED, PRODUCT_CATEGORY, -1);
BY PRODUCT_CATEGORY
BY PRODUCT_SUBCATEG
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image. The first value within each sort break is zero because there is no prior record to retrieve.

The following request retrieves the average cost of goods from two records prior to the current record within the PRODUCT_CATEGORY sort field.

TABLE FILE WFLITE
SUM COGS_US AVE.COGS_US AS Average
COMPUTE PartitionAve/D12.2M=PARTITION_REF(AVE.COGS_US, PRODUCT_CATEGORY, -2);
BY PRODUCT_CATEGORY
BY PRODUCT_SUBCATEG
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

Replacing the function call with the following syntax changes the partition boundary to TABLE.

COMPUTE PartitionAve/D12.2M=PARTITION_REF(AVE.COGS_US, TABLE, -2);

The output is shown in the following image.

Reference: Usage Notes for PARTITION_REF

  • Fields referenced in the PARTITION_REF parameters but not previously mentioned in the request, will not be counted in column notation or propagated to HOLD files.

Limiting the Number of Stacked Commands and Loop Iterations

How to:

As FOCUS commands are encountered in a procedure, they are placed on a stack in memory (called FOCSTACK). The procedure is executed and the stack counter reset to zero (0) as a result a -RUN command, certain system variables, or the end of the procedure.

The parameter DMH_STACKLIM sets the maximum number of lines allowed in the FOCSTACK. This parameter is designed to prevent runaway tasks that generate a FOCSTACK that uses an inordinate amount of memory.

If users are not careful in designing loops in Dialogue Manager, they can inadvertently cause an infinite looping condition.

The parameter DMH_LOOPLIM sets the maximum number of Dialogue Manager loop iterations allowed, using -REPEAT or -GOTO commands.

DMH_STACKLIM and DMH_LOOPLIM should be set high enough to run your existing reports and procedures without error for your entire session. It is recommended that if you set these parameters, you should set them in a profile.

Syntax: How to Limit the Number of Stacked Commands

SET DMH_STACKLIM = n

where:

n

Sets the maximum number of lines allowed in FOCSTACK. The default value is zero (0), which does not limit the number of stacked commands.

Syntax: How to Limit the Number of Loop Iterations

SET DMH_LOOPLIM = n

where:

n

Sets the maximum number of loop iterations allowed. The default value is zero (0), which does not limit the number of loop iterations.

Controlling Processing of Delimited Files

The SET PCOMMA=DFIX command causes delimited files with SUFFIX=COM, COMT, TAB, and TABT to be processed through the Adapter for DFIX. This processing provides more complete and meaningful messages and some changes to the processing of missing values when two delimiters in a row are encountered. With DFIX processing, a missing value is assigned to the field.

In order to be eligible for DFIX processing, the delimited file must satisfy the following requirements.

Start of Week Parameter for the DTRUNC Function

Given a date or date-time value and a time period, the DTRUNC function returns the date that is the beginning of that period. The parameter WEEK has been added, which returns the date that represents the first date of the given week. By default, the first day will be Sunday, but this can be changed using the WEEKFIRST parameter.

Example: Using the Start of Week Parameter for DTRUNC

The following request returns the date that is the start of the week for the start date of certain employees:

DEFINE FILE WFLITE
DAY1/WT = DTRUNC(START_DATE, DAY); 
WKSTART/YYMD = DTRUNC(START_DATE, WEEK);
DAY2/WT = DTRUNC(WKSTART, DAY); 
END
TABLE FILE WFLITE
PRINT START_DATE 
DAY1 AS 'DOW 1'
WKSTART AS 'Start,of Week'
DAY2 AS 'DOW 2'
BY EMPLOYEE_NUMBER
WHERE START_DATE GT '20130101'
WHERE EMPLOYEE_NUMBER CONTAINS 'AH'
ON TABLE SET PAGE NOPAGE
END

The output is:

  Employee      Start              Start
  Number        Date        DOW 1  of Week     DOW 2
  --------      -----       -----  -------     -----
  AH118         2013/01/15  TUE    2013/01/13  SUN
  AH2272        2013/01/17  THU    2013/01/13  SUN
  AH288         2013/11/11  MON    2013/11/10  SUN
  AH3520        2013/09/23  MON    2013/09/22  SUN
  AH3591        2013/09/22  SUN    2013/09/22  SUN
  AH5177        2013/07/21  SUN    2013/07/21  SUN

Function DTRUNC Returns the Last Day of a Calendar Period

Given a date or timestamp and a component, DTRUNC returned the first date within the period specified by that component.

The following components have been added that return the last date within the period specified by the component.

This function is available in both FOCUS and SQL.

Note: You can change which day is considered the first day of the week using the WEEKFIRST parameter. By default, it is Sunday.

Example: Returning the Date of the First and Last Days of a Week

The following request returns the dates that corresponds to the first day of the week and the last day of the week for the given date.

DEFINE FILE WFLITE
WEEKSTART/YYMD = DTRUNC(START_DATE, WEEK); 
WEEKEND/YYMD = DTRUNC(START_DATE, WEEK_END); 
END
TABLE FILE WFLITE
PRINT START_DATE WEEKSTART AS 'Start,of Week'
WEEKEND AS 'End,of Week'
BY EMPLOYEE_NUMBER 
WHERE EMPLOYEE_NUMBER CONTAINS 'AH1'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

Simplified Numeric Functions

In this section:

New numeric functions have been developed that make it easier to understand and enter the required arguments. These functions have streamlined parameter lists, similar to those used by SQL functions. In some cases, these simplified functions provide slightly different functionality than previous versions of similar functions.

The simplified functions do not have an output argument. Each function returns a value that has a specific data type.

When used in a request against a relational data source, these functions are optimized (passed to the RDBMS for processing).

Note:

CEILING: Returning the Smallest Integer Value Greater Than or Equal to a Value

How to:

CEILING returns the smallest integer value that is greater than or equal to a number.

Syntax: How to Return the Smallest Integer Greater Than or Equal to a Number

CEILING(number) 

where:

number

Numeric

Is the number whose ceiling will be returned. The output data type is the same as the input data type.

Example: Returning the Ceiling of a Number

In the following request, CEILING returns the smallest integer greater than or equal to the GROSS_PROFIT_US value.

DEFINE FILE WFLITE
CEIL1/D7.2= CEILING(GROSS_PROFIT_US);
END
TABLE FILE WFLITE
PRINT GROSS_PROFIT_US/D9.2  CEIL1
ON TABLE SET PAGE NOPAGE
END

The partial output follows. Note that even though the value returned is an integer, it is returned with the same format as the CEIL1 field (D7.2):

  Gross Profit     CEIL1      
  ------------     -----     
        165.00    165.00
         13.99     14.00
         60.99     61.00
        225.98    226.00
         79.99     80.00
         44.59     45.00
         94.30     95.00
        238.50    239.00
        199.99    200.00
         68.99     69.00
         63.58     64.00
        129.99    130.00
         37.49     38.00
         75.99     76.00
         13.99     14.00
        119.00    119.00
        -30.01    -30.00
         54.99     55.00
        189.98    190.00
         44.59     45.00
         91.98     92.00
         89.00     89.00
         59.50     60.00
        129.99    130.00
         54.00     54.00
        109.98    110.00
         98.99     99.00
         98.99     99.00
         99.99    100.00
         44.59     45.00

EXPONENT: Raising e to a Power

How to:

EXPONENT raises the constant e to a power.

Syntax: How to Raise the Constant e to a Power

EXPONENT(power)

where:

power

Numeric

Is the power to which to raise e. The output data type is numeric.

Example: Raising e to a Power

The following request prints the value of e and the value of e raised to the fifth power.

DEFINE FILE WFLITE
EXP1/D12.5 = EXPONENT(1);
EXP2/D12.5 = EXPONENT(5);
END
TABLE FILE WFLITE
PRINT EXP1 EXP2
BY BUSINESS_REGION AS Region
WHERE BUSINESS_REGION EQ 'EMEA'
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

FLOOR: Returning the Largest Integer Less Than or Equal to a Value

How to:

FLOOR returns the largest integer value that is less than or equal to a number.

Syntax: How to Return the Largest Integer Less Than or Equal to a Number

FLOOR(number) 

where:

number

Numeric

Is the number whose floor will be returned. The output data type is the same as the input data type.

Example: Returning the Floor of a Number

In the following request, FLOOR returns the largest integer less than or equal to the GROSS_PROFIT_US value.

DEFINE FILE WFLITE
FLOOR1/D7.2= FLOOR(GROSS_PROFIT_US);
END
TABLE FILE WFLITE
PRINT GROSS_PROFIT_US/D9.2  FLOOR1
ON TABLE SET PAGE NOPAGE
END

Partial output follows. Note that even though the value returned is an integer, it is returned with the same format as the FLOOR1 field (D7.2):

  Gross Profit    FLOOR1       
  ------------    ------           
        165.00    165.00
         13.99     13.00
         60.99     60.00
        225.98    225.00
         79.99     79.00
         44.59     44.00
         94.30     94.00
        238.50    238.00
        199.99    199.00
         68.99     68.00
         63.58     63.00
        129.99    129.00
         37.49     37.00
         75.99     75.00
         13.99     13.00
        119.00    119.00
        -30.01    -31.00
         54.99     54.00
        189.98    189.00
         44.59     44.00
         91.98     91.00
         89.00     89.00
         59.50     59.00
        129.99    129.00
         54.00     54.00
        109.98    109.00
         98.99     98.00
         98.99     98.00
         99.99     99.00
         44.59     44.00

MOD: Calculating the Remainder From a Division

How to:

MOD calculates the remainder from a division. The output data type is the same as the input data type.

Syntax: How to Calculate the Remainder From a Division

MOD(dividend, divisor)

where:

dividend

Numeric

Is the value to divide.

divisor

Numeric

Is the value to divide by.

If the divisor is zero (0), the dividend is returned.

Example: Calculating the Remainder From a Division

In the following request, MOD returns the remainder of PRICE_DOLLARS divided by DAYSDELAYED:

DEFINE FILE WFLITE
MOD1/D7.2= MOD(PRICE_DOLLARS, DAYSDELAYED);
END
TABLE FILE WFLITE
PRINT PRICE_DOLLARS/D7.2  DAYSDELAYED/I5 MOD1
WHERE DAYSDELAYED GT 1
ON TABLE SET PAGE NOPAGE
ON TABLE PCHOLD FORMAT WP
END

Partial output follows:

Price    Days                      
   Dollars  Delayed      MOD1                 
   -------  -------      ----                                                                                                     
    399.00        3       .00
    489.99        3       .99
    786.50        2       .50
    599.99        4      3.99
     29.99        4      1.99
    169.00        2      1.00
    219.99        2      1.99
    280.00        3      1.00
     79.99        4      3.99
    145.99        2      1.99
    399.99        3       .99
    349.99        3      1.99
    169.00        3      1.00

POWER: Raising a Value to a Power

How to:

POWER raises a base value to a power.

Syntax: How to Raise a Value to a Power

POWER(base, power)

where:

base

Numeric

Is the value to raise to a power. The output value has the same data type as the base value. If the base value is integer, negative power values will result in truncation.

power

Numeric

Is the power to which to raise the base value.

Example: Raising a Base Value to a Power

In the following request, POWER returns the value COGS_US/20.00 raised to the power stored in DAYSDELAYED:

DEFINE FILE WFLITE
BASE=COGS_US/20.00;
POWER1= POWER(COGS_US/20.00,DAYSDELAYED);
END
TABLE FILE WFLITE
PRINT BASE IN 15 DAYSDELAYED POWER1
BY PRODUCT_CATEGORY
WHERE PRODUCT_CATEGORY EQ 'Computers'
WHERE DAYSDELAYED NE 0
ON TABLE SET PAGE NOPAGE
END

Partial output follows:

  Product                              Days         
  Category                BASE         Delayed          POWER1  
  --------                ----         -------          ------  
  Computers              12.15               3        1,793.61
                         16.70               2          278.89
                          8.35               1            8.35
                          8.10               2           65.61
                          4.05               1            4.05
                          4.05               2           16.40
                          4.05               4          269.04
                          8.35               1            8.35
                         16.70               1           16.70
                          8.35               3          582.18
                          8.35               1            8.35
                          4.05               1            4.05
                          4.05               1            4.05
                          8.35               4        4,861.23
                          8.35              -1             .12
                          8.35               1            8.35
                          8.35               3          582.18

Simplified Character Functions

In this section:

New simplified character functions CONCAT, REGEX, REPLACE, and SPLIT functions have been added.

LAST_NONBLANK: Retrieving the Last Field Value That is Neither Blank nor Missing

How to:

LAST_NONBLANK retrieves the last field value that is neither blank nor missing. If all previous values are either blank or missing, LAST_NONBLANK returns a missing value.

Syntax: How to Return the Last Value That is Neither Blank nor Missing

LAST_NONBLANK(field)

where:

field

Is the field name whose last non-blank value is to be retrieved. If the current value is not blank or missing, the current value is returned.

Note: LAST_NONBLANK cannot be used in a compound expression, for example, as part of an IF condition.

Example: Retrieving the Last Non-Blank Value

The following request shows the SALARY field, the LAST_NONBLANK value from a DEFINE, and the LAST_NONBLANK value from a COMPUTE.

DEFINE FILE EMPLOYEE
MYSAL/I5 MISSING ON=IF DEPARTMENT EQ 'MIS' THEN SALARY ELSE MISSING;
LAST_NONBLANK1/I5 MISSING ON= LAST_NONBLANK(MYSAL);
END
TABLE FILE EMPLOYEE
PRINT LAST_NAME MYSAL  LAST_NONBLANK1
COMPUTE LAST_NONBLANK2/I5 MISSING ON=LAST_NONBLANK(MYSAL);
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
END

The output is shown in the following image.

REGEX: Matching a String to a Regular Expression

How to:

The REGEX function matches a string to a regular expression and returns true (1) if it matches and false (0) if it does not match.

A regular expression is a sequence of special characters and literal characters that you can combine to form a search pattern.

Many references for regular expressions exist on the web.

Syntax: How to Match a String to a Regular Expression

REGEX(string, regular_expression)

where:

string

Alphanumeric

Is the character string to match.

regular_expression

Alphanumeric

Is a regular expression enclosed in single quotation marks (') constructed using literals and metacharacters. The following metacharacters are supported

  • . represents any single character
  • * represents zero or more occurrences
  • + represents one or more occurrences
  • ? represents zero or one occurrence
  • ^ represents beginning of line
  • $ represents end of line
  • [] represents any one character in the set listed within the brackets
  • [^] represents any one character not in the set listed within the brackets
  • | represents the Or operator
  • \ is the Escape Special Character
  • () contains a character sequence

For example, the regular expression '^Ste(v|ph)en$' matches values starting with Ste followed by either ph or v, and ending with en.

Note: The output value is numeric.

Example: Matching a String Against a Regular Expression

The following request matches the FIRSTNAME field against the regular expression '^Sara(h?)$', which matches Sara or Sarah:

TABLE FILE WFLITE
PRINT FIRSTNAME AND COMPUTE
REG1/I1=REGEX(FIRSTNAME,'^Sara(h?)$') ;
BY LASTNAME/A10
WHERE LASTNAME EQ 'Allen'
END

The output is

              First           
  LASTNAME    Name                  REG1    
  --------    -----                 ----           
  Allen       Penny                    0
              Rosemary                 0
              Amber                    0
              Julie                    0
              Sarah                    1
              Leo                      0
              Margret                  0
              Donna                    0
              Damian                   0
              Alexander                0
              Diego                    0
              Amber                    0
              Susan                    0
              Amber                    0
              Sara                     1
              Sara                     1

CONCAT: Concatenating Strings After Removing Trailing Blanks From the First

How to:

CONCAT removes trailing blanks from a string and then concatenates another string to it. The output is returned as variable length alphanumeric.

Syntax: How to Concatenate Strings After Removing Trailing Blanks From the First

CONCAT(string1, string2)

where:

string2

Alphanumeric

Is a string whose trailing blanks will be removed.

string1

Alphanumeric

Is a string whose leading and trailing blanks will be preserved.

Example: Concatenating Strings After Removing Blanks From the First

The following request concatenates city names with state names. Note that the city and state names are converted to fixed length alphanumeric fields before concatenation.

DEFINE FILE WFLITE
CITY/A50 = CITY_NAME;
STATE/A50 = STATE_PROV_NAME;
CONCAT_CS/A100 = CONCAT(CITY,STATE);
END  
 
TABLE FILE WFLITE
SUM CITY AS City STATE AS State CONCAT_CS AS Concatenation
BY STATE_PROV_NAME NOPRINT
WHERE COUNTRY_NAME EQ 'United States'
WHERE STATE LE 'Louisiana'
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

REPLACE: Replacing a String

How to:

REPLACE replaces all instances of a search string in an input string with the given replacement string. The output is always variable length alphanumeric with a length determined by the input parameters.

Syntax: How to Replace all Instances of a String

REPLACE(input_string , search_string , replacement)

where:

input_string

Alphanumeric or text (An, AnV, TX)

Is the input string.

search_string

Alphanumeric or text (An, AnV, TX)

Is the string to search for within the input string.

replacement

Alphanumeric or text (An, AnV, TX)

Is the replacement string to be substituted for the search string. It can be a null string ('').

Example: Replacing a String

REPLACE replaces the string 'South' in the Country Name with the string 'S.'

SET TRACEUSER = ON 
SET TRACEON = STMTRACE//CLIENT
SET TRACESTAMP=OFF
DEFINE FILE WFLITE
NEWNAME/A20 = REPLACE(COUNTRY_NAME, 'SOUTH', 'S.');
END
TABLE FILE WFLITE
SUM COUNTRY_NAME
BY NEWNAME AS 'New,Name'
WHERE COUNTRY_NAME LIKE 'S%'
ON TABLE SET PAGE NOLEAD
END

The generated SQL passes the REPLACE function to the DBMS REPLACE function.

SELECT   
REPLACE(T3."COUNTRY_NAME",'SOUTH','S.'),  
MAX(T3."COUNTRY_NAME")  
FROM   
wrd_wf_retail_geography T3  
WHERE   
(T3."COUNTRY_NAME" LIKE 'S%')  
GROUP BY   
REPLACE(T3."COUNTRY_NAME",'SOUTH','S.')  
ORDER BY   
REPLACE(T3."COUNTRY_NAME",'SOUTH','S.'); 

The output is shown in the following image.

Example: Replacing All Instances of a String

In the following request, the virtual field DAYNAME1 is the string DAY1 with all instances of the string 'DAY' replaced with the string 'day'. The virtual field DAYNAME2 has all instances of the string 'DAY' removed.

DEFINE FILE WFLITE
DAY1/A30 = 'SUNDAY MONDAY TUESDAY';
DAYNAME1/A30 = REPLACE(DAY1, 'DAY', 'day' );
DAYNAME2/A30 = REPLACE(DAY1, 'DAY', '' );
END
TABLE FILE WFLITE
PRINT DAY1 OVER
DAYNAME1 OVER
DAYNAME2
WHERE EMPLOYEE_NUMBER EQ 'AH118' 
ON TABLE SET PAGE NOPAGE
END

The output is:

  DAY1      SUNDAY MONDAY TUESDAY         
  DAYNAME1  SUNday MONday TUESday         
  DAYNAME2  SUN MON TUES                  

SPLIT: Extracting an Element From a String

How to:

The SPLIT function returns a specific type of element from a string. The output is returned as variable length alphanumeric.

Syntax: How to Extract an Element From a String

SPLIT(element, string)

where:

element

Can be one of the following keywords:

  • EMAIL_DOMAIN. Is the domain name portion of an email address in the string.
  • EMAIL_USERID. Is the user ID portion of an email address in the string.
  • URL_PROTOCOL. Is the URL protocol in the string.
  • URL_HOST. Is the host name of the URL in the string.
  • URL_PORT. Is the port number of the URL in the string.
  • URL_PATH. Is the URL path in the string.
  • NAME_FIRST. Is the first token (group of characters) in the string. Tokens are delimited by blanks.
  • NAME_LAST. Is the last token (group of characters) in the string. Tokens are delimited by blanks.
string

Alphanumeric

Is the string from which the element will be extracted.

Example: Extracting an Element From a String

The following request defines strings and extracts elements from them.

DEFINE FILE WFLITE
STRING1/A50 WITH COUNTRY_NAME= 'http://www.informationbuilders.com';
STRING2/A20 = 'user1@ibi.com';
STRING3/A20 = 'Louisa May Alcott';
Protocol/A20 = SPLIT(URL_PROTOCOL, STRING1);
Path/A50 = SPLIT(URL_PATH, STRING1);
Domain/A20 = SPLIT(EMAIL_DOMAIN, STRING2);
User/A20 =  SPLIT(EMAIL_USERID, STRING2);
First/A10 = SPLIT(NAME_FIRST, STRING3);
Last/A10 = SPLIT(NAME_LAST, STRING3);
END
TABLE FILE WFLITE
SUM Protocol Path User Domain First Last
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

CHECKMD5: Computing an MD5 Hash Check Value

How to:

CHECKMD5 takes an alphanumeric input value and returns a 128-bit value in a fixed length alphanumeric string, using the MD5 hash function. A hash function is any function that can be used to map data of arbitrary size to data of fixed size. The values returned by a hash function are called hash values. They can be used for assuring the integrity of transmitted data.

Syntax: How to Compute an MD5 Hash Check Value

CHECKMD5(buffer)

where:

buffer

Is a data buffer whose hash value is to be calculated. It can be a set of data of different types presented as a single field, or a group field in one of the following data type formats: An, AnV, or TXn.

Example: Calculating an MD5 Hash Check Value

The following request calculates an MD5 hash check value and converts it to an alphanumeric hexadecimal value for display.

DEFINE FILE WFLITE
MD5/A32 = HEXTYPE(CHECKMD5(PRODUCT_CATEGORY));
END
TABLE FILE WFLITE
SUM MD5 
BY PRODUCT_CATEGORY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,FONT=COURIER,$
 ENDSTYLE
END

The output is shown in the following image. The monospaced font shows that although the input values have varying length, the output has a fixed length.

CHECKSUM: Computing a Hash Sum

How to:

CHECKSUM computes a hash sum, called the checksum, of its input parameter, as a whole number in format I11. This can be used for equality search of the fields. A checksum is a hash sum used to ensure the integrity of a file after it has been transmitted from one storage device to another.

Syntax: How to Compute a CHECKSUM Hash Value

CHECKSUM(buffer)

where:

buffer

Is a data buffer whose hash index is to be calculated. It can be a set of data of different types presented as a single field, in one of the following data type formats: An, AnV, or TXn.

Example: Calculating a CHECKSUM Hash Value

The following request computes a checksum hash value.

DEFINE FILE WFLITE
CHKSUM/I11 = (CHECKSUM(PRODUCT_CATEGORY));
END
TABLE FILE WFLITE
PRINT CHKSUM
BY PRODUCT_CATEGORY
WHERE PRODUCT_CATEGORY NE LAST PRODUCT_CATEGORY
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

Simplified Conversion Functions

In this section:

New simplified conversion functions CHAR, CTRL_CHAR, EDIT2, HEXTYPE, TO_INTEGER, and TO_NUMBER have been added.

CHAR: Returning a Character Based on a Numeric Code

How to:

The CHAR function accepts a decimal integer and returns the character identified by that number converted to ASCII or EBCDIC, depending on the operating environment. The output is returned as variable length alphanumeric. If the number is above the range of valid characters, a null is returned.

Syntax: How to Return a Character Based on a Numeric Code

CHAR(number_code)

where:

number_code

Integer

Is a field, number, or numeric expression whose whole absolute value will be used as a number code to retrieve an output character.

For example, a TAB character is returned by CHAR(9) in ASCII environments, or by CHAR(5) in EBCDIC environments.

Example: Using the CHAR Function to Insert Control Characters Into a String

The following request defines a field with carriage return (CHAR(13)) and line feed (CHAR(10)) characters inserted between the words HELLO and GOODBYE (in an ASCII environment). To show that these characters were inserted, the output is generated in PDF format and the StyleSheet attribute LINEBREAK='CRLF' is used to have these characters respected and print the field value on two lines.

DEFINE FILE WFLITE
MYFIELD/A20 WITH COUNTRY_NAME='HELLO' | CHAR(13) | CHAR(10) | 'GOODBYE';
END
TABLE FILE WFLITE
SUM MYFIELD 
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,LINEBREAK='CRLF',$
ENDSTYLE
END

The output is shown in the following image.

CTRLCHAR: Returning a Non-Printable Control Character

How to:

The CTRLCHAR function returns a nonprintable control character specific to the running operating environment, based on a supported list of keywords. The output is returned as variable length alphanumeric.

Syntax: How to Return a Non-Printable Control Character

CTRLCHAR(ctrl_char)

where:

ctrl_char

Is one of the following keywords.

  • NUL returns a null character.
  • SOH returns a start of heading character.
  • STX returns a start of text character.
  • ETX returns an end of text character.
  • EOT returns an end of transmission character.
  • ENQ returns an enquiry character.
  • ACK returns an acknowledge character.
  • BEL returns a bell or beep character.
  • BS returns a backspace character.
  • TAB or HT returns a horizontal tab character.
  • LF returns a line feed character.
  • VT returns a vertical tab character.
  • FF returns a form feed (top of page) character.
  • CR returns a carriage control character.
  • SO returns a shift out character.
  • SI returns a shift in character.
  • DLE returns a data link escape character.
  • DC1 or XON returns a device control 1 character.
  • DC2 returns a device control 2 character.
  • DC3 or XOFF returns a device control 3 character.
  • DC4 returns a device control 4 character.
  • NAK returns a negative acknowledge character.
  • SYN returns a synchronous idle character.
  • ETB returns an end of transmission block character.
  • CAN returns a cancel character.
  • EM returns an end of medium character.
  • SUB returns a substitute character.
  • ESC returns an escape, prefix, or altmode character.
  • FS returns a file separator character.
  • GS returns a group separator character.
  • RS returns a record separator character.
  • US returns a unit separator character.
  • DEL returns a delete, rubout, or interrupt character.
Example: Using the CTRLCHAR Function to Insert Control Characters Into a String

The following request defines a field with carriage return (CTRLCHAR(CR)) and line feed (CTRLCHAR(LF)) characters inserted between the words HELLO and GOODBYE. To show that these characters were inserted, the output is generated in PDF format and the StyleSheet attribute LINEBREAK='CRLF' is used to have these characters respected and print the field value on two lines.

DEFINE FILE WFLITE
MYFIELD/A20 WITH COUNTRY_NAME='HELLO' | CTRLCHAR(CR) | CTRLCHAR(LF) | 'GOODBYE';
END 
TABLE FILE WFLITE
SUM MYFIELD 
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,LINEBREAK='CRLF',$
ENDSTYLE
END

The output is shown in the following image.

EDIT2: Converting a Numeric, Date, or Date-Time Value to a Character String

How to:

The EDIT2 function converts a numeric, date, or date-time value to a character string based on a specified format. The format must be valid for the data supplied. The output is returned as variable length alphanumeric.

Syntax: How to Convert a Numeric, Date, or Date_Time Value to a Character String

EDIT2(in_value, 'format')

where:

in_value

Numeric, date, or date-time

Is any numeric value or a date in either standard date or date-time format. If the date is given in standard date format, all of its time components are assumed to be zero.

'format'

Is a numeric, date, or date-time format enclosed in single quotation marks (').

Example: Converting a Date to a Character String

The following request defines a date field as YYMD format and converts it to a character string (CharDate) in YYMtrD format.

DEFINE FILE WFLITE
DATE1/YYMD = TIME_DATE_DAY_COMPONENT;
CharDate/A20 = EDIT2(DATE1,'YYMtrD');
END
TABLE FILE WFLITE
SUM COGS_US
BY CharDate
WHERE TIME_MTHNAME  EQ 'FEB'
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

HEXTYPE: Returning the Hexadecimal View of an Input Value

How to:

The HEXTYPE function returns the hexadecimal view of an input value of any data type. The result is returned as variable length alphanumeric. The alphanumeric field to which the hexidecimal value is returned must be large enough to hold two characters for each input character. The value returned depends on the running operating environment.

Syntax: How to Returning the Hexadecimal View of an Input Value

HEXTYPE(in_value)

where:

in_value

Is an alphanumeric or integer field, constant, or expression.

Example: Returning a Hexadecimal View

The following request returns a hexadecimal view of the country names and the sum of the days delayed.

DEFINE FILE WFLITE
Days/I8 = DAYSDELAYED;
Country/A20 = COUNTRY_NAME;
HexCountry/A30 = HEXTYPE(Country);
END
TABLE FILE WFLITE
SUM COUNTRY_NAME NOPRINT  Country HexCountry Days
COMPUTE HexDays/A40 = HEXTYPE(Days);
BY COUNTRY_NAME NOPRINT
WHERE COUNTRY_NAME LT 'P'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

PHONETIC: Returning a Phonetic Key for a String

PHONETIC calculates a phonetic key for a string, or a null value on failure. Phonetic keys are useful for grouping alphanumeric values, such as names, that may have spelling variations. This is done by generating an index number that will be the same for the variations of the same name based on pronunciation. One of two phonetic algorithms can be used for indexing, Metaphone and Soundex. Metaphone is the default algorithm, except on z/OS where the default is Soundex.

You can set the algorithm to use with the following command.

SET PHONETIC_ALGORITHM = {METAPHONE|SOUNDEX}

Most phonetic algorithms were developed for use with the English language. Therefore, applying the rules to words in other languages may not give a meaningful result.

Metaphone is suitable for use with most English words, not just names. Metaphone algorithms are the basis for many popular spell checkers.

Note: Metaphone is not optimized in generated SQL. Therefore, if you need to optimize the request for an SQL DBMS, the SOUNDEX setting should be used.

Soundex is a legacy phonetic algorithm for indexing names by sound, as pronounced in English.

Reference: Return a Phonetic Key

PHONETIC(string)

where:

string

Alphanumeric

Is a string for which to create the key. A null value will be returned on failure.

Example: Generating a Phonetic Key

The following request changes the spelling of the last name for MARY SMITH to SMYTHE and generates a phonetic key for each last name.

DEFINE FILE EMPLOYEE
LAST_NAME2/A16 = IF LAST_NAME EQ 'SMITH' AND FIRST_NAME EQ 'MARY' THEN 'SMYTHE' ELSE LAST_NAME;
PKEY/A10 = PHONETIC(LAST_NAME2);
END
TABLE FILE EMPLOYEE
PRINT FIRST_NAME LAST_NAME2 
BY PKEY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image. Note that the two spellings for SMITH are assigned the same index number.

TO_INTEGER: Converting a Character String to an Integer Value

TO_INTEGER converts a character string that contains a valid number consisting of digits and an optional decimal point to an integer value. If the value contains a decimal point, the value after the decimal point is truncated. If the value does not represent a valid number, zero (0) is returned.

Reference: Convert a Character String to an Integer

TO_INTEGER(string)

where:

string
Is a character string enclosed in single quotation marks or a character field that represents a number containing digits and an optional decimal point.
Example: Converting a Character String to an Integer Value

The following request converts character strings to integers. Digits following the decimal point are truncated.

DEFINE FILE WFLITE
INT1/I8 = TO_INTEGER('56.78');
INT2/I8 = TO_INTEGER('.5678');
INT3/I8 = TO_INTEGER('5678');
END
TABLE FILE WFLITE
PRINT INT1 INT2 INT3
BY BUSINESS_REGION AS Region
WHERE READLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.

TO_NUMBER: Converting a Character String to a Numeric Value

TO_NUMBER converts a character string that contains a valid number consisting of digits and an optional decimal point to the numeric format most appropriate to the context. If the value does not represent a valid number, zero (0) is returned.

Reference: Convert a Character String to a Number

TO_NUMBER(string)

where:

string
Is a character string enclosed in single quotation marks or a character field that represents a number containing digits and an optional decimal point. This string will be converted to a double-precision floating point number.
Example: Converting a Character String to a Number

The following request converts character strings to double-precision floating point numbers.

DEFINE FILE WFLITE
NUM1/D12.1 = TO_NUMBER('56.78');
NUM2/D12.2 = TO_NUMBER('0.5678');
END
TABLE FILE WFLITE
PRINT NUM1 NUM2
BY BUSINESS_REGION AS Region
WHERE READLIMIT EQ 1
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.

Simplified Date Functions

In this section:

The new simplified date functions DT_CURRENT_DATE, DT_CURRENT_DATETIME, and DT_CURRENT_TIME have been added.

DT_CURRENT_DATE: Returning the Current Date

How to:

The DT_CURRENT_DATE function returns the current date-time provided by the running operating environment in date-time format. The time portion of the datetime is set to zero.

Syntax: How to Return the Current Date

DT_CURRENT_DATE()
Example: Returning the Current Date

The following request returns the current date.

DEFINE FILE WFLITE
CURRDATE/YYMD WITH COUNTRY_NAME = DT_CURRENT_DATE();
END
TABLE FILE WFLITE
SUM CURRDATE
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

DT_CURRENT_DATETIME: Returning the Current Date and Time

How to:

DT_CURRENT_DATETIME returns the current date and time provided by the running operating environment in date-time format, with a specified time precision.

Syntax: How to Return the Current Date and Time

DT_CURRENT_DATETIME(component)

where:

component

Is one of the following time precisions.

  • SECOND.
  • MILLISECOND.
  • MICROSECOND

Note: The field to which the value is returned must have a format that supports the time precision requested.

Example: Returning the Current Date and Time

The following request returns the current date and time, with the time specified in microseconds.

DEFINE FILE WFLITE
CURRDATE/HYYMDm WITH COUNTRY_NAME = DT_CURRENT_DATETIME(MICROSECOND);
END
TABLE FILE WFLITE
SUM CURRDATE
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

DT_CURRENT_TIME: Returning the Current Time

How to:

The DT_CURRENT_TIME function returns the current time provided by the running operating environment in date-time format, with a specified time precision. The date portion of the returned date-time value is set to zero.

Syntax: How to Return the Current Time

DT_CURRENT_TIME(component)

where:

component

Is one of the following time precisions.

  • SECOND.
  • MILLISECOND.
  • MICROSECOND

Note: The field to which the value is returned must have a format that supports the time precision requested.

Example: Returning the Current Time

The following request returns the current time, with the time precision set to milliseconds.

DEFINE FILE WFLITE
CURRTIME/HHISs WITH COUNTRY_NAME = DT_CURRENT_TIME(MILLISECOND);
END
TABLE FILE WFLITE
SUM CURRTIME
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

Simplified System Functions

In this section:

Simplified system functions ENCRYPT, GETENV, and PUTENV have been added.

ENCRYPT: Encrypting a Password

How to:

The ENCRYPT function encrypts an alphanumeric input value using the encryption algorithm configured in FOCUS. The result is returned as variable length alphanumeric.

Syntax: How to Encrypt a Password

ENCRYPT(password)

where:

password

Fixed length alphanumeric

Is the value to be encrypted.

Example: Encrypting a Password

The following request encrypts the value guestpassword using the encryption algorithm configured in FOCUS.

-SET &P1 = ENCRYPT('guestpassword');
-TYPE &P1

The returned encrypted value is {AES}963AFA754E1763ABE697E8C5E764115E.

GETENV: Retrieving the Value of an Environment Variable

How to:

The GETENV function takes the name of an environment variable and returns its value as a variable length alphanumeric value.

Syntax: How to Retrieve the Value of an Environment Variable

GETENV(var_name)

where:

var_name

fixed length alphanumeric

Is the name of the environment variable whose value is being retrieved.

Example: Retrieving the Value of an Environment Variable

The following request retrieves the value of the variable EDAEXTSEC.

-SET &E1 = GETENV('EDAEXTSEC');
-TYPE &E1

The value returned is ON if FOCUS was started with security on or OFF if FOCUS was started with security off.

PUTENV: Assigning a Value to an Environment Variable

How to:

The PUTENV function assigns a value to an environment variable. The function returns an integer return code whose value is 1 (one) if the assignment is not successful or 0 (zero) if it is successful.

Syntax: How to Assign a Value to an Environment Variable

PUTENV(var_name, var_value)

where:

var_name

Fixed length alphanumeric

Is the name of the environment variable to be set.

var_value

Alphanumeric

Is the value you want to assign to the variable.

Example: Assigning a Value to the UNIX PS1 Variable

The following request assigns the value FOCUS/Shell: to the UNIX PS1 variable.

-SET &P1 = PUTENV('PS1','FOCUS/Shell:');

This causes UNIX to display the following prompt when the user issues the UNIX shell command SH:

FOCUS/Shell:

The following request creates a variable named xxxx and sets it to the value this is a test. It then retrieves the value using GETENV.

-SET &XXXX=PUTENV(xxxx,'this is a test');
-SET &YYYY=GETENV(xxxx);
-TYPE  Return Code: &XXXX,  Variable value: &YYYY

The output is:

Return Code: 0,  Variable value: this is a test

Simplified Geography Functions

In this section:

The simplified geography functions perform location-based calculations and retrieve geocoded points for various types of location data. They are used by the FOCUS location intelligence products that produce maps and charts. Some of the geography functions use GIS services and require valid credentials for accessing Esri ArcGIS proprietary data.

Sample Geography Files

Some of the examples for the geography functions use geography sample files. One file, esri-citibke.csv has station names, latitudes, and longitudes and trip start times and end times. The other file, esri-geo10036.ftm has geometry data. To run the examples that use these files, create an application named esri, and place the following files into the application folder.

esri-citibike.mas

FILENAME=ESRI-CITIBIKE, SUFFIX=DFIX    ,
 DATASET=esri/esri-citibike.csv, $
  SEGMENT=CITIBIKE_TRIPDATA, SEGTYPE=S0, $
    FIELDNAME=TRIPDURATION, ALIAS=tripduration, USAGE=I7, ACTUAL=A5V,
      TITLE='tripduration', $
    FIELDNAME=STARTTIME, ALIAS=starttime, USAGE=HMDYYS, ACTUAL=A18,
      TITLE='starttime', $
    FIELDNAME=STOPTIME, ALIAS=stoptime, USAGE=HMDYYS, ACTUAL=A18,
      TITLE='stoptime', $
    FIELDNAME=START_STATION_ID, ALIAS='start station id', USAGE=I6, ACTUAL=A4V,
      TITLE='start station id', $
    FIELDNAME=START_STATION_NAME, ALIAS='start station name', USAGE=A79V, ACTUAL=A79BV,
      TITLE='start station name', $
    FIELDNAME=START_STATION_LATITUDE, ALIAS='start station latitude', USAGE=P20.15, ACTUAL=A18V,
      TITLE='start station latitude',
      GEOGRAPHIC_ROLE=LATITUDE,  $
    FIELDNAME=START_STATION_LONGITUDE, ALIAS='start station longitude', USAGE=P20.14, ACTUAL=A18V,
      TITLE='start station longitude',
      GEOGRAPHIC_ROLE=LONGITUDE,  $
    FIELDNAME=END_STATION_ID, ALIAS='end station id', USAGE=I6, 
     ACTUAL=A4V, TITLE='end station id', $
    FIELDNAME=END_STATION_NAME, ALIAS='end station name', USAGE=A79V, ACTUAL=A79BV,
      TITLE='end station name', $
    FIELDNAME=END_STATION_LATITUDE, ALIAS='end station latitude', USAGE=P20.15, ACTUAL=A18V,
      TITLE='end station latitude',
      GEOGRAPHIC_ROLE=LATITUDE,  $
    FIELDNAME=END_STATION_LONGITUDE, ALIAS='end station longitude', USAGE=P20.14, ACTUAL=A18V,
      TITLE='end station longitude',
      GEOGRAPHIC_ROLE=LONGITUDE,  $
    FIELDNAME=BIKEID, ALIAS=bikeid, USAGE=I7, ACTUAL=A5,
      TITLE='bikeid', $
    FIELDNAME=USERTYPE, ALIAS=usertype, USAGE=A10V, ACTUAL=A10BV,
      TITLE='usertype', $
    FIELDNAME=BIRTH_YEAR, ALIAS='birth year', USAGE=I6, ACTUAL=A4,
      TITLE='birth year', $
    FIELDNAME=GENDER, ALIAS=gender, USAGE=I3, ACTUAL=A1,
      TITLE='gender', $
 SEGMENT=ESRIGEO, SEGTYPE=KU, SEGSUF=FIX, PARENT=CITIBIKE_TRIPDATA,
    DATASET=esri/esri-geo10036.ftm (LRECL 80 RECFM V, CRFILE=ESRI-GEO10036, $

esri-citibike.acx

SEGNAME=CITIBIKE_TRIPDATA, 
  DELIMITER=',', 
  ENCLOSURE=", 
  HEADER=NO, 
  CDN=OFF, $

esri-citibike.csv

Note: Each complete record must be on a single line. Therefore, you must remove any line breaks that may have been inserted due to the page width in this document.

1094,11/1/2015 0:00,11/1/2015 0:18,537,Lexington Ave & E 24 St,40.74025878,-73.98409214,531,Forsyth St & Broome St,40.71893904,-73.99266288,23959,Subscriber,1980,1
520,11/1/2015 0:00,11/1/2015 0:08,536,1 Ave & E 30 St,40.74144387,-73.97536082,498,Broadway & W 32 St,40.74854862,-73.98808416,22251,Subscriber,1988,1
753,11/1/2015 0:00,11/1/2015 0:12,229,Great Jones St,40.72743423,-73.99379025,328,Watts St & Greenwich St,40.72405549,-74.00965965,15869,Subscriber,1981,1
353,11/1/2015 0:00,11/1/2015 0:06,285,Broadway & E 14 St,40.73454567,-73.99074142,151,Cleveland Pl & Spring St,40.72210379,-73.99724901,21645,Subscriber,1987,1
1285,11/1/2015 0:00,11/1/2015 0:21,268,Howard St & Centre St,40.71910537,-73.99973337,476,E 31 St & 3 Ave,40.74394314,-73.97966069,14788,Customer,,0
477,11/1/2015 0:00,11/1/2015 0:08,379,W 31 St & 7 Ave,40.749156,-73.9916,546,E 30 St & Park Ave S,40.74444921,-73.98303529,21128,Subscriber,1962,2
362,11/1/2015 0:00,11/1/2015 0:06,407,Henry St & Poplar St,40.700469,-73.991454,310,State St & Smith St,40.68926942,-73.98912867,21016,Subscriber,1978,1
2316,11/1/2015 0:00,11/1/2015 0:39,147,Greenwich St & Warren St,40.71542197,-74.01121978,441,E 52 St & 2 Ave,40.756014,-73.967416,24117,Subscriber,1988,2
627,11/1/2015 0:00,11/1/2015 0:11,521,8 Ave & W 31 St,40.75096735,-73.99444208,285,Broadway & E 14 St,40.73454567,-73.99074142,17048,Subscriber,1986,2
1484,11/1/2015 0:01,11/1/2015 0:26,281,Grand Army Plaza & Central Park S,40.7643971,-73.97371465,367,E 53 St & Lexington Ave,40.75828065,-73.97069431,16779,Customer,,0
284,11/1/2015 0:01,11/1/2015 0:06,247,Perry St & Bleecker St,40.73535398,-74.00483091,453,W 22 St & 8 Ave,40.74475148,-73.99915362,17272,Subscriber,1976,1
886,11/1/2015 0:01,11/1/2015 0:16,492,W 33 St & 7 Ave,40.75019995,-73.99093085,377,6 Ave & Canal St,40.72243797,-74.00566443,23019,Subscriber,1982,1
1379,11/1/2015 0:01,11/1/2015 0:24,512,W 29 St & 9 Ave,40.7500727,-73.99839279,445,E 10 St & Avenue A,40.72740794,-73.98142006,23843,Subscriber,1962,2
179,11/1/2015 0:01,11/1/2015 0:04,319,Fulton St & Broadway,40.711066,-74.009447,264,Maiden Ln & Pearl St,40.70706456,-74.00731853,22538,Subscriber,1981,1
309,11/1/2015 0:01,11/1/2015 0:07,160,E 37 St & Lexington Ave,40.748238,-73.978311,362,Broadway & W 37 St,40.75172632,-73.98753523,22042,Subscriber,1988,1
616,11/1/2015 0:02,11/1/2015 0:12,479,9 Ave & W 45 St,40.76019252,-73.9912551,440,E 45 St & 3 Ave,40.75255434,-73.97282625,22699,Subscriber,1982,1
852,11/1/2015 0:02,11/1/2015 0:16,346,Bank St & Hudson St,40.73652889,-74.00618026,375,Mercer St & Bleecker St,40.72679454,-73.99695094,21011,Subscriber,1991,1
1854,11/1/2015 0:02,11/1/2015 0:33,409,DeKalb Ave & Skillman St,40.6906495,-73.95643107,3103,N 11 St & Wythe Ave,40.72153267,-73.95782357,22011,Subscriber,1992,1
1161,11/1/2015 0:02,11/1/2015 0:21,521,8 Ave & W 31 St,40.75096735,-73.99444208,461,E 20 St & 2 Ave,40.73587678,-73.98205027,19856,Subscriber,1957,1
917,11/1/2015 0:02,11/1/2015 0:17,532,S 5 Pl & S 4 St,40.710451,-73.960876,393,E 5 St & Avenue C,40.72299208,-73.97995466,18598,Subscriber,1991,1

esri-geo10036.mas

FILENAME=ESRI-GEO10036, SUFFIX=FIX     ,
 DATASET=esri/esri-geo10036.ftm (LRECL 80 RECFM V, IOTYPE=STREAM, $
  SEGMENT=ESRIGEO, SEGTYPE=S0, $
    FIELDNAME=GEOMETRY, ALIAS=GEOMETRY, USAGE=TX80L, ACTUAL=TX80,
      MISSING=ON, $

esri-geo10036.ftm

{"rings":[[[-73.9803889998524,40.7541490002762],[-73.9808779999197,40.7534830001
404],[-73.9814419998484,40.7537140000011],[-73.9824040001445,40.7541199998382],[
-73.982461000075,40.7541434001978],[-73.9825620002361,40.7541850001377],[-73.983
2877000673,40.7544888999428],[-73.9833499997027,40.7545150000673],[-73.983644399
969,40.7546397998869],[-73.9836849998628,40.7546570003204],[-73.9841276003085,40
.7548161002829],[-73.984399700086,40.7544544999752],[-73.9846140004357,40.754165
0001147],[-73.984871999743,40.7542749997914],[-73.9866590003126,40.7550369998577
],[-73.9874449996869,40.7553720000178],[-73.9902640001834,40.756570999552],[-73.
9914340001789,40.7570449998269],[-73.9918260002697,40.7572149995726],[-73.992429
0001982,40.7574769999636],[-73.9927679996434,40.7576240004473],[-73.993069000034
3,40.7578009996165],[-73.9931059999419,40.7577600004237],[-73.9932120003335,40.7
576230004012],[-73.9933250001486,40.7576770001934],[-73.9935390001247,40.7577669
998472],[-73.993725999755,40.7578459998931],[-73.9939599997542,40.757937999639],
[-73.9940989998689,40.7579839999617],[-73.9941529996611,40.7579959996157],[-73.9
942220001452,40.7580159996387],[-73.9943040003293,40.7580300002843],[-73.9943650
004444,40.7580330004227],[-73.99446499966,40.7580369997078],[-73.9945560002591,4
0.7580300002843],[-73.9946130001898,40.7580209998693],[-73.9945689999594,40.7580
809999383],[-73.9945449997519,40.7581149997075],[-73.9944196999092,40.7582882001
404],[-73.9943810002829,40.7583400001909],[-73.9953849998179,40.7587409997973],[
-73.9959560000693,40.7589690004191],[-73.9960649996999,40.7590149998424],[-73.99
68730000888,40.7593419996336],[-73.996975000296,40.7593809996335],[-73.997314999
7874,40.7595379996789],[-73.9977009996014,40.7597030000935],[-73.998039999946,40
.7598479995856],[-73.998334000014,40.7599709998618],[-73.9987769997587,40.760157
0003453],[-73.9990089996656,40.7602540003219],[-74.0015059997021,40.761292999672
2],[-74.0016340002089,40.7613299995799],[-74.0015350001401,40.7614539999022],[-7
4.0014580001865,40.7615479997405],[-74.0013640003483,40.7616560002242],[-74.0013
050003255,40.7617199995784],[-74.0011890003721,40.7618369995779],[-74.0010579997
269,40.7619609999003],[-74.0009659999808,40.7620389999],[-74.0008649998198,40.76
21230001764],[-74.0008390004195,40.7621430001993],[-74.0006839995669,40.76226100
0245],[-74.000531999752,40.7623750001062],[-74.0003759997525,40.7624849997829],[
-74.0002840000066,40.7625510001286],[-73.9998659996161,40.762850999574],[-73.999
8279996624,40.7628779999198],[-73.9995749996864,40.7630590001727],[-73.999312000
1487,40.7632720001028],[-73.9991639996189,40.7633989996642],[-73.998941000127,40
.7636250001936],[-73.9987589998279,40.7638580001466],[-73.9986331999622,40.76402
77004181],[-73.9986084002574,40.7640632002565],[-73.9984819996445,40.76423400039
89],[-73.9983469997142,40.7644199999831],[-73.998171999738,40.7646669996823],[-7
3.9980319995771,40.7648580003964],[-73.9979881998955,40.7649204996813],[-73.9979
368000432,40.7649942000224],[-73.9978947999051,40.7650573998791],[-73.9977017001
733,40.7653310995507],[-73.9975810003629,40.765481000348],[-73.9975069996483,40.
7654519999099],[-73.9956019999323,40.7646519998899],[-73.9955379996789,40.764625
0004434],[-73.9954779996099,40.7646030003282],[-73.9949389999348,40.764369000329
1],[-73.9936289997785,40.7638200001929],[-73.9934620001711,40.7637539998473],[-7
3.9931520002646,40.7636270002859],[-73.992701000151,40.7634409998023],[-73.99244
19000736,40.7633312995998],[-73.9898629996777,40.7622390001298],[-73.98861200044
34,40.761714000201],[-73.988021000169,40.761460000179],[-73.987028000242,40.7610
439998808],[-73.9867690998141,40.7609346998765],[-73.9848240002274,40.7601130001
149],[-73.9841635003452,40.7598425002312],[-73.9813259998949,40.7586439998208],[
-73.9805479999902,40.7583159999834],[-73.9793569999256,40.757814000216],[-73.978
1150002071,40.7572939996184],[-73.9785670003668,40.7566709996669],[-73.979014000
2958,40.7560309998308],[-73.9794719998329,40.7554120000638],[-73.9799399998311,4
0.7547649999048],[-73.9802380000836,40.7543610001601],[-73.9803889998524,40.7541
490002762]]]} 
%$  

GIS_DISTANCE: Calculating the Distance Between Geometry Points

How to:

The GIS_DISTANCE function uses a GIS service to calculate the distance between two geometry points.

Syntax: How to Calculate the Distance Between Geometry Points

GIS_DISTANCE(geo_point1,geo_point2)

where:

geo_point1,geo_point2

Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).

Are the geometry points for which you want to calculate the distance.

Note: You can generate a geometry point using the GIS_POINT function.

Example: Calculating the Distance Between Two Geometry Points

The following uses a citibike .csv file that contains station names, latitudes, and longitudes and trip start times and end times. It uses the GIS_POINT function to define geometry points for start stations and end stations. It then uses GIS_DISTANCE to calculate the distance between them.

DEFINE FILE esri/esri-citibike
STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE);
ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE);
Distance/P10.2 = GIS_DISTANCE(ENDPOINT, STARTPOINT);
END
TABLE FILE esri/esri-citibike
PRINT END_STATION_NAME AS End Distance
BY START_STATION_NAME AS Start
ON TABLE SET PAGE NOLEAD
END

The output is shown in the following image.

GIS_DRIVE_ROUTE: Calculating the Driving Directions Between Geometry Points

How to:

The GIS_DRIVE_ROUTE function uses a GIS service to calculate the driving route between two geometry points.

Syntax: How to Calculate the Drive Route Between Geometry Points

GIS_DRIVE_ROUTE(geo_start_point,geo_end_point)

where:

geo_start_point,geo_point2

Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).

Is the starting point for which you want to calculate the drive route.

Note: You can generate a geometry point using the GIS_POINT function.

geo_end_point,geo_point2

Fixed length alphanumeric, large enough to hold the JSON describing the point (for example, A200).

Is the ending point for which you want to calculate the drive route.

Note: You can generate a geometry point using the GIS_POINT function.

The format of the field to which the drive route will be returned is TX.

Example: Calculating the Drive Route Between Two Geometry Points

The following uses a citibike .csv file that contains station names, latitudes, and longitudes and trip start times and end times. It uses the GIS_POINT function to define geometry points for start stations and end stations. It then uses GIS_DRIVE_ROUTE to calculate the route to get from the end point to the start point.

DEFINE FILE esri/esri-citibike
STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE);
ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE);
Route/TX140 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) = 
          GIS_DRIVE_ROUTE(ENDPOINT, STARTPOINT);
END
TABLE FILE esri/esri-citibike
PRINT START_STATION_NAME AS Start END_STATION_NAME AS End Route
WHERE START_STATION_ID EQ 147  
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF,SIZE-11,$
ENDSTYLE
END

The output is shown in the following image.

Example: Charting a Driving Route Between Two Geometry Points

The following request uses GIS_DRIVE_ROUTE to generate a driving route between a station start point and end point and charts the route on an Esri map.

DEFINE FILE esri-citibike
STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE);
ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE);
Route/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) = 
          GIS_DRIVE_ROUTE(ENDPOINT, STARTPOINT);
END
GRAPH FILE ESRI-CITIBIKE 
 PRINT 
   START_STATION_NAME
   END_STATION_NAME
WHERE START_STATION_ID EQ 147
 ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH CHOROPLETH
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/  
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
  *GRAPH_JS_FINAL 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "dark-gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "Route"}}, "title" : "Chart"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Drive Route" 
END

The output is shown in the following image.

GIS_POINT: Building a Geometry Point

How to:

Given a WKID (Well-Known ID) spatial reference, longitude, and latitude, the GIS_POINT function builds a JSON point defining a Geometry object with the provided WKID, longitude, and latitude. The function is optimized for those SQL engines that can build a JSON geometry object.

The field to which the point is returned should have fixed length alphanumeric format, large enough to hold the JSON describing the point (for example, A200).

Syntax: How to Build a Geometry Point

GIS_POINT(wkid, longitude, latitude)

where:

wkid

Fixed length alphanumeric

Is a spatial reference code (WKID). WKID is an abbreviation for Well Known ID, which identifies a projected or geographic coordinate system.

longitude

D20.8

Is the longitude for the point.

latitude

D20.8

Is the latitude for the point.

Example: Building a Geometry Point

The following request uses the spatial reference code 4326 (decimal degrees) and state capital longitudes and latitudes to build a geometry point.

DEFINE FILE WFLITE
GPOINT/A200 = GIS_POINT('4326', STATE_PROV_CAPITAL_LONGITUDE, STATE_PROV_CAPITAL_LATITUDE);
END
TABLE FILE WFLITE
SUM FST.STATE_PROV_CAPITAL_LONGITUDE AS Longitude
FST.STATE_PROV_CAPITAL_LATITUDE AS Latitude 
FST.GPOINT AS Point
BY STATE_PROV_CAPITAL_NAME AS Capital
WHERE COUNTRY_NAME EQ 'United States'
WHERE STATE_PROV_CAPITAL_NAME LT 'C'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

Example: Charting Geometry Points

The following request generates geometry points using GIS_POINT charts them on an Esri map.

DEFINE FILE WFLITE
GPOINT/A200 = GIS_POINT('4326', STATE_PROV_CAPITAL_LONGITUDE, STATE_PROV_CAPITAL_LATITUDE);
END
 GRAPH FILE WFLITE
 PRINT
 STATE_PROV_NAME
 WHERE STATE_PROV_CAPITAL_LONGITUDE NE MISSING
 ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH BUBBLEMAP 
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, 
   BUCKET=tooltip, $ 
  *GRAPH_JS_FINAL 
"bubbleMarker": {"maxSize": "10%"}, 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "GPOINT"}}, "title" : "Report"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Geometry Points" 
END

The output is shown in the following image.

GIS_GEOCODE_ADDR: Geocoding a Complete Address

How to:

GIS_GEOCODE_ADDR uses a GIS geocoding service to obtain the geometry point for a complete address.

Syntax: How to Geocode a Complete Address

GIS_GEOCODE_ADDR(address[, country])

where:

address

Fixed length alphanumeric

Is the complete address to be geocoded.

country

Fixed length alphanumeric

Is a country name, which is optional if the country is the United States.

Example: Geocoding a Complete Address

The following request creates a complete address by concatenating the street address, city, state, and zip code. It then uses GIS_GEOCODE_ADDR to create a GIS point for the address.

DEFINE FILE WFLITE
GADDRESS/A200 =ADDRESS_LINE_1 || '  ' | CITY_NAME || '  ' | STATE_PROV_NAME || ' ' | POSTAL_CODE;
GEOCODE1/A200 = GIS_GEOCODE_ADDR(GADDRESS); 
END
TABLE FILE WFLITE
PRINT ADDRESS_LINE_1 AS Address GEOCODE1
BY POSTAL_CODE AS Zip
WHERE CITY_NAME EQ 'New York'
WHERE POSTAL_CODE FROM '10013' TO '10020'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

GIS_GEOCODE_ADDR_CITY: Geocoding an Address Line, City, and State

How to:

GIS_GEOCODE_ADDR_CITY uses a GIS geocoding service to obtain the geometry point for an address line, city, state, and optional country. The returned value is a fixed length alphanumeric format, large enough to hold the JSON describing the geographic location (for example, A200).

Syntax: How to Geocode an Address Line, City, and State

GIS_GEOCODE_ADDR_CITY( street_addr, city , state [, country])

where:

street_addr

Fixed length alphanumeric

Is the street address to be geocoded.

city

Fixed length alphanumeric

Is the city name associated with the street address.

state

Fixed length alphanumeric

Is the state name associated with the street address.

country

fixed length alphanumeric

Is a country name, which is optional if the country is the United States.

Example: Geocoding a Street Address, City, and State

The following request geocodes a street address using GIS_GEOCODE_ADDR_CITY.

DEFINE FILE WFLITE
GEOCODE1/A200 = GIS_GEOCODE_ADDR_CITY(ADDRESS_LINE_1, CITY_NAME , STATE_PROV_NAME); 
END
TABLE FILE WFLITE
PRINT ADDRESS_LINE_1 AS Address GEOCODE1
BY POSTAL_CODE AS Zip
WHERE CITY_NAME EQ 'New York'
WHERE POSTAL_CODE FROM '10013' TO '10020'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

GIS_GEOCODE_ADDR_POSTAL: Geocoding an Address Line and Postal Code

How to:

GIS_GEOCODE_ADDR_POSTAL uses a GIS geocoding service to obtain the geometry point for an address line, postal code and optional country. The returned value is a fixed length alphanumeric format, large enough to hold the JSON describing the geographic location (for example, A200).

Syntax: How to Geocode an Address Line and Postal Code

GIS_GEOCODE_ADDR_POSTAL( street_addr, postal_code [, country])

where:

street_addr

fixed length alphanumeric

Is the street address to be geocoded.

postal_code

fixed length alphanumeric

Is the postal code associated with the street address.

country

fixed length alphanumeric

Is a country name, which is optional if the country is the United States.

Example: Geocoding a Street Address and Postal Code

The following request geocodes a street address using GIS_GEOCODE_ADDR_POSTAL.

DEFINE FILE WFLITE
GEOCODE1/A200 = GIS_GEOCODE_ADDR_POSTAL(ADDRESS_LINE_1, POSTAL_CODE); 
END
TABLE FILE WFLITE
PRINT ADDRESS_LINE_1 AS Address GEOCODE1
BY POSTAL_CODE AS Zip
WHERE CITY_NAME EQ 'New York'
WHERE POSTAL_CODE FROM '10013' TO '10020'
ON TABLE SET PAGE NOPAGE
END

The output is shown in the following image.

GIS_GEOMETRY: Building a JSON Geometry Object

How to:

The GIS_GEOMETRY function builds a JSON Geometry object given a geometry type, WKID, and a geometry.

Syntax: How to Build a JSON Geometry Object

GIS_GEOMETRY(geotype, wkid, geometry)

where:

geotype

Alphanumeric

Is a geometry type, for example, 'esriGeometryPolygon' ,esriGeometryPolyline, 'esriGeometryMultipoint', 'EsriGeometryPoint', 'EsriGeometryExtent'..

wkid

Alphanumeric

Is a valid spatial reference ID. WKID is an abbreviation for Well Known ID, which identifies a projected or geographic coordinate system.

geometry

TX

A geometry in JSON.

The output is returned as TX.

Example: Building a JSON Geometry Object

The following request builds a polygon geometry of the area encompassing zip code 10036 in Manhattan. The input geometry object is stored in a text (.ftm) file that is cross-referenced in the esri-citibike Master File. The field containing the geometry object is GEOMETRY.

DEFINE FILE esri/esri-citibike
WKID/A10  = '4326';
 MASTER_GEOMETRY/TX256 (GEOGRAPHIC_ROLE=GEOMETRY_AREA) = 
    GIS_GEOMETRY( 'esriGeometryPolygon', WKID , GEOMETRY );
END
TABLE FILE esri/esri-citibike 
 PRINT 
    START_STATION_NAME AS Station
    START_STATION_LATITUDE AS Latitude
    START_STATION_LONGITUDE AS Longitude
    MASTER_GEOMETRY AS 'JSON Geometry Object'
 WHERE START_STATION_ID EQ 479  
ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE * 
type=report, grid=off, size=10,$
 ENDSTYLE 
END  

The output is shown in the following image.

Example: Charting a Geometry Object

The following request uses GIS_GEOMETRY to build a geometry object and chart it on an Esri map.

DEFINE FILE esri-citibike
WKID/A10  = '4326';
 MASTER_GEOMETRY/TX256 (GEOGRAPHIC_ROLE=GEOMETRY_AREA) = 
    GIS_GEOMETRY( 'esriGeometryPolygon', WKID , GEOMETRY );
END
 GRAPH FILE ESRI-CITIBIKE 
 PRINT 
   START_STATION_NAME
   END_STATION_NAME
   ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH CHOROPLETH
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/  
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
  *GRAPH_JS_FINAL 
 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "dark-gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "MASTER_GEOMETRY"}}, "title" : "Chart"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Geometry Object" 
END

The output is shown in the following image.

GIS_IN_POLYGON: Determining if a Point is in a Complex Polygon

How to:

Given a point and a polygon definition, the GIS_IN_POLYGON function returns the value 1 (TRUE) if the point is in the polygon or 0 (FALSE) if the point is not in the polygon. The value is returned in integer format.

Syntax: How to Determine if a Point is in a Complex Polygon

GIS_IN_POLYGON(point, polygon_definition)

where:

point

Alphanumeric or text

Is the geometry point.

polygon_definition

Text

Is the geometry area (polygon) definition.

Example: Determining if a Point is in a Polygon

The following example determines if a station is inside zip code 10036. GIS_IN_POLYGON returns 1 for a point inside the polygon definition and 0 for a point outside. The polygon definition being passed is the same one used in the example for the GIS_GEOMETRY function described previously and defines the polygon for zip code 10036 in Manhattan in New York City. The value 1 is translated to Yes and 0 to No for display on the output.

DEFINE FILE esri/esri-citibike
WKID/A10  = '4326';
MASTER_GEOMETRY/TX256 (GEOGRAPHIC_ROLE=GEOMETRY_AREA) = 
  GIS_GEOMETRY( 'esriGeometryPolygon', WKID , GEOMETRY );
START_STATION_POINT/A200=GIS_POINT(WKID, START_STATION_LONGITUDE, START_STATION_LATITUDE);
STATION_IN_POLYGON/I4=GIS_IN_POLYGON(START_STATION_POINT, MASTER_GEOMETRY);
IN_POLYGON/A5 = IF STATION_IN_POLYGON EQ 1 THEN 'Yes' ELSE 'No';
END
TABLE FILE esri/esri-citibike 
 PRINT 
     START_STATION_NAME AS Station
    IN_POLYGON AS 'Station in zip, code 10036?'
BY START_STATION_ID AS 'Station ID'
ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE * 
type=report, grid=off, size=10,$
type=data, column=in_polygon, style=bold, color=red, when = in_polygon eq 'Yes',$
 ENDSTYLE 
END  

The output is shown in the following image.

GIS_LINE: Building a JSON Line

How to:

Given two geometry points or lines, GIS_LINE builds a JSON line. The output is returned in text format.

Syntax: How to Build a JSON Line

GIS_LINE(geometry1, geometry2)

where:

geometry1

Alphanumeric or text

Is the first point or line for defining the beginning of the new line.

geometry2

Alphanumeric or text

Is the second point or line for the concatenation of the new line.

Example: Building a JSON Line

The following request prints start stations and end stations and builds a JSON line between them.

DEFINE FILE ESRI/ESRI-CITIBIKE
STARTPOINT/A200 = GIS_POINT('4326', START_STATION_LONGITUDE, START_STATION_LATITUDE);
ENDPOINT/A200 = GIS_POINT('4326', END_STATION_LONGITUDE, END_STATION_LATITUDE);
CONNECTION_LINE/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) =
   GIS_LINE(STARTPOINT, ENDPOINT);
END
TABLE FILE ESRI/ESRI-CITIBIKE
PRINT END_STATION_NAME AS End CONNECTION_LINE AS 'Connecting Line'
BY START_STATION_NAME AS Start
WHERE START_STATION_NAME LE 'D'
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.

Example: Charting Geometry Lines

The following request generates geometry lines and charts them on an Esri map.

DEFINE FILE ESRI-CITIBIKE
CONNECTION_LINE/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_LINE) =GIS_LINE(START_STATION_POINT, END_STATION_POINT);
DISTANCE/P33.11 TITLE 'Distance'=GIS_DISTANCE(START_STATION_POINT, END_STATION_POINT); 
END
GRAPH FILE ESRI-CITIBIKE 
 PRINT 
   START_STATION_NAME
   END_STATION_NAME
   DISTANCE
 ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH BUBBLEMAP 
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/  
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N3, /*DISTANCE*/
   BUCKET=tooltip, $
  *GRAPH_JS_FINAL 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "dark-gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "CONNECTION_LINE"}}, "title" : "Chart"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Geometry Lines" 
END

The output is shown in the following image.

GIS_SERVICE_AREA: Calculating a Geometry Area Around a Given Point

How to:

The GIS_SERVICE_AREA function uses a GIS service to calculate the geometry area with access boundaries within the given time or distance from the provided geometry point. The output is returned in text format.

Syntax: How to Calculate a Geometry Area Around a Point

GIS_SERVICE_AREA(geo_point, distance, travel_mode)

where:

geo_point

Alphanumeric

Is the starting geometry point.

distance

Alphanumeric

Is the travel limitation in either time or distance units.

travel_mode

Alphanumeric

Is a valid travel mode as defined in gis_serv_area.mas in the Catalog directory under the FOCUS installation directory. The accepted travel modes are:

  • 'Miles'. This is the default value.
  • 'TravelTime'.
  • 'TruckTravelTime'.
  • 'WalkTime'.
  • 'Kilometers'.
Example: Calculating a Service Area Around a Geometry Point

The following request calculates the geometry area that is a five-minute walk around a station.

DEFINE FILE esri/esri-citibike 
WKID/A10='4326';
START_STATION_POINT/A200=GIS_POINT(WKID, START_STATION_LONGITUDE, START_STATION_LATITUDE); 
DISTANCE/A10='5';
TRAVEL_MODE/A10='WalkTime';
STATION_SERVICE_AREA/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_AREA)= 
 GIS_SERVICE_AREA(START_STATION_POINT, DISTANCE, TRAVEL_MODE);
END
TABLE FILE esri/esri-citibike 
 PRINT 
    START_STATION_ID AS 'Station ID'
    START_STATION_NAME AS 'Station Name'
    STATION_SERVICE_AREA AS '5-Minute Walk Service Area Around Station'
 WHERE START_STATION_ID EQ 479 OR 512;
ON TABLE SET PAGE NOLEAD 
ON TABLE SET STYLE * 
TYPE=REPORT, GRID=OFF, SIZE=12,$
ENDSTYLE 
END  

The output is shown in the following image.

Example: Charting a Geometry Service Area Around a Point

The following request generates service areas that are 5-minute walking distances from start station geometry points and charts them on an Esri map.

DEFINE FILE esri-citibike 
WKID/A10='4326';
START_STATION_POINT/A200=GIS_POINT(WKID, START_STATION_LONGITUDE, START_STATION_LATITUDE); 
DISTANCE/A10='5';
TRAVEL_MODE/A10='WalkTime';
STATION_SERVICE_AREA/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_AREA)= 
 GIS_SERVICE_AREA(START_STATION_POINT, DISTANCE, TRAVEL_MODE);
END
GRAPH FILE ESRI-CITIBIKE 
 PRINT 
   START_STATION_NAME
   END_STATION_NAME
   DISTANCE
 ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH CHOROPLETH
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/  
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N3, /*DISTANCE*/
   BUCKET=tooltip, $
  *GRAPH_JS_FINAL 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "dark-gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "STATION_SERVICE_AREA"}}, "title" : "Chart"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Geometry Service Area" 
END

The output is shown in the following image.

GIS_SERV_AREA_XY: Calculating a Service Area Around a Given Coordinate

How to:

The GIS_SERV_AREA_XY function uses a GIS service to calculate the geometry area with access boundaries within the given time or distance from the provided coordinate. The output is returned in text format.

Syntax: How to Calculate a Geometry Area Around a Coordinate

GIS_SERV_AREA_XY(longitude, latitude, distance, travel_mode[, wkid])

where:

longitude

Alphanumeric

Is the longitude of the starting point.

latitude

Alphanumeric

Is the latitude of the starting point.

distance

Integer

Is the travel limitation in either time or distance units.

travel_mode

Alphanumeric

Is a valid travel mode as defined in gis_serv_area.mas in the Catalog directory under the FOCUS installation directory. The accepted travel modes are:

  • 'Miles'. This is the default value.
  • 'TravelTime'.
  • 'TruckTravelTime'.
  • 'WalkTime'.
  • 'Kilometers'.
wkid

Alphanumeric

Is the spatial reference ID for the coordinate. WKID is an abbreviation for Well Known ID, which identifies a projected or geographic coordinate system. The default value is '4326', which represents decimal degrees.

Example: Calculating a Service Area Around a Coordinate

The following request calculates the geometry area that is a five-minute walk around a station, using the longitude and latitude that specify the station location.

DEFINE FILE esri/esri-citibike 
DISTANCE/I4=5;
WKID/A10='4326';
TRAVEL_MODE/A10='WalkTime';
STATION_SERVICE_AREA/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_AREA)=
   GIS_SERV_AREA_XY(START_STATION_LONGITUDE, START_STATION_LATITUDE, DISTANCE, TRAVEL_MODE, WKID);
END
TABLE FILE esri/esri-citibike 
 PRINT 
    START_STATION_ID AS 'Station ID'
    START_STATION_NAME AS 'Station Name'
    STATION_SERVICE_AREA 
       AS '5-Minute Walk Service Area Around Station Coordinate'
 WHERE START_STATION_ID EQ 479 OR 512;
ON TABLE SET PAGE NOLEAD 
ON TABLE SET STYLE * 
TYPE=REPORT, GRID=OFF, SIZE=12,$
ENDSTYLE 
END  

The output is shown in the following image.

Example: Charting a Geometry Service Area Around a Coordinate

The following request generates service areas that are 5-minute walking distances from start station coordinates and charts them on an Esri map.

DEFINE FILE esri-citibike 
WKID/A10='4326';
DISTANCE/A10='5';
TRAVEL_MODE/A10='WalkTime';
STATION_SERVICE_AREA/TX80 (GEOGRAPHIC_ROLE=GEOMETRY_AREA)=
   GIS_SERV_AREA_XY(START_STATION_LONGITUDE, START_STATION_LATITUDE, DISTANCE, TRAVEL_MODE, WKID);
END
GRAPH FILE ESRI-CITIBIKE 
 PRINT 
   START_STATION_NAME
   END_STATION_NAME
   DISTANCE
 ON TABLE PCHOLD FORMAT JSCHART 
 ON TABLE SET LOOKGRAPH CHOROPLETH
 ON TABLE SET EMBEDHEADING ON 
 ON TABLE SET AUTOFIT ON 
 ON TABLE SET STYLE * 
  TYPE=REPORT, TITLETEXT='Map', PAGESIZE=E, CHART-LOOK=com.esri.map, $ 
  TYPE=DATA, COLUMN=N1, /*START_STATION_NAME*/  
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N2, /*END_STATION_NAME*/
   BUCKET=tooltip, $
  TYPE=DATA, COLUMN=N3, /*DISTANCE*/
   BUCKET=tooltip, $
  *GRAPH_JS_FINAL 
"legend": {"visible": true}, 
"extensions" : { "com.esri.map" : 
  { "scalebar" : 
{ 
    "scalebarUnit": "dual", 
    "attachTo" : "bottom-left" 
  }, 
  "baseMapInfo": { 
       "drawBasemapControl" : false, 
       "showArcGISBasemaps" : false, 
            "customBaseMaps" : [ 
            {"ibiBaseLayer" : "dark-gray"} 
        ] 
   }, 
  "overlayLayers": 
  [{ 
  "ibiDataLayer": {"map-geometry" :  {"map_by_field" : "STATION_SERVICE_AREA"}}, "title" : "Chart"}] 
  }, 
"introAnimation": "{\"enabled\":false}" 
} 
 
  *END 
 ENDSTYLE 
 HEADING 
  "Chart Geometry Service Area" 
END

The output is shown in the following image.

Automatic Conversion Between Date and Date-Time Formats

The following automatic direct operations are supported between date and date-time formats:

Recognition and use of date or date-time constants.

For information about creating and using date and date-time constants, see the Describing Data manual.

Example: Assigning Date and Date-Time Values

The following request generates a date-time value using the DT_CURRENT_DATETIME function. It then assigns this value to a date field and assigns that date field to a date-time field.

TABLE FILE WFLITE
PRINT QUANTITY_SOLD NOPRINT AND COMPUTE
 DATETIME1/HYYMDm =  DT_CURRENT_DATETIME(MILLISECOND);  
     AS 'Date-Time 1'
COMPUTE
 DATE1/YYMD   = DATETIME1;
     AS 'Date'
COMPUTE
DATETIME2/HYYMDm = DATE1;
     AS 'Date-Time 2'
WHERE RECORDLIMIT EQ 20
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image. The original date-time field has a non-zero time component. When assigned to the date field, the time component is removed. When that date is assigned to the second date-time field, a zero time component is added.

Example: Comparing Date and Date-Time Values

The following request creates one date-time field and one date field. When quantity sold is 1, they have the same date value and the date-time field has a zero time component. When quantity sold is 2, they have different date values, and the date-time field has a zero time component. In all other cases, the date-time field has the current date with a non-zero time component, and the date field has the current date. The EQUAL1 field compares them to see if they compare as equal.

TABLE FILE WFLITE
PRINT QUANTITY_SOLD AS Quantity AND COMPUTE
 DATETIME1/HYYMDm = IF QUANTITY_SOLD EQ 1 THEN '2017/06/05'
        ELSE IF QUANTITY_SOLD EQ 2 THEN '2016/02/29'
        ELSE DT_CURRENT_DATETIME(MILLISECOND);  
        AS 'Date-Time'
COMPUTE
  DATE1/YYMD   = IF QUANTITY_SOLD EQ 1 THEN '2017/06/05'
        ELSE IF QUANTITY_SOLD EQ 2 THEN '2015/12/30'     
        ELSE DT_CURRENT_DATE(); 
        AS 'Date'
COMPUTE
  EQUAL1/A1 = IF DATETIME1 EQ DATE1 THEN 'Y' ELSE 'N';
        AS 'Equal?'
WHERE RECORDLIMIT EQ 12
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image. When a date value is compared to a date-time value, the date is converted to a date-time value with the time component set to zero, and then the values are compared. Therefore, when QUANTITY_SOLD is 1, both the date components are equal and the time component of the date-time field is set to zero, so when the date is converted to a date-time value, they are equal. When QUANTITY_SOLD is 2, the date components are different, so they are not equal. When QUANTITY_SOLD is 3, the date components are the same, but the date-time field has a non-zero time component. Therefore, when the date field is converted to a date-time value with a zero time component and they are compared, they are not equal.

LNGPREP Utility: Preparing Metadata Language Files

In this section:

Reference:

The LNGPREP utility extracts TITLE, DESCRIPTION, CAPTION, and PROMPT attribute values from application Master Files into specially formatted language translation files for each language you need. Once you have the contents of these language files translated, your users can run these applications in the language they choose.

LNGPREP does two things. It extracts attribute values from a Master File into language files, and it inserts or updates the TRANS_FILE attribute in the Master File with a value identifying the application folder where the language files reside and a prefix used for naming the set of language files. If the Master File is part of a cluster, LNGPREP will extract translatable strings from every Master File referenced in the cluster, and will update each with the same TRANS_FILE value.

LNGPREP requires an input file listing the three-character codes of the languages you need.

The name of each language file starts with the prefix specified in the TRANS_FILE value, followed by a three-character language code, and the extension .lng.

For example, assume the language input file contains the French and Spanish language codes:

fre
spa

If the Master File specifies:

trans_file = xlate/xl_

The language translation files would be in the xlate application folder, named:

xl_fre.lng for French

xl_spa.lng for Spanish

Reference: The Base Language File

Each Master File must have a single base language in which the DESCRIPTION, TITLE, CAPTION, and PROMPT attributes are specified. This language need not be English.

LNGPREP extracts these attribute values into the base language file, whose language code, for historical reasons, is eng. In this case, eng does not mean English. It means whatever language the Master File is written in.

The base language file (prefixeng.lng) should never be hand edited. All other .lng files must be hand edited by translators, to translate the string values from the base language to the appropriate language.

Translating Applications into English

Since language code eng is reserved to mean base language, you cannot use it to contain English translations of an application whose base language is not English. In those cases, use any of the other English dialect language codes, such as AME, UKE, CAE, or AUE. For example, if the base language is German, specify AME in the languages file, run LNGPREP, and it will produce prefixeng.lng and prefixame.lng files, both in German. Translate the contents of prefixame.lng into English. Leave prefixeng.lng untouched.

Reference: How Translated Master File Attributes Are Displayed

Each language file contains a line for each attribute value from a related set of Master Files. Each attribute value has a unique index number assigned to it. For example, if the Master File contains FIELDNAME=PRODUCT_CATEGORY, TITLE='Product,Category', and that TITLE happens to be the 39th translatable attribute value, LNGPREP will produce lng files all containing the line:

39 = Product,Category

Your French translator will edit prefixfre.lng, leaving the index values unchanged while translating the string values, producing, in this case,

39 = Produit,Catégorie

At run time, when the TITLE for field PRODUCT_CATEGORY needs to be displayed, if FOCUS is configured for LANG=FRE, FOCUS looks up "Product,Category" in prefixeng.lng, finds index value 39, looks up 39 in prefixfre.lng, and displays the TITLE as "Produit,Catégorie."

Reference: LNGPREP Best Practice

The recommended best practice is to create an app directory solely for the purpose of containing .lng files, and use this appname and a common prefix value for all LNGPREP commands. In addition, put the languages fn.cfg file in this app folder. This will create one set of .lng files for all apps, minimizing the time and effort spent on translation.

LNGPREP Prerequisites

How to:

You must first create a configuration file containing the three-character language codes for each translation file you need, one language code on each line. The first invocation of LNGPREP for a given Master File adds the TRANS_FILE attribute in that and all related Master Files, creates the base language file by scanning the Master Files for supported attribute values, and creates a copy of the base language file with the correct name for each additional language. Then, a translator has to translate the values in each additional language file from the base language to the correct language for that file.

On each subsequent run, LNGPREP will check for updates to the list of related Master Files and attribute values and update the files as needed. Translators will then have to translate any attribute values added to the language files.

Syntax: How to Run the LNGPREP Command

LNGPREP FILE n_part_name LNGAPP appname LNGPREFIX prefix
        LNGFILE appname/fn

where:

n_part_name

Specifies the n-part (app1/app2...) name of a Master File.

appname
Specifies the location where .lng files will be written and updated.
prefix

Specifies the literal characters that will precede the three-character language code in the names of the .lng files.

appname/fn

Specifies the appname and filename of a user-created .cfg file containing the list of three-character language codes, one per line. For example, the following file named langretail.cfg contains language codes for American English, French, and Japanese:

ame
fre
jpn
Example: Sample LNGPREP Command

Assume the lnglist.cfg file contains the language codes fre (French) and spa (Spanish):

fre
spa

Issue the following LNGPREP command:

LNGPREP FILE weather/forecast LNGAPP xlate LNGPREFIX tq_ LNGFILE  xlate/lnglist

The following language files will be created:

  • xlate / tq_eng.lng
  • xlate / tq_fre.lng
  • xlate / tq_spa.lng

The Master File weather/ forecast.mas will be updated with the following attribute

TRANS_FILE= xlate/tq_

Translators then have to translate the values in xlate/tq_fre.lng and xlate/tq_spa.lng.

Logging All Environment Variables in EDAPRINT

Starting with this release, the top of the EDAPRINT log file contains all environment variables. In addition, if JDK_HOME and JAVA_HOME are both not set, the following warning message displays in EDAPRINT:

W JDK_HOME= or JAVA_HOME= required for Java Listener start

The following example shows a sample of the top portion of the EDAPRINT log file:

02/24/2016 09:57:11.753 I Workspace initialization started
02/24/2016 09:57:11.753 I EDACONF=C:\ibi\srv99\wfs
02/24/2016 09:57:11.753 I EDAHOME=C:\ibi\srv99\home
02/24/2016 09:57:11.753 I Environment Variables...
02/24/2016 09:57:11.753 I  ALLUSERSPROFILE=C:\Documents and Settings\All Users
02/24/2016 09:57:11.753 I  APPDATA=C:\Documents and Settings\se02703\Application Data
02/24/2016 09:57:11.753 I  CLASSPATH=.
02/24/2016 09:57:11.769 I       C:\Program Files\Java\jre6\lib\ext\QTJava.zip
02/24/2016 09:57:11.769 I  CommonProgramFiles=C:\Program Files\Common Files
02/24/2016 09:57:11.769 I  COMPUTERNAME=INFORMAT-31B4D7
02/24/2016 09:57:11.769 I  ComSpec=C:\WINDOWS\system32\cmd.exe
02/24/2016 09:57:11.769 I  DEFLOGDIR=C:\Documents and Settings\All Users\Application Data\McAfee\DesktopProtection
02/24/2016 09:57:11.769 I  EDACONF=C:\ibi\srv99\wfs
02/24/2016 09:57:11.769 I  EDAEXTSEC=OFF
02/24/2016 09:57:11.769 I  EDAHOME=C:\ibi\srv99\home
02/24/2016 09:57:11.769 I  EDAPRINT=C:\ibi\srv99\wfs
02/24/2016 09:57:11.769 I  EDASHARE=C:\ibi\srv99\wfs
02/24/2016 09:57:11.769 I  EDATEMP0=C:\ibi\srv99\wfs\edatemp
02/24/2016 09:57:11.769 I  FP_NO_HOST_CHECK=NO
02/24/2016 09:57:11.769 I  HOMEDRIVE=H:
02/24/2016 09:57:11.769 I  HOMEPATH=\

Information Builders