Summary:
See also: Utility Functions, Variables, Functions, Operators, Built-in Classes.
A built-in function is a predefined function that is included in the runtime system or provided as a library function automatically linked to your programs. You do not have to link with any additional BDL library to create your programs. The built-in functions are part of the language.
See also Utility Functions.
Function | Description |
ARG_VAL() | Returns a command line argument by position. |
ARR_COUNT() | Returns the number of records entered in a program array during or after execution of the INPUT ARRAY statement. |
ARR_CURR() | Returns the current row in a DISPLAY ARRAY or INPUT ARRAY. |
DOWNSHIFT() | Returns a string value in which all uppercase characters in its argument are converted to lowercase. |
ERR_GET() | Returns the text corresponding to an error number. |
ERR_PRINT() | Prints in the error line the text corresponding to an error number. |
ERR_QUIT() | Prints in the error line the text corresponding to an error number and terminates the program. |
ERRORLOG() | Copies the string passed as a parameter into the error log file. |
FGL_BUFFERTOUCHED() | Returns TRUE if the current input buffer was modified since the field was selected. |
FGL_DIALOG_GETBUFFER() | Returns the value of the current field as a string. |
FGL_DIALOG_GETBUFFERLENGTH() | When using a paged display array, returns the number of rows to fill the array buffer. |
FGL_DIALOG_GETBUFFERSTART() | When using a paged display array, returns the row offset to fill the array buffer. |
FGL_DIALOG_GETCURSOR() | Returns the position of the edit cursor in the current field. |
FGL_DIALOG_GETFIELDNAME() | Returns the name of the current input field. |
FGL_DIALOG_GETKEYLABEL() | Returns the text associated to a key in the current interactive instruction. |
FGL_DIALOG_INFIELD() | Returns TRUE if the field passed as a parameter is the current input field. |
FGL_DIALOG_SETBUFFER() | Sets the value of the current field as a string. |
FGL_DIALOG_SETCURRLINE() | Moves to a specific row in a record list. |
FGL_DIALOG_SETCURSOR() | Sets the position of the input cursor within the current field. |
FGL_DIALOG_SETFIELDORDER() | Enables or disables field order constraint. |
FGL_DIALOG_SETKEYLABEL() | Sets the text associated to a key for the current interactive instruction. |
FGL_DRAWBOX() | Draws a rectangle based on character terminal coordinates in the current open window. |
FGL_DRAWLINE() | Draws a line based on character terminal coordinates in the current open window. |
FGL_GETCURSOR() | Returns the position of the edit cursor in the current field. |
FGL_GETENV() | Returns the value of the environment variable having the name you specify as argument. |
FGL_GETFILE() | Transfers a file from the front-end to the application server machine. |
FGL_GETHELP( ) | Returns the help message according to a number. |
FGL_GETKEYLABEL() | Returns the default label associated to a key. |
FGL_GETPID( ) | Returns the system process id. |
FGL_GETRESOURCE( ) | Returns the value of an FGLPROFILE entry. |
FGL_GETVERSION( ) | Returns the build number of the runtime system. |
FGL_GETWIN_HEIGHT() | Returns the number of rows of the current window. |
FGL_GETWIN_WIDTH() | Returns the width of the current window as a number of columns. |
FGL_GETWIN_X() | Returns the horizontal position of the current window. |
FGL_GETWIN_Y() | Returns the vertical position of the current window. |
FGL_KEYVAL() | Returns the key code of a logical or physical key. |
FGL_LASTKEY() | Returns the key code of the last key pressed by the user. |
FGL_PUTFILE() | Transfers a file from from the application server machine to the front-end. |
FGL_REPORT_PRINT_BINARY_FILE() | Prints a file containing binary data during a report. |
FGL_REPORT_SET_DOCUMENT_HANDLER() | Defines the document handler to be used for a report. |
FGL_SET_ARR_CURR() | Sets the current line in a record list. |
FGL_SETENV() | Sets an environment variable |
FGL_SETKEYLABEL() | Sets the default label associated to a key. |
FGL_SETSIZE() | Sets the size of the main application window. |
FGL_SETTITLE() | Sets the title of the main application window. |
FGL_SYSTEM() | Starts a program in a UNIX terminal emulator when using a graphical front end. |
FGL_WIDTH() | Returns the number of columns needed to represent the string. |
FGL_WINDOW_GETOPTION() | Returns the attributes of the current window. |
LENGTH() | Returns the number of characters of the string passed as a parameter. |
NUM_ARGS() | Returns the number of program arguments. |
ORD() | Returns the ASCII value of the first byte of a character expression. |
SCR_LINE() | Returns the number of the current screen record in its screen array. |
SET_COUNT() | Specifies the number of records that contain data in a static array. |
SHOWHELP() | Displays a runtime help message, corresponding to its specified argument, from the current help file. |
STARTLOG() | Initializes error logging and opens the error log file passed as a parameter. |
UPSHIFT() | Returns a string value in which all lowercase characters in its argument are converted to uppercase. |
Function | Description |
FGL_FORMFIELD_GETOPTION() | Returns attributes of a specified form field. |
FGL_GETKEY() | Waits for a keystroke and returns the key code. |
FGL_GETUITYPE() | Returns the type of the front end. |
FGL_SCR_SIZE( ) | Returns the number of rows of a screen array of the current form. |
FGL_WINDOW_OPEN( ) | Opens a new window with coordinates and size. |
FGL_WINDOW_OPENWITHFORM( ) | Opens a new window with coordinates and form. |
FGL_WINDOW_CLEAR( ) | Clears the window having the name that is passed as a parameter. |
FGL_WINDOW_CLOSE( ) | Closes the window having the name that is passed as a parameter. |
FGL_WINDOW_CURRENT( ) | Makes current the window having the name that is passed as a parameter. |
This function returns a command line argument by position.
CALL ARG_VAL( position INTEGER ) RETURNING
result STRING
This function provides a mechanism for passing values to the program through the command line that invokes the program. You can design a program to expect or allow arguments after the name of the program in the command line.
Like all built-in functions, ARG_VAL()
can be invoked from any program
block. You can use it to pass values to MAIN,
which cannot have formal arguments, but you are not restricted to calling ARG_VAL()
from the MAIN statement. You can use the ARG_VAL()
function to
retrieve individual arguments during program execution. You can also use the
NUM_ARGS() function to determine how many arguments
follow the program name on the command line.
If position is greater than 0, ARG_VAL(position)
returns the command-line
argument used at a given position. The value of position must be between 0
and the value returned by NUM_ARGS(), the number of
command-line arguments.
The expression ARG_VAL(0)
returns the name of the application program.
See also: NUM_ARGS().
This function returns the number of program arguments.
CALL NUM_ARGS( ) RETURNING result INTEGER
See also: ARG_VAL().
This function returns the number of the current screen record in its screen array.
CALL SCR_LINE( ) RETURNING result INTEGER
See also: ARR_CURR().
This function specifies the number of records that contain data in a static array.
CALL SET_COUNT( nbrows INTEGER )
When using a static
array in an INPUT ARRAY (with WITHOUT DEFAULTS
clause) or a DISPLAY ARRAY statement, you must specify the total
number of records in the array. In typical applications, these
records contain the values in the retrieved rows that a SELECT statement returned from
a database cursor. You specify the number of rows with the
SET_COUNT()
function or with the COUNT attribute of
INPUT ARRAY and DISPLAY ARRAY statements.
Warning: You do not have to specify the number of rows when using a dynamic array. When using a dynamic array, the number of rows is defined by the getLength() method of the array object.
See also: ARR_CURR(), FGL_SET_ARR_CURR().
This function returns the number of records entered in a program array during or after execution of the INPUT ARRAY statement.
CALL ARR_COUNT( ) RETURNING result INTEGER
You can use ARR_COUNT()
to determine the number of program records that
are currently stored in a program array. In typical FGL applications, these records correspond to values from
the
result set of retrieved database rows from the most recent query. By first calling the
SET_COUNT() function or by using the COUNT attribute of
INPUT ARRAY, you can set an upper limit on the value that ARR_COUNT()
returns.
ARR_COUNT()
returns a positive integer, corresponding to the index of the furthest record within the program array that the
user accessed. Not
all the rows counted by ARR_COUNT()
necessarily contain data (for
example, if the user presses the DOWN ARROW key more times than there are rows of
data).
See also: INPUT ARRAY, ARR_CURR().
This function returns the current row in a DISPLAY ARRAY or INPUT ARRAY.
CALL ARR_CURR( ) RETURNING result INTEGER
The ARR_CURR()
function returns an integer value that identifies
the current row of a list of rows in a INPUT ARRAY
or DISPLAY
ARRAY instruction. The first row is numbered 1.
You can pass ARR_CURR()
as an argument when you call a function. In this way
the function receives as its argument the current record of whatever array is
referenced in the INPUT ARRAY or DISPLAY
ARRAY statement.
The ARR_CURR()
function can be used to force a FOR loop to begin beyond the
first line of an array by setting a variable to ARR_CURR()
and using that
variable as the starting value for the FOR
loop.
The built-in functions ARR_CURR()
and SCR_LINE() can return
different values if the program array is larger than the screen array.
See also: INPUT ARRAY, DISPLAY ARRAY, ARR_COUNT(), FGL_SET_ARR_CURR(), SCR_LINE().
This function returns the text corresponding to an error number.
CALL ERR_GET( error-number INTEGER ) RETURNING
result STRING
See also: ERRORLOG(), STARTLOG(), ERR_QUIT(), ERR_PRINT(), Exceptions.
This function prints in the error line the text corresponding to an error number.
CALL ERR_PRINT( error-number INTEGER )
See also: ERRORLOG(), STARTLOG(), ERR_QUIT(), ERR_GET(), Exceptions.
This function prints in the error line the text corresponding to an error number and terminates the program.
CALL ERR_QUIT( error-number INTEGER )
See also: ERRORLOG(), STARTLOG(), ERR_QUIT(), ERR_GET(), Exceptions.
This function copies the string passed as parameter into the error log file.
CALL ERRORLOG( text STRING )
See also: STARTLOG(), Exceptions.
This function function displays a runtime help message, corresponding to its specified argument, from the current help file.
CALL SHOWHELP( help-number INTEGER )
See also: OPTIONS, Message Files.
This function initializes error logging and opens the error log file passed as the parameter.
CALL STARTLOG( filename STRING )
Call STARTLOG()
in the MAIN program
block to open or create an error log file. After STARTLOG()
has been invoked, a record of every subsequent error that
occurs during the execution of your program is written in the error log file. If
you need to report specific application errors, use the ERRORLOG()
function to make an entry in the error log file.
The default format of an error record consists of the date, time, source-module name
and line number, error number, and error message. If you invoke the STARTLOG()
function, the format of the error records appended to the error log file after each
subsequent error are as follows:
Date: 03/06/99 Time: 12:20:20 Program error at "stock_one.4gl", line number 89. SQL statement error number -239. Could not insert new row - duplicate value in a UNIQUE INDEX column. SYSTEM error number -100 ISAM error: duplicate value for a record with unique key.
The STARTLOG()
and ERRORLOG() functions can be
used for instrumenting a program, to track how the program is used. This use is not
only valuable for improving the program but also for recording work habits and detecting
attempts to breach security.
If the argument of STARTLOG()
is not the name of an existing file,
STARTLOG()
creates one. If the file already exists, STARTLOG()
opens it and positions the file pointer so that subsequent error messages can be appended
to this file. The following program fragment invokes STARTLOG()
, specifying
the name of the error log file in a quoted string that includes a pathname and a file
extension. The function definition includes a call to the built-in ERRORLOG()
function, which adds a message to the error log file.
See also: ERRORLOG(), Exceptions.
This function returns TRUE if the input buffer was modified after the current field was selected.
CALL FGL_BUFFERTOUCHED( ) RETURNING result INTEGER
See also: FGL_DIALOG_SETBUFFER(), FGL_DIALOG_GETBUFFER().
This function returns the value of the current field as a string.
CALL FGL_DIALOG_GETBUFFER( ) RETURNING result
STRING
See also: FGL_DIALOG_SETBUFFER(), FGL_BUFFERTOUCHED(), GET_FLDBUF().
This function sets the input buffer of the current field, and assigns corresponding program variable when using UNBUFFERED mode.
CALL FGL_DIALOG_SETBUFFER( value STRING )
With the default buffered input mode, this function modifies the input buffer of the current field; the corresponding input variable is not assigned. It makes no sense to call this function in BEFORE FIELD blocks of INPUT and INPUT ARRAY. However, if the statement is using the UNBUFFERED mode, the function will set both the field buffer and the program variable. If the string set by the function does not represent a valid value that can be stored by the program variable, the buffer and the variable will be set to NULL.
See also: FGL_DIALOG_GETBUFFER(), FGL_BUFFERTOUCHED(), GET_FLDBUF().
This function returns the name of the current input field.
CALL FGL_DIALOG_GETFIELDNAME( ) RETURNING result
STRING
See also: FGL_DIALOG_INFIELD().
This function returns TRUE if the field passed as the parameter is the current input field.
CALL FGL_DIALOG_INFIELD( field-name STRING )
RETURNING result INTEGER
See also: INFIELD().
This function sets the position of the input cursor in the current field.
CALL FGL_DIALOG_SETCURSOR( index INTEGER )
See also: FGL_GETCURSOR().
This function enables or disables field order constraint.
CALL FGL_DIALOG_SETFIELDORDER( active INTEGER )
Typical BDL applications control user input with BEFORE FIELD and AFTER FIELD blocks. In many cases the field order and the sequential execution of AFTER FIELD blocks is important in order to validate the data entered by the user. But with graphical front ends you can use the mouse to move to a field. By default the runtime system executes all BEFORE FIELD and AFTER FIELD blocks of the fields used by the interactive instruction, from the origin field to the target field selected by mouse click. If needed, you can force the runtime system to ignore all intermediate field triggers, by calling this function with a FALSE attribute.
This function moves to a specific row in a record list.
CALL FGL_DIALOG_SETCURRLINE( line INTEGER, row
INTEGER )
This function moves to a specific row in a record list.
CALL FGL_SET_ARR_CURR( row INTEGER )
When a new row is reaching by using with this function, the first field editable gets the focus.
Warning: Control blocks like BEFORE ROW and field/row validation in INPUT ARRAY are performed, as if the user moved to another row, except when the function is called in BEFORE DISPLAY or BEFORE INPUT.
This function sets the value of an environment variable.
CALL FGL_SETENV( variable STRING, value
STRING )
See also: FGL_GETENV()
This function draws a rectangle based on the character terminal coordinates in the current open window.
CALL FGL_DRAWBOX( height, width, line,
column, color INTEGER )
See also: FGL_DRAWLINE().
This function draws a line based on the character terminal coordinates in the current open window.
CALL FGL_DRAWLINE( posX, posY, width, color
INTEGER )
See also: FGL_DRAWBOX().
This function returns the key code of the last key pressed by the user.
CALL FGL_LASTKEY( ) RETURNING result INTEGER
See also: FGL_KEYVAL().
This function returns the key code of a logical or physical key.
CALL FGL_KEYVAL( character STRING ) RETURNING
result INTEGER
FGL_KEYVAL()
are: ACCEPT, HELP,
NEXT, RETURN, DELETE, INSERT, NEXTPAGE,
RIGHT, DOWN, INTERRUPT, PREVIOUS, TAB,
ESC, ESCAPE, LEFT, PREVPAGE, UP,
F1 through F64, CONTROL-character
( except A, D, H, I, J, L, M, R, or X )FGL_KEYVAL()
considers the case.
In all other instances, the function ignores the case of its argument, which
can be uppercase or lowercase letters.FGL_KEYVAL()
is well supported in text
mode, but this function can only be emulated in GUI mode, because the
front-ends communicate with the runtime system with other events as
keystrokes. FGL_KEYVAL()
can be used in form-related statements to examine a value returned by the
FGL_LASTKEY() function.
To determine whether the user has performed an action, such as inserting a row, specify the logical
name of the action (such as INSERT) rather than the name of the physical key (such as F1).
For example, the logical name of the default Accept key is ESCAPE. To test if the key most recently
pressed by the user was the Accept key, specify FGL_KEYVAL("ACCEPT")
rather
than FGL_KEYVAL("escape")
or FGL_KEYVAL("ESC")
.
Otherwise, if a key other than ESCAPE is set as the Accept key and the user presses that key,
FGL_LASTKEY()
does not return a code equal to FGL_KEYVAL("ESCAPE")
.
The value returned by FGL_LASTKEY()
is undefined in a MENU statement.
See also: FGL_LASTKEY().
This function prints a file containing binary data during a report.
CALL FGL_REPORT_PRINT_BINARY_FILE( filename
STRING )
This function redirects the next report to an XML document handler.
CALL FGL_REPORT_SET_DOCUMENT_HANDLER( handler om.SaxDocumentHandler )
This function returns the position of the edit cursor in the current field.
CALL FGL_GETCURSOR( ) RETURNING index INTEGER
See also: FGL_DIALOG_SETCURSOR().
This function returns the number of rows of the current window.
CALL FGL_GETWIN_HEIGHT( ) RETURNING result INTEGER
See also: FGL_GETWIN_WIDTH().
This function returns the width of the current window as a number of columns.
CALL FGL_GETWIN_WIDTH( ) RETURNING result INTEGER
See also: FGL_GETWIN_WIDTH().
This function returns the horizontal position of the current window.
CALL FGL_GETWIN_X( ) RETURNING result INTEGER
See also: FGL_GETWIN_Y().
This function returns the vertical position of the current window.
CALL FGL_GETWIN_X( ) RETURNING result INTEGER
See also: FGL_GETWIN_X().
This function returns the number of bytes of the expression passed as parameter.
CALL LENGTH( expression ) RETURNING result
INTEGER
See also: FGL_WIDTH().
This function returns the build number of the runtime system.
CALL FGL_GETVERSION( ) RETURNING result STRING
Returns the help text according to its identifier by reading the current help file.
CALL FGL_GETHELP( id INTEGER ) RETURNING result
STRING
See also: The OPTIONS instruction.
This function returns the system process identifier.
CALL FGL_GETPID() RETURNING result INTEGER
See also: FGL_SYSTEM().
This function returns the row offset of the page to feed a paged display array.
CALL FGL_DIALOG_GETBUFFERSTART( ) RETURNING result INTEGER
See DISPLAY ARRAY.
This function returns the number of rows of the page to feed a paged display array.
CALL FGL_DIALOG_GETBUFFERLENGTH( ) RETURNING result INTEGER
See DISPLAY ARRAY.
Transfers a file from the application server machine to the front end workstation.
CALL fgl_putfile(src STRING, dst STRING)
Transfers a file from the front end workstation to the application server machine.
CALL fgl_getfile(src STRING, dst STRING)
This function returns the value of the environment variable having the name you specify as the argument.
CALL FGL_GETENV( variable STRING ) RETURNING
result STRING
The argument of FGL_GETENV()
must be the name of an environment variable. If the
requested value exists in the current user environment, the function returns it
as a character string and then returns control of execution to the calling
context.
See also: FGL_SETENV()
This function returns the default label associated to a key.
CALL FGL_GETKEYLABEL( keyname STRING ) RETURNING
result STRING
See also: FGL_SETKEYLABEL(), FGL_DIALOG_GETKEYLABEL().
This function sets the default label associated to a key.
CALL FGL_SETKEYLABEL( keyname STRING, label
STRING )
See also: FGL_SETKEYLABEL(), FGL_DIALOG_SETKEYLABEL().
This function returns the label associated to a key for the current interactive instruction.
CALL FGL_DIALOG_GETKEYLABEL( keyname STRING )
RETURNING result STRING
See also: FGL_SETKEYLABEL(), FGL_DIALOG_SETKEYLABEL().
This function sets the label associated to a key for the current interactive instruction.
CALL FGL_DIALOG_SETKEYLABEL( keyname STRING, label
STRING )
See also: FGL_SETKEYLABEL(), FGL_DIALOG_GETKEYLABEL().
This function sets the size of the main application window.
CALL FGL_SETSIZE( width INTEGER, height INTEGER
)
See also: FGL_SETTITLE().
This function sets the title of the main application window.
CALL FGL_SETTITLE( label
STRING )
See also: FGL_SETSIZE().
This function starts a program in a UNIX terminal emulator when using a graphical front end.
CALL FGL_SYSTEM( command STRING )
The function starts a program that needs a UNIX terminal emulator when using the Windows Front End, even if the current program has been started without a visible terminal. The command parameter is a string or variable that contains the commands to be executed. The UNIX terminal will be raised and activated. The terminal is automatically lowered when the child process finishes.
See also: WINEXEC().
This function returns the number of columns needed to represent the printed version of the expression.
CALL FGL_WIDTH( expression ) RETURNING result
INTEGER
See also: LENGTH().
This function returns attributes of the current window.
CALL FGL_WINDOW_GETOPTION( attribute STRING )
RETURNING result STRING
This function returns the value of an FGLPROFILE entry.
CALL FGL_GETRESOURCE( name STRING ) RETURNING
result STRING
This function accepts as its argument a character expression and returns the integer value of the first byte of that argument.
CALL ORD( source STRING ) RETURNING result
INTEGER
See also: FGL_KEYVAL(), ASCII().
This function returns returns a string value in which all uppercase characters in its argument are converted to lowercase.
CALL DOWNSHIFT( source STRING ) RETURNING result
STRING
See also: UPSHIFT().
This function returns a string value in which all lowercase characters in its argument are converted to uppercase.
CALL UPSHIFT( source STRING ) RETURNING result
STRING
See also: DOWNSHIFT().
Warning: These are internal key codes. Avoid hardcoding these numbers in your sources; otherwise your 4gl source will not be compatible with future versions of Genero FGL. Always use the FGL_KEYVAL(keyname) function instead.
Value | Key name | Description |
1 to 26 | Control-x | Control key, where x is the any letter from A to Z. The key code corresponding to Control-A is 1, Control-B is 2, etc. |
others < 256 | ASCII chars | Other codes correspond to the ASCII characters set. |
2000 | up | The up-arrow logical key. |
2001 | down | The down-arrow logical key. |
2002 | left | The left-arrow logical key. |
2003 | right | The right-arrow logical key. |
2005 | nextpage | The next-page logical key. |
2006 | prevpage | The previous-page logical key. |
2008 | help | The help logical key. |
2011 | interrupt | The interrupt logical key. |
2012 | home | The home logical key. |
2013 | end | The end logical key. |
2016 | accept | The accept logical key. |
2017 | backspace | The backspace logical key. |
3000 to 3255 | Fx | Function key, where x is the number of the function key. The key code corresponding to a function key Fx is 3000+x-1, for example, 3011 corresponds to F12. |