Specifying NUMBER, MONEY, and DATE Keywords
The DISPLAY, MOVE, PRINT, and SHOW commands enable you to specify the NUMBER , MONEY, and DATE keywords in place of an explicit number or date edit mask. These keywords can be useful in two cases.
The first case is when you want to write programs that automatically adapt to the default locale. By using the NUMBER, MONEY, and DATE keywords, you instruct SQR to take these edit masks from the default locale settings.
The second case is when you want to specify number, money, and date formats once at the top of the program and use these formats throughout the report. In this case, you define these formats with an ALTER-LOCALE command at the top of the program. When you use the NUMBER, MONEY, and DATE keywords later in the program, they format number, money, and date outputs with the masks that you defined in the ALTER-LOCALE command.
Whether you set the locale in the pssqr.ini file or in the program, these keywords have the same effect. In the following code example, these keywords are used with the PRINT command to produce output for the US-English and French locales:
let #num_var = 123456
let #money_var = 123456
let $date_var = strtodate('20040520152000')
! set locale to US-English
alter-locale locale = 'US-English'
print 'US-English locale' (1,1)
print 'With NUMBER keyword ' (+1,1)
print #num_var (,22) NUMBER
print 'With MONEY keyword ' (+1,1)
print #money_var (,22) MONEY
print 'With DATE keyword ' (+1,1)
print $date_var (,22) DATE! set locale to French
ALTER-LOCALE locale = 'French'
print 'French locale' (+2,1)
print 'With NUMBER keyword ' (+1,1)
print #num_var (,22) NUMBER
print 'With MONEY keyword ' (+1,1)
print #money_var (,22) MONEY
print 'With DATE keyword ' (+1,1)
print $date_var (,22) DATE
Here is the program output:
US-English locale
With NUMBER keyword 123,456.00
With MONEY keyword $ 123,456.00
With DATE keyword May 20, 2004
French locale
With NUMBER keyword 123.456,00
With MONEY keyword 123.456,00 F
With DATE keyword 20 Mai 2004