ALTER-LOCALE

Function

Selects a locale or changes locale parameters for printing date, numeric, and money data and for data accepted by INPUT. Locales are preferences for language, currency, and the presentation of charts and numbers.

Syntax

ALTER-LOCALE
[LOCALE={txt_lit _var|DEFAULT|SYSTEM}]
[NUMBER-EDIT-MASK={txt_lit|_var|DEFAULT|SYSTEM}]
[MONEY-EDIT-MASK={txt_lit|_var|DEFAULT|SYSTEM}]
[DATE-EDIT-MASK={txt_lit|_var|DEFAULT|SYSTEM}]
[INPUT-DATE-EDIT-MASK={txt_lit|_var|DEFAULT|SYSTEM}]
[MONEY-SIGN={txt_lit|_var|DEFAULT|SYSTEM}]
[MONEY-SIGN-LOCATION={txt_var|DEFAULT|SYSTEM|LEFT|RIGHT}]
[THOUSAND-SEPARATOR={txt_lit|_var|DEFAULT|SYSTEM}]
[DECIMAL-SEPARATOR={txt_lit|_var|DEFAULT|SYSTEM}]
[DATE-SEPARATOR={txt_lit|_var|DEFAULT|SYSTEM}]
[TIME-SEPARATOR={txt_lit|_var|DEFAULT|SYSTEM}]
[EDIT-OPTION-NA={txt_lit|_var|DEFAULT|SYSTEM}]
[EDIT-OPTION-AM={txt_lit|_var|DEFAULT|SYSTEM}]
[EDIT-OPTION-PM={txt_lit|_var|DEFAULT|SYSTEM}]
[EDIT-OPTION-BC={txt_lit|_var|DEFAULT|SYSTEM}]
[EDIT-OPTION-AD={txt_lit|_var|DEFAULT|SYSTEM}]
[DAY-OF-WEEK-CASE={txt_var|DEFAULT|SYSTEM|UPPER|LOWER
|EDIT|NO-CHANGE}]
[DAY-OF-WEEK-FULL=({txt_lit1|_var1}...{txt_lit7|_var7})]
[DAY-OF-WEEK-SHORT=({txt_lit1|_var1}...{txt_lit7|_var7})]
[MONTHS-CASE={txt_var|DEFAULT|SYSTEM|UPPER|LOWER|EDIT|NO-CHANGE}]
[MONTHS-FULL=({txt_lit1|_var1}...{txt_lit12|_var12})]
[MONTHS-SHORT=({txt_lit1|_var1}...{txt_lit12|_var12})]

Arguments

Note:

Many of the settings can have a value of DEFAULT or SYSTEM. DEFAULT retrieves values from the corresponding setting of the default locale in the [Default‑Settings] section of SQR.INI. SYSTEM retrieves values from the corresponding setting of the system locale. You can alter the system locale using ALTER-LOCALE; however, you cannot define it in SQR.INI.

LOCALE

Locale name. This name must be defined in SQR.INI. If omitted, the current locale is used. The locale name is case-insensitive and is limited to A-Z, 0-9, underscore, or hyphen. To determine the current locale, print the reserved variable $sqr-locale.

NUMBER-EDIT-MASK

Numeric edit mask used with the keyword NUMBER in PRINT, MOVE, SHOW, or DISPLAY.

MONEY-EDIT-MASK

Numeric edit mask used with the keyword MONEY in PRINT, MOVE, SHOW, or DISPLAY.

DATE-EDIT-MASK

Date edit mask used with the keyword DATE in PRINT, MOVE, SHOW, or DISPLAY, or the LET functions datetostr() or strtodate().

INPUT-DATE-EDIT-MASK

Default date format to use with INPUT when TYPE=DATE is specified or the input variable is a date variable.

Note:

For more information on Edit Masks, see “Edit Masks”.

MONEY-SIGN

Character(s) that replace $ or other currency symbols used in edit masks.

MONEY-SIGN-LOCATION

Where to place the MONEY-SIGN character(s). Valid values are LEFT and RIGHT.

THOUSAND-SEPARATOR

Character to replace the ',' edit character.

