prog.4gl - the program module

The program module opens the form containing Localized Strings. The program module also contains Localized Strings for messages to be displayed.

Module prog.4gl:
01 SCHEMA custdemo 
02
03 MAIN
04  CONNECT TO "custdemo"
05  CLOSE WINDOW SCREEN
06  OPEN WINDOW w1 WITH FORM "stringform"
07  MESSAGE %"customer.msg"
08  MENU %"customer.menu" 
09     ON ACTION query 
10       CALL query_cust()
11     ON ACTION exit 
12       EXIT MENU
13  END MENU
14  CLOSE WINDOW w1
15  DISCONNECT CURRENT
16 END MAIN
17
18 FUNCTION query_cust() -- displays one row 
19   DEFINE l_custrec RECORD
20          store_num LIKE customer.store_num,
21          store_name LIKE customer.store_name,
22          city LIKE customer.city 
23   END RECORD,
24   msg STRING
25 
26   WHENEVER ERROR CONTINUE
27   SELECT store_num, store_name, city 
28    INTO l_custrec.*
29    FROM customer 
30    WHERE store_num = 101
31   WHENEVER ERROR STOP
32
33   IF SQLCA.SQLCODE = 0 THEN
34      LET msg = SFMT( %"customer.valid",
35                      l_custrec.store_num )
36      MESSAGE msg 
37      DISPAY BY NAME l_custrec.*
38   ELSE
39      MESSAGE %"customer.notfound"
40   END IF
41 
42 END FUNCTION
Note:
  • Lines 07, 08, 34 and 39 contain Localized Strings for the messages that the program displays.

These strings will be replaced at runtime.

The string file associated with this program module

You can view the translations for the Localized Strings in the program module in the progstrings.str string source file.
01 "customer.msg"="Program retrieves dealer #101"
02 "customer.menu"="Dealer"
03 "customer.valid"="Customer %1 is valid"
04 "customer.notfound"="Customer was not found"