Section 7.4: Quick Reference Up Chapter 7: 4GL Language Section 7.6: Form Syntax 

7.5 Builtin Functions

Informix 4GL has a set of 40 or more functions built in to the language. Aubit4GL implements all of these.
Aubit4gl also implements a few functions to make the compiler compatible with programs written for D4GL.
Finally Aubit4GL has added some builtins of its own to allow you to exploit Aubit4GL’s special features such as GUI interfaces, different database engines, etc.

7.5.1 Standard 4GL Builtin Functions

The following functions in 4GL work in Aubit4GL:
Function Comment
arg_val(n) returns a string
arr_count() returns smallint
arr_curr() returns smallint
downshift(s) returns string with chars downshifted to lowercase
err_get(n) returns a string
err_print(n) displays a string
err_quit(n) displays a string then exits
errorlog(s) logs message s to logfile
fgl_drawbox(h, w, y, x [,clr])
fgl_getenv(s) returns string
fgl_keyval(s) returns integer code
fgl_lastkey() returns integer code
length(s) returns smallint
num_args() returns smallint
scr_line() returns smallint
set_count(n)
showhelp(n) displays help message n
sqlexit(n) returns 0, after closing connection to database
startlog(s)
upshift(s) returns string with chars upshifted to uppercase

7.5.2 Standard 4GL Operators

The following functions are described by Informix 4GL as builtin operators. They work in Aubit4GL:
Operator Comment
ascii(n)
returns a char,
e.g. ascii(64) returns ’A’
date(s) returns a date
date returns a string
e.g. Wed Aug 15 2006
day(d) returns 1..31
extend(d or dt, format) returns a date or datetime
field_touched(rec.field) returns TRUE or FALSE
get_fldbuf(rec.field) returns string contents of field
hex(n) returns string e.g. 0x0000001c
in()
infield(rec.field) returns TRUE or FALSE
mdy(m,d,y) returns date from args month, day, year
month(d or dt) returns 1:12
ord(c) returns smallint
time returns string
today returns date
year(date) returns smallint


7.5.3 D4GL Builtin Functions

The following are do-nothing functions which allow 4J’s D4GL programs to compile:
Function Comment
ddeconnect()
ddeexecute()
ddefinish()
ddefinishall()
ddegeterror()
ddepeek()
ddepoke()

7.5.4 Aubit Builtin Functions

Function Return Values
_variable(name) pointer to object (e.g. cursor, form, window, etc)
abs( n ) absolute value of n
a4gl_get_info("o","id","p") See below
a4gl_get_page()
a4gl_get_ui_mode() 0|1 (0=TUI, 1=GTK)
a4gl_run_gui()
a4gl_set_page()
a4gl_show_help(n)
dbms_dialect() "INFORMIX"|"POSTGRES"|...
fgl_buffertouched(s) TRUE|FALSE
fgl_dialog_get_buffer() string
fgl_dialog_getfieldname() string
fgl_dialog_setbuffer(value)
fgl_dialog_setcurrline(n)
fgl_dialog_setkeylabel("key","label")
fgl_getkey_wait(n)
fgl_setkeylabel("key","label")
fgl_prtscr()
fgl_scr_size(srec) returns int
fgl_set_arr_line(n)
fgl_keysetlabel("key","label")
fgl_set_scrline(n)
fgl_strtosend(s) returns string
fgl_winmessage(s)
load_datatype(s)
set_window_title(s)
sqrt(n) returns square root of n
winexec(s)
winexecwait(s)

7.5.5 a4gl_get_info()

Synopsis:a4gl_get_info( "object", "id", "property")
where "object" in ("Form"|"Window"|"Connection"|"Statement")
and "id" is the quoted variable name of instance of the object
and property is an element of the set of properties of the object as follows:
In the properties below, replace the % with a value 1 .. maxelement.

7.5.5.1 Connection

Synopsis:a4gl_get_info("Connection", "", "Database")
Database in the only property available. The id argument is ignored.

7.5.5.2 Form

Form Property Return Value
Database char
Delimiters char
ScreenRecordCount int
ScreenRecordName% int
AttributeCount int
CurrentField int
Width int
Height int
Field% long?
ScreenName% char
TableName% char
AliasName% char
FieldType% char
FieldSize int
FieldBytes int
FieldDets long
Screens long

7.5.5.3 Statement

Atatement Property Return Value
NoColumns int
NoRows int
Name% char
Type% char
Scale% int
Nullable% int
Length% int

7.5.5.4 Window

Window Property Return Value
Height int
Width int
BeginX char
BeginY char
Border int
Metrics int,int,int,int (x, y, h, w)


7.5.6 aclfgl_ Builtins

7.5.6.1 Procedures

These do not return values. Prefix them with aclfgl_
e.g. call aclfgl_client_set()
Procedure (prefixed: aclfgl_)
call_in_shared( lib, func)
client_execute( string)
client_set()
delete_file(filename)
dump_screen(string, h,w,y,x)
expand_env_vars_in_cmd_line()
flush_inp()
flush_ui()
sendfile_to_ui(filename)
send_to_ui(string)
set_color(c, r,g,b)
setenv(varname, value)
set_pdf_encoding(encoding)

7.5.6.2 Functions

These all return values. Prefix with aclfgl_
e.g. LET random=aclfgl_random(13)
Function (prefixed: aclfgl_) Returns
file_exists(filename) true|false
getclientfile() various?
get_connection_username() name
get_construct_element(tab,col,t,l) value
get_curr_height() h
get_curr_width() w
getcwd() dirname
get_pdf_encoding() encoding
get_sql_requirement string
get_stack_trace() trace
get_user() name
parse_csv(line) several?
random(n) random%n
read_pipe(command) output
replace_in_string(str, repl, with) string
replace_start(string, with, start) string
split_on_delimiter( line) lines
tea_string_decypher(code) string
tea_string_encypher(string) code
text_as_str(text) string
trim_nl(string) string
get_error_details() returns
  1. lineno INTEGER
  2. ModuleName CHAR(255)
  3. Message CHAR(255)
  4. State INTEGER
See under Aubit4GL Extensions
 Section 7.4: Quick Reference Up Chapter 7: 4GL Language Section 7.6: Form Syntax