DECIMAL-SEPARATOR

Character to replace the '.' edit character.

DATE-SEPARATOR

Character to replace the '/' character.

TIME-SEPARATOR

Character to replace the ':' character.

EDIT-OPTION-NA

Character(s) to use with the 'na' option.

EDIT-OPTION-AM

Character(s) to replace 'AM'.

EDIT-OPTION-PM

Character(s) to replace 'PM'.

EDIT-OPTION-BC

Character(s) to replace 'BC'.

EDIT-OPTION-AD

Character(s) to replace 'AD'.

DAY-OF-WEEK-CASE

How the case for DAY-OF-WEEK-FULL or DAY‑OF-WEEK-SHORT is affected when used with 'DAY' or 'DY'. Valid values are:

DAY-OF-WEEK-FULL

Full names for the days of the week. Production Reporting considers the first day to be Sunday. You must specify all seven days.

DAY-OF-WEEK-SHORT

Abbreviated names for the days of the week. Production Reporting considers the first day to be Sunday. You must specify all seven abbreviations.

MONTHS-CASE

How the case for MONTHS-FULL or MONTHS‑SHORT is affected when used with 'MONTH' or 'MON'. Valid values are:

MONTHS-FULL

Full names for the months of the year. Production Reporting considers the first month to be January. You must specify all 12 months.

MONTHS-SHORT

Abbreviated names for the months of the year. Production Reporting considers the first month to be January. You must specify all 12 abbreviations.

Description

When you install Production Reporting, the default locale is set to SYSTEM.

Table 6. SYSTEM Locale Settings

Keyword

Value

NUMBER‑EDIT‑MASK

PRINT prints two digits to the right of the decimal point and left justifies the number. MOVE, SHOW, and DISPLAY format the number with six digits to the right of the decimal point and left justifies the number.

MONEY-EDIT‑MASK

Same default values as those in NUMBER-EDIT-MASK.

DATE‑EDIT‑MASK

Date formats in Table 61, Default Formats by Database.

INPUT‑DATE-EDIT-MASK

Date edit masks in Table 59, Sample Date Edit Masks.

MONEY‑SIGN

'$'

MONEY‑SIGN‑LOCATION

LEFT

THOUSAND-SEPARATOR

','

DECIMAL-SEPARATOR

'.'

DATE-SEPARATOR

'/'

TIME‑SEPARATOR

':'

EDIT-OPTION‑NA

'n/a'

EDIT-OPTION-AM

'am'

EDIT-OPTION-PM

'pm'

EDIT-OPTION-BC

'bc'

EDIT-OPTION-AD

'ad'

DAY-OF-WEEK-CASE

EDIT

DAY-OF-WEEK-FULL

('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')

DAY-OF-WEEK-SHORT

('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')

MONTHS-CASE

EDIT

MONTHS=FULL

('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')

MONTHS-SHORT

('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')

Examples

The following code:

!
! The following program segments will illustrate the various
! ALTER-LOCALE features.
!
begin-setup
 declare-variable
  date $date $date1 $date2 $date3
 end-declare
end-setup
!
! Set default masks
!
alter-locale
  number-edit-mask = '9,999,999.99'
  money-edit-mask  = '$999,999,999.99'
  date-edit-mask   = 'Mon DD, YYYY'
 
let #value = 123456
let $edit = 'Mon DD YYYY HH:MI:SS'
let $date = strtodate('Jan 01 1995 11:22:33', $edit)
show 'With NUMBER option    #Value = ' #value number
show 'With MONEY  option    #Value = ' #value money
show 'Without NUMBER option #Value = ' #value
show 'With DATE option      $Date  = ' $date date
show 'Without DATE option   $Date  = ' $date 

Produces the following output:

With NUMBER option    #Value =   123,456.00
With MONEY  option    #Value = $123,456.00
Without NUMBER option #Value = 123456.000000
With DATE option      $Date  = Jan 01, 1995
Without DATE option   $Date  = 01-JAN-95

The following code:

!
! Reset locale to Production Reporting defaults and assign a multi-character
! money-sign.
!
alter-Locale
locale = 'System'
money-sign = 'AU$'           ! Australian dollars
 
