Informix Training
Informix Training
TRAINING
Compiling:
Rapid Development System:
Source file .4glPseudo code
C Compiler System:
Source .4gl->Intermediate fles->Executable file .4ge
RDS C Compiler
» Compile Time Less More
» Run Time More Less
»PROGRAM
»MODULE
»FUNCTION
»FORM
»MAIN
»FUNCTION
»REPORT
Extension Description
.4gl Informix 4GL source
module
.4ge C Compiled version
executable
.o C Compiled version
object
.4go RDS Version object
SYNTAX:
DEFINE variablename data-type
Example:
DEFINE fname CHAR(10)
DEFINE start_date DATE
DEFINE x,y,z INTEGER
(OR)
DEFINE fname CHAR(10),
start_date DATE,
x,y,z INTEGER
EXAMPLE:
emp_main.4gl
glob.4gl
GLOBALS “Glob.4gl”
GLOBALS
DEFINE var2 SMALLINT
DEFINE var1 CHAR(1) Variable Scope
MAIN
END GLOBALS
var1 Global
DEFINE var3 INTEGER
CALL funct1() var2 Module
Var3 Local
END MAIN
var4 Local
FUCTION funct1()
DEFINE var4 CHAR(1)
END FUNCTION
| © Kanbay Incorporated. All Rights Reserved
COMMENTS in 4GL
» IF
» CASE
» WHILE
» FOR
SYNTAX:
IF ……THEN
…………..
ELSE
…….
END IF
Example :
IF var_name MATCHES “[Yy]” THEN
ERROR “Customer will be deleted.”
ELSE
ERROR “Delete cancelled.”
END IF.
Syntax: IF ….THEN
IF…..THEN
……………
END IF
END IF
EXAMPLE:
IF state=“IL” THEN
IF zipcode MATCHES “601*” THEN
ERROR “City is Schaumburg”
END IF
END IF
Syntax:
WHILE Boolean expression
statement(s)….
[EXIT WHILE]……
[CONTINUE WHILE]…..
END WHILE
EXAMPLE:
WHILE boss_in_office = TRUE
CALL act_busy() RETURNING boss_in_office
END WHILE
Example:
DEFINE i SMALLINT
FOR i=1 TO 10
DISPLAY “i = “, i AT i,1
END FOR
»The screen is the area of the terminal where you can display
the information.
»Default size of the screen is 24*80
»Informix -4GL allows you to break the screen area into
smaller sections called windows.
Example:
OPEN WINDOW w_yesno AT 10,10 WITH 4 ROWS,20
COLUMNS ATTRIBUTE (BORDER)
»ERROR
»DISPLAY
»MESSAGE
»PROMPT
Example:
MESSAGE “Press the first letter of an option.” ATTRIBUTE
(REVERSE)
ATTRIBUTES:
UNDERLINE REVERSE INVISIBLE
BOLD BLINK NORMAL
DIM
Syntax:
ERROR display-list [ATTRIBUTE(attribute-list)]
EXAMPLE:
ERROR “No Rows Found.”
ATTRIBUTES:
UNDERLINE REVERSE INVISIBLE
BOLD BLINK NORMAL
DIM
EXAMPLE:
DISPLAY “Row Added.” AT 22,3 ATTRIBUTE (reverse)
ATTRIBUTES:
UNDERLINE REVERSE INVISIBLE
BOLD BLINK NORMAL
DIM
EXAMPLE:
OPTIONS
MESSAGE LINE FIRST + 2,
ERROR LINE 23,
PROMPT LINE LAST -3
Syntax:
OPEN FORM form-name FROM form-file
Example:
OPEN FORM cust FROM “cust_form”
Cust_form :Name that you gave the form when it was created
Cust :How you will refer to the form throughout the program.
OPEN FORM only loads the form onto the memory and does
not display it.
DISPLAY FORM:
DISPLAY FORM cust
Opens the form from the memory.
CLEAR SCREEN:
Clears the form from the screen but the form still exists in the
memory.
CLOSE FORM:
CLOSE FORM cust
Removes the form from the memory.