let #value = 123456
show #value edit '$999,999,999,999.99'
show #value edit '$$$$,$$$$999,999.99'

Produces the following output:

AU$      123,456.00
      AU$123,456.00

The following code:

!
! Move the money-sign to the right side of the value.  Note
! the leading space.
!
alter-locale
  money-sign = ' AU$'             ! Australian dollars
  money-sign-location = right
let #value = 123456
show #value edit '$999,999,999,999.99'
show #value edit '$$$$,$$$$999,999.99'

Produces the following output:

123,456.00 AU$
123,456.00 AU$

The following code:

!
! Reset locale to Production Reporting defaults and flip the thousand and
! decimal separator characters.
!
alter-locale
  locale = 'System'
  thousand-separator = '.'
  decimal-separator = ','
 
let #value = 123456
show #value edit '999,999,999,999.99'

Produces the following output:

123.456,00

The following code:

!
! Reset locale to Production Reporting defaults and change the date and time
! separators
!
alter-locale
  locale = 'System'
  date-separator = '-'
  time-separator = '.'
 
let $edit = 'Mon/DD/YYYY HH:MI:SS'
let $date = strtodate('Jan/01/1995 11:22:33', $edit)
show $date edit :$edit

Produces the following output:

Jan-01-1995 11.22.33

The following code:

!
! Reset locale to Production Reporting defaults and change the text used with
! the edit options 'na', 'am', 'pm', 'bc, 'ad'
!
alter-locale
  locale = 'System'
  edit-option-na = 'Not/Applicable'
  edit-option-am = 'a.m.'
  edit-option-pm = 'p.m.'
  edit-option-bc = 'b.c.'
  edit-option-ad = 'a.d.'
 
let $value = ''
let $edit = 'Mon DD YYYY HH:MI'
let $date1 = strtodate('Jan 01 1995 11:59', $edit)
let $date2 = strtodate('Feb 28 1995 12:01', $edit)
show $value edit '999,999,999,999.99Na'
show $date1 edit 'Mon DD YYYY HH:MI:SS PM'
show $date2 edit 'Mon DD YYYY HH:MI:SS pm'

Produces the following output:

Not/Applicable
Jan 01 1995 11:59:00 A.M.
Feb 28 1995 12:01:00 p.m.

The following code:

!
! Input some dates using the 'system' locale and
! output using other locales from the SQR.INI file.
!
alter-locale
  locale = 'System'
let $date1 = strtodate('Jan 01 1995', 'Mon DD YYYY')
let $date2 = strtodate('Feb 28 1995', 'Mon DD YYYY')
let $date3 = strtodate('Mar 15 1995', 'Mon DD YYYY')
show 'System:'
show
show $date1 edit 'Month DD YYYY' ' is ' $date1 edit 'Day'
show $date2 edit 'Month DD YYYY' ' is ' $date2 edit 'Day'
show $date3 edit 'Month DD YYYY' ' is ' $date3 edit 'Day'
alter-locale
  locale = 'German'
show
show 'German:'
show 
show $date1 edit 'DD Month YYYY' ' ist ' $date1 edit 'Day'
show $date2 edit 'DD Month YYYY' ' ist ' $date2 edit 'Day'
show $date3 edit 'DD Month YYYY' ' ist ' $date3 edit 'Day'
alter-locale
  locale = 'Spanish'
show
show 'Spanish:'
show
show $date1 edit 'DD Month YYYY' ' es ' $date1 edit 'Day'
show $date2 edit 'DD Month YYYY' ' es ' $date2 edit 'Day'
show $date3 edit 'DD Month YYYY' ' es ' $date3 edit 'Day'

Produces the following output:

System:

January 01 1995 is Sunday
February 28 1995 is Tuesday
March 15 1995 is Wednesday

German:

01 Januar 1995 ist Sonntag
28 Februar 1995 ist Dienstag
15 März 1995 ist Mittwoch

Spanish:

01 enero 1995 es domingo
28 febrero 1995 es martes
15 marzo 1995 es miércoles

See Also