INFORMIX-4GL
Quick Syntax
Version 6.0April 1994Part No. 000-7609
2
Published by INFORMIX® Press Informix Software, Inc.4100 Bohannon DriveMenlo Park, CA 94025
The following are worldwide trademarks of Informix Software, Inc., or its subsidiaries, registered in the United States ofAmerica as indicated by an “®,” and in numerous other countries worldwide:
INFORMIX® and C-ISAM®.
The following are worldwide trademarks of the indicated owners or their subsidiaries, registered in the United States ofAmerica as indicated by an “®,” and in numerous other countries worldwide:
X/OpenCompany Ltd.: UNIX®; X/Open®
Adobe Systems Incorporated: Post Script®
Some of the products or services mentioned in this document are provided by companies other than Informix. Theseproducts or services are identified by the trademark or servicemark of the appropriate company. If you have a questionabout one of those products or services, please call the company in question directly.
ACKNOWLEDGMENTS
The following people contributed to this version of INFORMIX-4GL Quick Syntax:
Documentation Team: Adam Barnett, Kaye Bonney, Lisa Braz, Tom Houston, Liz Knittel, Jerry Pope
Technical Contributors: Jonathan Leffler, Sally Cox
Copyright © 1981-1994 by Informix Software, Inc. All rights reserved.
No part of this work covered by the copyright hereon may be reproduced or used in any form or by any means—graphic,electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems—without permission of the publisher.
RESTRICTED RIGHTS LEGEND
Software and accompanying materials acquired with United States Federal Government funds or intended for use withinor for any United States federal agency are provided with “Restricted Rights” as defined in DFARS 252.227-7013(c)(1)(ii) orFAR 52.227-19.
Table ofContents
INFORMIX-4GLQuick Syntax
Introduction 5Syntax Conventions 6Basics 9Data Types 104GL Arithmetic Operators 10Boolean Operators 104GL Relational Operators 10Global Constants and Variables 11Built-In Functions 11Operators 11Library Functions 12Display Attributes 15Command-Line Syntax 16
4GL Statements 19Types of SQL Statements 20Other Types of 4GL Statements 214GL Statement Segments 37
4GL Forms 47Form Specification Syntax 48Attributes 50
Reports 55Report Specification Syntax 56Report Execution Statements 59
SQL Statements 61SQL Segments 91Stored Procedure Language Statements 105
4
SQLCA Record 113
Interactive Debugger Commands 117Command-Line Syntax 1194GL Interactive Debugger Command Segments 126
Environment Variables 129
Default Key Assignments 133
Introduction
Syntax Conventions6
This Guide presents a quick reference to the material listed in the following table. Fora full discussion of each topic, refer to the corresponding documentation.
This Guide shows syntax that must be prepared before you can include it in a 4GLprogram. You must prepare any SQL statement introduced later than the 4.1 serverrelease. These statements are indicated in this manual by the following icon:
To use these statements, such as CREATE TRIGGER, you must:
1. Store the SQL statement as a character string.2. Set up the statement for execution by means of the PREPARE statement (see
page 79).3. Process the statement by means of the EXECUTE statement (see page 75).
Syntax diagrams describe the format of SQL, SPL, and 4GL statements and Debuggercommands, including alternative forms of them, required and optional parts ofthem, and so forth. Syntax diagrams have their own conventions, which are definedin detail and illustrated in this section.
Each syntax diagram displays the sequences of required and optional elements thatare valid in a statement or command. Briefly:
• All keywords are shown in uppercase letters for ease of identification, thoughyou need not enter them that way.
• Words for which you must supply values are in italics.
• All boldface characters are literals.
Topic Reference Documentation Section
Data types INFORMIX-4GL Reference Chapter3(DEFINE)
Built-in functions and operators INFORMIX-4GL Reference Chapter 4
4GL statements INFORMIX-4GL Reference Chapter 3
SQL statements4.1 servers:6.0 servers:
Informix Guide to SQL: ReferenceInformix Guide to SQL: Syntax, Version 6.0
Chapter 6Chapter 1
Stored Procedure Language (SPL)6.0 servers: Informix Guide to SQL: Syntax, Version 6.0 Chapter 2
4GL forms INFORMIX-4GL Reference Chapter 5
Reports INFORMIX-4GL Reference Chapter 6
SQLCA record structure INFORMIX-4GL Reference Chapter 2
NewEra Debugger commands Guide to the INFORMIX-4GL InteractiveDebugger
Chapter 9
Environment variables INFORMIX-4GL Reference Appendix D
SE6.0
SyntaxConventions
Syntax Conventions 7
Each diagram begins at the upper left with a keyword and ends at the upperright with a vertical line. Between these points, you can trace any path that doesnot stop or back up. Each path describes a valid form of the statement. Exceptfor separators in loops (see page 8), which the path approaches counterclock-wise from the right, the path always approaches elements from the left and con-tinues to the right.
Along a path, you may encounter the following elements:
KEYWORD You must spell a word in uppercase letters exactly as shown;however, you can use either uppercase or lowercase letters when youenter it.
(.,;+*-/) All other characters are literal symbols that you must enter exactly asshown.
' ' " " Single and double quotes are literal symbols that you must enter asshown.
variable A word in italics represents a value that you must supply. The natureof the value is explained fully in the appropriate reference manual.
A reference in a box represents a subdiagram on the same page (if nopage number is supplied) or on a specified page. Imagine that thesubdiagram is spliced into the diagram at this point. (A synonym for“subdiagram” is “segment.”)
If the term “(subset)” appears in the box below the name of thesegment being referenced, you should refer to the appropriate refer-ence manual for further clarification.
The aspect ratio of the box is not significant. That is, the samesegment can be represented by boxes of different shapes, as in thesesymbols for the Named Value segment.
A code in an icon is a signal warning you that this path is valid onlyfor certain database servers or under certain conditions. The codesindicate the products or conditions that support the path. The follow-ing codes are used:
Path requires the statement to be prepared (by using PRE-PARE).
Path is valid only for INFORMIX-SE.
Path is valid only for INFORMIX-OnLine Dynamic Server.
Path is an Informix extension to ANSI standard SQL.
Path is valid only if you are using NLS.
Scope List
p. 148
NamedValue
ScopeList
Named Value
OL
SE6.0
SESE
OLOL
+
NLS
Syntax Conventions8
A shaded option is the default. Even if you do not explicitly type theoption, it will be in effect unless you choose another option.
Syntax enclosed in a pair of arrows indicates that this is a subdiagram.
The vertical line is a terminator and indicates that the statement is com-plete.
A branch below the main line indicates an optional path.
A loop indicates a path that can be repeated. Punctuation included in theloop indicates the separator symbol for items in a list; when no symbol isshown in the loop, as in the example below, a blank space or LINEFEED isthe separator.
A gate ( ) in an option indicates that you can only use that option thenumber of times indicated, even though it is within a larger loop.
The grey labels and arrows in the following illustration identify the elements ofa syntax diagram for the INITIALIZE statement of 4GL.
Elements of a syntax diagram
ALL
NOT
IN
variable
,
column3 key
3
database
OL
@ server
owner .
table . column
*:
,
variablename
ColumnListINITIALIZE
,
LIKE
TO NULLrecord
ColumnList
.*SubdiagramTitle
Main Diagram Path Loop Reference Box Terminator
KeywordRequiredElement
VariableOptionalBranch
PunctuationIconSegmentIndicator
Basics4GL
FormsReports
SQLSQLCA
Debugger
Basics
VariablesKeys
Data Types10
Data Type Kind of Values Stored
ARRAY OF type Arrays of values of any other single data type.➀BYTE Any kind of binary data.
CHAR Character strings of up to 32,767 ASCII characters.CHARACTER (This keyword is a synonym for CHAR.)DATE Points in time, specified as calendar dates.DATETIME Points in time, specified as calendar dates and time-of-day.DEC (This keyword is a synonym for DECIMAL.)DECIMAL Fixed point numbers, of a specified scale and precision.DOUBLE PRECISION (These keywords are a synonym for FLOAT.)FLOAT Floating-point numbers, of up to 32-digit precision.INT (This keyword is a synonym for INTEGER.)INTEGER Whole numbers, from -2,147,483,647 to +2,147,483,647.INTERVAL Spans of time in years and months, or else in smaller time units.MONEY Currency amounts, with definable scale and precision.NUMERIC (This keyword is a synonym for DECIMAL.)REAL (This keyword is a synonym for SMALLFLOAT.)RECORD Ordered sets of values, of any combination of 4GL data types.
➁SERIAL Same as INTEGER. Automatically assigned by the engine.SMALLFLOAT Floating-point numbers, of up to 16-digit precision.SMALLINT Whole numbers, from -32,767 to +32,767.
➀TEXT Character strings of any length.➀VARCHAR Character strings of varying length, no greater than 255.
➀INFORMIX-OnLine Dynamic Server or other 4GL statements only. ➁SQL only.
Operator Symbol Operator Name Name of Result Precedence
** exponentiation power 12mod modulus integer remainder 12* multiplication product 11/ division quotient 11+ addition sum 10- subtraction difference 10
ANDORNOT
Operator Symbol Operator Name Operator Symbol Operator Name
< Less than != or <> Not equal to<= Not greater than >= Not less than= or == Equal to > Greater than
Data Types
4GLArithmeticOperators
BooleanOperators
4GLRelationalOperators
Global Constants and Variables 11
sics4GLrmsortsSQLLCAggerbleseys
FALSE SQLCA Record:INT_FLAG SQLCODENOTFOUND SQLERRMNULL SQLERRPSQLCODE SQLERRDSTATUS SQLAWARNTRUEQUIT_FLAG
ARG_VAL(int-expr) ERRORLOG(char-expr) NUM_ARGS( )ARR_COUNT( ) FGL_DRAWBOX(height,
width,line,left-offset[,color])†PERCENT(*)
ARR_CURR( ) SCR_LINE( )†AVG(int-field) FGL_GETENV(char-expr) SET_COUNT(int-expr)†COUNT(*) FGL_KEYVAL(char-expr) SHOWHELP(int-expr)DOWNSHIFT(char-expr) FGL_LASTKEY( ) SQLEXIT( )ERR_GET(int-expr) LENGTH(char-expr) STARTLOG(char-expr)ERR_PRINT(int-expr) †MAX(int-field) †SUM(int-field)ERR_QUIT(int-expr) †MIN(int-field) UPSHIFT(char-expr)
†Valid only in REPORT blocks or in some SQL statements. Also, may be preceded by GROUP.
Color numbers and their meanings that can be used in FGL_DRAWBOX( ) are:
Number Color Number Color Number Color
0 White 3 Red 6 Blue1 Yellow 4 Cyan 7 Black2 Magenta 5 Green
ASCII int-expr LENGTH(char-expr)char-expr CLIPPED †LINENOCOLUMN integer MDY(int-expr, int-expr, int-expr)CURRENT MONTH(date-expression)CURRENT qualifier ORD(string-expr)DATE †PAGENODATE (date-expression) int-expr SPACEDAY(date-expression) int-expr SPACESEXTEND(time-value) TIMEEXTEND(time-value, qualifier) TODAYFIELD_TOUCHED(field-list) int-expr UNITS time-keywordGET_FLDBUF(field-list) expression USING format-stringexpression IS NOT NULL WEEKDAY (date-expression)expression IS NULL †char-expr WORDWRAPINFIELD(field) YEAR (date-expression)
†Valid only in REPORT blocks.
GlobalConstantsandVariables
Built-InFunctions
Operators
Ba
FoRep
SQDebuVaria
K
Library Functions12
Popping Numbers
extern void popint(int *iv)extern void popshort(short *siv)extern void poplong(long *liv)extern void popflo(float *fv)extern void popdub(double *dfv)extern void popdec(dec_t *decv)
Popping Characters
extern void popquote(char *qv, int len)extern void popvchar(char *qv, int len)
Popping Dates and Times
extern void popdate(long *datv)extern void popdtime(dtime_t *dtv, int qual)extern void popinv(intrvl_t *iv, int qual)
Popping BYTE and TEXT
extern void poplocator(loc_t **blob)
Returning Values
extern void retint(int iv)extern void retshort(short siv)extern void retlong(long lv)extern void retflo(float fv)extern void retdub(double dfv)extern void retdec(dec_t *decv)
extern void retquote(char *str0)extern void retvchar(char *vc)
extern void retdate(long date)extern void retdtime(dtime_t *dtv)
extern void retinv(intrvl_t *inv)
Pushing Values
extern void pushint(int iv)extern void pushshort(short siv)extern void pushlong(long liv)extern void pushflo(float fv)extern void pushdub(double dfv)extern void pushdec(dec_t *decv, unsigned decp)
LibraryFunctionsCallingC Functionsfrom 4GL
Calling 4GL Functions from C 13
sics4GLrmsortsSQLLCAggerbles
fgl_start(filename, argc, argv) initialize resources for the 4GL environmentchar *filename;int argc;char *argv[];
fgl_call(funcname, nparams) call the 4GL functionchar *funcname;int nparams;
fgl_exitfm( ) reset terminal to character mode
fgl_end( ) free 4GL resources
deccvasc(cp, len, np) convert C char type to DECIMAL typechar *cp;int len;dec_t *np;
dectoasc(np, cp, len, right) convert DECIMAL type to C char typedec_t *np;char *cp;int len;int right;
deccvint(integer, np) convert C int type to DECIMAL typeint integer;dec_t *np;
dectoint(np, ip) convert DECIMAL type to C int typedec_t *np;int *ip;
deccvlong(lng, np) convert C long type to DECIMAL typelong lng;dec_t *np;
dectolong(np, lngp) convert DECIMAL type to C long typedec_t *np;long *lngp;
deccvflt(flt, np) convert C float type to DECIMAL typefloat flt;dec_t *np;
dectoflt(np, fltp) convert DECIMAL type to C float typedec_t *np;float *fltp;
Calling4GL Functionsfrom C
DecimalFunctions
Ba
FoRep
SQDebuVaria
Keys
Decimal Functions14
deccvdbl(dbl, np) convert C double type to DECIMAL typedouble dbl;dec_t *np;
dectodbl(np, dblp) convert DECIMAL type to C double typedec_t *np;double *dblp;
decadd(n1, n2, result) add two decimal numbersdec_t *n1; (result = n1 + n2)dec_t *n2;dec_t *result;
decsub(n1, n2, result) subtract two decimal numbersdec_t *n1; (result = n1 - n2)dec_t *n2;dec_t *result;
decmul(n1, n2, result) multiply two decimal numbersdec_t *n1; (result = n1 * n2)dec_t *n2;dec_t *result;
decdiv(n1, n2, result) divide two decimal numbersdec_t *n1; (result = n1 / n2)dec_t *n2;dec_t *result;
int deccmp(n1, n2) compare two decimal numbersdec_t *n1;dec_t *n2;
deccopy(n1, n2) copy a decimal numberdec_t *n1;dec_t *n2;
char *dececvt(np, ndigit, decpt, sign) convert decimal value to ASCII stringdec_t *np;int ndigit;int *decpt;int *sign;
char *decfcvt(np, ndigit, decpt, sign) convert decimal value to ASCII stringdec_t *np;int ndigit;int *decpt;int *sign;
Display Attributes 15
sics4GLrmsortsSQLLCAggerbles
The ATTRIBUTE clause is used in these 4GL statements:
CONSTRUCT DISPLAY FORM INPUT ARRAYDISPLAY ERROR MESSAGEDISPLAY ARRAY INPUT PROMPT
For all ATTRIBUTE clauses and field attributes the following table shows theeffects of the color attributes on a monochrome monitor, as well as the effectsof the intensity attributes on a color monitor:
Color Monochrome Intensity ColorAttribute Display Attribute Display
WHITE NORMAL NORMAL WHITEYELLOW BOLD BOLD REDMAGENTA BOLD DIM BLUERED BOLDCYAN DIMGREEN DIMBLUE DIMBLACK DIM
DisplayAttributes
BLINK
UNDERLINE
,
ATTRIBUTE ( )
WHITE
RED
CYAN
GREEN
BLUE
BOLD
DIM
INVISIBLE
NORMAL
REVERSE
YELLOW
MAGENTA
BLACK
ATTRIBUTEClause
Ba
FoRep
SQDebuVaria
Keys
Command-Line Syntax16
Command-Line Syntax
-o outfile
-ansi -e -a -anyerr
-args
source.4gl
obj.o
yourlib
esqlc.ec
source.c
-V
c4gl
-o newfglgo
-V cfile
cfile
.c
.o
fgiusr.c .eccfglgo
-a -anyerr
argument
-V
filename
.4go
.4gi
fglgo
-ansi -a -anyerr -p pathname
source
.4gl
-V
fglpc
msg_numfinderr
Command-Line Syntax 17
-l lines -c characters
form-name
-V
-d
form4gl
-q
database-name
form-name
table-name
in file out filemkmessage
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Command-Line Syntax18
Basics4GL
FormsReports
SQLSQLCA
Debugger
4GL Statements
VariablesKeys
Types of SQL Statements20
INFORMIX-4GL supports the SQL language, but it is sometimes convenient todistinguish between SQL statements and other 4GL statements:
• SQL statements operate on tables in the database.
• Other 4GL statements operate on variables in memory.
The SQL statements of 4GL can be divided into these functional categories.
Note: Not all of these SQL statements listed on this and the next page are directly supported by4GL. If the statement or any part of its syntax is preceded by a 6.0 icon in its syntax diagramlater in this chapter, the statement must be prepared (by using the PREPARE statement). Prepar-ing SQL statements is described in Chapter 3 of the INFORMIX-4GL Reference.
SQL Data Definition Statements
ALTER INDEX CREATE TABLE DROP TABLEALTER TABLE CREATE VIEW DROP VIEWCLOSE DATABASE DATABASE RENAME COLUMNCREATE DATABASE DROP DATABASE RENAME TABLECREATE INDEX DROP INDEXCREATE SYNONYM DROP SYNONYM
SQL Data Manipulation Statements
INSERT LOAD UNLOADDELETE SELECT UPDATE
SQL Cursor Manipulation Statements
CLOSE FETCH OPENDECLARE FLUSH PUT
SQL Query Optimization Information Statements
SET EXPLAIN SET OPTIMIZATION UPDATE STATISTICS
SQL Data Access Statements
GRANT REVOKE SET LOCK MODELOCK TABLE SET ISOLATION UNLOCK TABLE
SQL Data Integrity Statements
BEGIN WORK DROP AUDIT ROLLFORWARD DATABASECHECK TABLE RECOVER TABLE SET CONSTRAINTSCOMMIT WORK REPAIR TABLE SET LOGCREATE AUDIT ROLLBACK WORK START DATABASE
Note: The data integrity statements marked with the symbol are supportedonly by the INFORMIX-SE engine. Statements marked can only be used with theINFORMIX-OnLine Dynamic Server engine.
Types ofSQLStatements
OL
SE
SE
SEOL
SESESE
SE
OLSE
OL
Other Types of 4GL Statements 21
sics4GLrmsortsSQLLCAggerbleseys
SQL Dynamic Management Statements
EXECUTE PREPAREFREE
4GL Definition and Declaration Statements
DEFINE MAINFUNCTION REPORT
4GL Program Flow Control Statements
CALL FINISH REPORT OUTPUT TO REPORTCASE FOR RETURNCONTINUE FOREACH RUNDATABASE GOTO START REPORTEND IF WHILEEXIT LABEL
4GL Compiler Directives
DATABASE GLOBALSDEFER WHENEVER
4GL Storage Manipulation Statements
INITIALIZE LOCATELET VALIDATE
4GL Screen Interaction Statements
CLEAR DISPLAY FORM OPEN WINDOWCLOSE FORM ERROR OPTIONSCLOSE WINDOW INPUT PROMPTCONSTRUCT INPUT ARRAY SCROLLCURRENT WINDOW MENU SLEEPDISPLAY MESSAGEDISPLAY ARRAY OPEN FORM
4GL Report Execution Statements
NEED PRINTPAUSE SKIP
Most 4GL statements are not sensitive to whether the SE or the OnLineengine supports the application. Only the OnLine engine, however, canstore values in BYTE, TEXT, or VARCHAR columns, or can accept database:or database@system: as qualifiers to names of tables, views, or synonyms.
Other Typesof 4GLStatements
Ba
FoRep
SQDebuVaria
K
CALL22
CALL
, ,
RETURNING
function
ReceivingVariable
p. 29
4GL Expressionp. 39
( )
statementWHEN
EXIT CASE
4GL BooleanExpression
p. 40
statement
EXIT CASE
( )
Case I: (single criterion)
Case II: (multiple criteria)
WHEN
4GLExpression
(subset)p. 39
4GLExpression
(subset)p. 39
END CASE
OTHERWISEBlock
CASE
OTHERWISE Block
statementOTHERWISE
EXIT CASE
Field Clausep. 46
SCREEN
FORM
,
windowWINDOW
CLEAR
formCLOSE FORM
windowCLOSE WINDOW
CONSTRUCT 23
CONSTRUCT
ENDCONSTRUCT
ATTRIBUTEClausep. 37
CONSTRUCTForm
ManagementBlock
HELPnumber
CONSTRUCTVariableClause
CONSTRUCTVariable Clause
variable ON FROM
BY NAME variable ON
,
Field Clausep. 46
Column List
Column List
Column List,
table .
column
*
Table Qualifierp. 46
table .Table Qualifier
p. 46
CONSTRUCTForm Management
Block
BEFORE CONSTRUCT1
AFTER CONSTRUCT1
BEFORE FIELD
,
field
AFTER FIELD
ON KEY
,
key )(
statement
NEXT FIELD PREVIOUS
NEXT
CONTINUE CONSTRUCT
EXIT CONSTRUCT
FieldClausep. 46
CONTINUE keyword
window
SCREEN
CURRENT WINDOW IS
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
DEFER24
DEFER
QUIT
INTERRUPT
,
variable Data Type Declarationp. 37
DEFINE
Case I: (output in the Line mode overlay)
,
BY NAME
,
variable
,
Case III: (in a screen form)
DISPLAYValue
AT line, left-offset
TO
ATTRIBUTEClausep. 37
DISPLAYValue
,
FieldClausep. 46
,
ATTRIBUTEClausep. 37
DISPLAY
,
COLUMN left-offset
DISPLAYValue
Case II: (in a specified line of the current window)
DISPLAY Value
value
CLIPPED
USING format string" "
ASCII number
record array TO screen array . *
ON KEYBlockp. 25
ENDDISPLAY
ATTRIBUTEClausep. 37
DISPLAY ARRAY
DISPLAY FORM 25
These are valid keywords in the END statement:
CASE FOREACH INPUT PROMPTCONSTRUCT FUNCTION MAIN REPORTDISPLAY GLOBALS MENU WHILEFOR IF
These are valid keywords in Case II of the EXIT statement:
CASE FOR MENUCONSTRUCT FOREACH PROMPTDISPLAY INPUT WHILE
ON KEY Block
key nameON KEY ( ) statement
EXIT DISPLAY
,
DISPLAY FORM
ATTRIBUTE Clausep. 37
form
END keyword
" string"variable ATTRIBUTE
Clausep. 37
ERROR
,
EXIT
Case I: (terminating a program)
Case II: (terminating a statement)
)exit code(
PROGRAM
keyword
exit code
FINISH REPORT report
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
FOR26
FOR
CONTINUE FOR
EXIT FOR
END FORcounter = start TO finish statement
STEP increment
FOREACH cursor
CONTINUEFOREACH
END FOREACH
EXITFOREACH
statement
,
VariableList
INTO
Variable List
THRU
. first THROUGH
.*
record . last
IntegerExpression
p. 41
array
,
,
.
record
variable
[ ]3
) END FUNCTION
argument
,
RETURNStatement
p. 35
statementDEFINEStatement
p. 24
)
function (FUNCTION
GLOBALS
,
END GLOBALSDEFINE Statementp. 24
Case I: (declaring and exporting variables)
Case II: (importing variables)
" filename"
GOTO 27
GOTO label name
:
IF
ELSE
statement
statement
END IF4GL BooleanExpression
p. 40
THEN
VariableList
LIKE .columntable
.*
,
TO NULL
TableQualifier
p. 46
INITIALIZE
Variable List
last. first THROUGH
.*record .
IntegerExpression
p. 41
[array ]
,
,
.
record
variable
THRU
3
INPUT BindingClausep. 28 HELP number
INPUT FormManagement
Block
END INPUTATTRIBUTE
Clausep. 37
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
INPUT ARRAY28
Acceptable values of key (in lowercase or uppercase letters) for the ON KEY block are:
ACCEPT HELP NEXT or RETURN or ENTERDELETE INSERT NEXTPAGE RIGHTDOWN INTERRUPT PREVIOUS or TABESC or ESCAPE LEFT PREVPAGE UPF1 through F64CONTROL-char (except A, D, H, I, J, L, M, R, or X)
Built-in functions that access field buffers and keystroke buffers:
Built-In Funtion Description
FIELD_TOUCHED(field) Returns TRUE when the user has made a change to screen field.GET_FLDBUF(field-list) Returns the character values of the contents of one or more fields.FGL_LASTKEY( ) Returns an INTEGER value corresponding to the most recent keystroke.INFIELD(field) Returns TRUE if field is the name of the current screen field.
Binding Clause,
BY NAME
FROM fieldvariable
,
,
WITHOUT DEFAULTS
WITHOUT DEFAULTS
Field Clause(subset)
p. 46
variable
AFTER
FIELD statement
ON KEY
,
,
BEFORE
INPUT
Field Clausep. 46
NEXT FIELD
PREVIOUS
INPUT
NEXT
CONTINUE
EXITkey )(
field
INPUT ARRAY BindingClause
HELP numberINPUT ARRAY
FormManagement
Block
END INPUTATTRIBUTE
Clausep. 37
Binding Clause
FROM screen array . *program array
WITHOUT DEFAULTS
INPUT FormManagement Block
LABEL 29
For acceptable values of key, see p. 28. For built-in functions that access field buffersand keystroke buffers, see p. 28.
Built-in functions that keep track of the relative states of the screen cursor, the pro-gram array, and the screen array:
Function Description
ARR_CURR( ) Returns the number of the current record of the program array.ARR_COUNT( ) Returns the current number of records in the program array.SCR_LINE( ) Returns the number of the current line within the screen array.SET_COUNT(filled-rows) Sets the initial value of ARR_COUNT( ) to filled-rows.
INPUT ARRAYForm Management
Block
AFTER
FIELD
ON KEY
,
,
key
DELETE
BEFORE
INPUT
INSERT
fieldField Clausep. 46
NEXT FIELD
PREVIOUS
INPUT
NEXT
CONTINUE
EXIT
statement
ROW
Field Clausep. 46
( )
LABEL label identifier :
LET =
destination .* source .=
4GL Expressionp. 39
*
ReceivingVariable
blob
,
= NULL
Receiving Variable
Integer Expressionp. 41
[array ]
,
3
simple variable
record .
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
LOAD30
LOAD insertvariable
" filename"" character"DELIMITER
delimiter
file variableINSERTClause
FROM
INSERT Clause
,INSERT INTO
column
table
(Table Qualifier
p.46)
BYTE or TEXTVariable
" filename"IN MEMORY
FILE
variable
LOCATE
,
BYTE or TEXTVariable
. last
THRU
.first THROUGH record
array
,
.
record
variable
integer3
.*
[ ]
MAIN statement END MAIN
EXIT PROGRAMDEFINE
Statementp. 24 DEFER Statement
p. 24
DATABASEStatement
p. 72
END MENUMENU Control Block
variable
" title"MENU
MESSAGE 31
MENU ControlBlock
statement
HIDE
SHOW OPTION
ALL
optionname
,
CONTINUE MENU
EXIT MENU
NEXT OPTION option nameCOMMAND Block
BEFORE MENU
COMMAND Block
,
)keyKEY (3 HELP
number
option nameoption
description
COMMAND
MESSAGE
ATTRIBUTEClausep. 37
" string"
variable
,
form FROM " filename"OPEN FORM
OPEN WINDOW
OPENWINDOW
ATTRIBUTEClausep. 32
window AT top-line , left-offset WITH
FORM
variable
height ROWS , width COLUMNS
" filename"
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
OPEN WINDOW32
Attribute Default Setting
color Default foreground color on your terminalREVERSE No reverse videoBORDER No borderPROMPT LINE line value FIRST (=1)MESSAGE LINE line value FIRST + 1 (=2)MENU LINE line value FIRST (=1)FORM LINE line value FIRST + 2 (=3)COMMENT LINE line value LAST - 1 (for the 4GL screen)
LAST (for all other 4GL windows)
OPEN WINDOWAttribute Clause
BORDER
ATTRIBUTE ( )
YELLOW
MAGENTA
RED
CYAN
GREEN
BLUE
BLACK
PROMPT LINE
MESSAGE LINE
MENU LINE
FORM LINE
COMMENT LINE
REVERSE
,
ReservedLine
Position
DIM
NORMAL
BOLD
WHITE
Reserved LinePosition
FIRST
+
-
integer
LAST
OPTIONS 33
Clause Default
COMMENTLINE
LAST - 1 for the 4GL screenLAST for all other 4GL windows
ERROR LINE LAST line of the 4GL screenFORM LINE FIRST + 2 or line 3 of the current 4GL windowMENU LINE FIRST line of the 4GL windowMESSAGE LINE FIRST + 1 or line 2 of the current 4GL windowPROMPT LINE FIRST line of the 4GL window
ACCEPT KEY ESCAPEDELETE KEY F2INSERT KEY F1NEXT KEY F3PREVIOUS KEY F4HELP KEY CONTROL-WHELP FILE None
OPTIONS
,
COMMENT
ERROR
INPUT WRAP
ACCEPT
FILE " filename"HELP
DISPLAY
FIELD ORDER
CONSTRAINED
UNCONSTRAINED
KEY key
FIRST
LAST
+
-
LINE
NO WRAP
OPTIONSATTRIBUTE
Clausep. 34
number
ATTRIBUTE
SQL INTERRUPT
ON
OFF
PROMPT
MESSAGE
MENU
FORM
PREVIOUS
INSERT
NEXT
DELETE
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
OUTPUT TO REPORT34
For values for key, see p. 28.
OPTIONSATTRIBUTE Clause
REVERSE
BLINK
UNDERLINE
,
ATTRIBUTE ( )
WHITE
YELLOW
MAGENTA
RED
CYAN
GREEN
BLUE
BLACK
BOLD
DIM
FORM
WINDOW
INVISIBLE
NORMAL
OUTPUT TO REPORT report
,
( )4GL Expressionp. 39
blob
,
CHAR
response
END PROMPT
ATTRIBUTEClausep. 37
ATTRIBUTEClausep. 37
keyON KEY ( ) statement
,
variable HELP number
FOR" string"PROMPT
REPORT 35
REPORT END REPORT)
argument DEFINEStatement
p. 24
)
( FORMATSection
p. 58
OUTPUTSection
p. 56
ORDER BYSection
p. 57
,report
,
4GL Expressionp. 39
RETURN
RUN
WITHOUT WAITING
character variable
" command "
RETURNING integer variable
DOWN
UP
,
SCROLL Field Clausep. 46
BY lines
IntegerExpression
p. 41
SLEEP
PIPE
report
PRINTER
" filename"TO
" command "
variable
START REPORT
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
UNLOAD36
UNLOAD
DELIMITER
select variable
SELECTStatement
p. 82
" character"" filename"file variable
delimiter variable
TO
LIKEVariableList
.columntable
.*
,
TableQualifier
p. 46
VALIDATE
Variable List
. first THROUGH
.*
IntegerExpression
p. 41
[array ]
,
,
.
record
variable
THRU
3
record . last
+SQLERROR
NOT FOUND
ANY
CONTINUE
GOTO
CALL function
STOP
+labelERROR
+
SQLWARNING
WARNING
GO TO : label+
WHENEVER
statement
EXIT WHILE
CONTINUE WHILE
END WHILE4GL BooleanExpression
p. 40
WHILE
ATTRIBUTE Clause 37
ATTRIBUTEClause
BLINK
UNDERLINE
,
ATTRIBUTE ( )
WHITE
RED
CYAN
GREEN
BLUE
BOLD
DIM
INVISIBLE
NORMAL
REVERSE
YELLOW
MAGENTA
BLACK
4GLStatementSegments
Data TypeDeclaration
LIKE
4GL Data Type
table . column
Table Qualifierp. 46
4GL Data Type
RECORD Data Typep. 39
4GL Simple Data Typep. 38
ARRAY Data Typep. 38
TEXT
BYTE
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
4GL Simple Data Type38
4GL SimpleData Type
, scale
DATETIME Qualifierp. 44
INTERVAL Qualifierp. 45
VARCHAR
, reserve size
FLOAT
DOUBLE PRECISION precision
SMALLFLOAT
REAL
DATE
DATETIME
INTERVAL
CHARACTER
CHAR
( 1 )
(16)
, 2
MONEY
size
( )
( )
( )
precision
, scale((
(16, 2))
, 0
SMALLINT
DECIMAL
precision )NUMERIC
DEC
maximum size
INTEGER
INT
Array Data Type
4GL Simple Data Typep. 38
ARRAY ]
RECORD Data Typep. 39
BYTE
TEXT
size OF[ 3
,
RECORD Data Type 39
RECORD Data Type
Data Type Declarationp. 37
member END RECORD
,
RECORD
table .*LIKE
Table Qualifierp. 46
4GL Expression
Character Expressionp. 42
Number Expressionp. 42.
Integer Expressionp. 41
Time Expressionp. 43
4GL BooleanExpression
p. 40
)( 4GL Expression
Named Value
IntegerExpression
p. 41
,
[array ]
constant
3
record .
variable
Function Call
,function
4GLExpression
p. 39
( )
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
4GL Boolean Expression40
4GL BooleanExpression
NOT
OR
Boolean Comparison
TRUE
AND
4GL Expressionp. 39
Function Callp. 39
FALSE
BooleanComparison
Set Membership Testp. 41
NULL Testp. 41
String Comparison
Relational Comparison
RelationalComparison
<>
<=>=<>!=
4GL Expressionp. 39
4GL Expressionp. 39
=
String Comparison
MATCHES
LIKENOT
CharacterExpression
p. 42
criterion
ESCAPE " char"
NULL Test 41
MATCHESWildcard Effect
* Matches a string of zero or more characters.? Matches any single character.[ ] Matches any of the enclosed characters.- Between characters in brackets means a range in the ASCII collating
sequence.^ As the first character in the brackets, matches any character that is not listed.\ Treats the next character as a literal.
LIKEWildcard Effect
% Matches a string of zero or more characters._ Matches any single character.\ Treats the next character as a literal.
NULL Test
4GL Expressionp. 39
IS NULL
blob variableNOT
Set MembershipTest
4GL Expressionp. 39
IN 4GL Expressionp. 39
( ),
NOT
Integer Expression
MOD
**
+
-
*/
Literal Integerp. 42
Function Callp. 39
Named Valuep. 39
-+
Case II: Differences between DATE values
Case I: Pure integers
4GL BooleanExpression
p. 40
-DATE Valuep. 43
DATE Valuep. 43
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Literal Integer42
Literal Integer
digit
-+
NumberExpression
MOD
**
+-
*/
4GL BooleanExpression
p. 40
Literal Number
Function Callp. 39
Named Valuep. 39-
+
IntegerExpression
p. 41
Literal Number
digit
E-+
digit
e
. digit
. -
+
CharacterExpression
IntegerExpression
p. 41
IntegerExpression
p. 41
CLIPPED USING " format-string"Function Callp. 39
Named Valuep. 39
character
[ ]
,
" "
Time Expression 43
Time Expression
INTERVAL Valuep. 43
DATETIME Valuep. 43
DATE Valuep. 43
DATE Value
"
TODAY
USING " format string"Function Callp. 39
Named Valuep. 39
" Numeric Datep. 44
DATETIME Value
,EXTEND (
CURRENT DATETIME Qualifierp. 44
)DATETIMEValue
DATE Value
DATETIME Literalp. 44
Numeric Date and Timep. 44
""
Function Callp. 39
Named Valuep. 39
DATETIME Qualifierp. 44
INTERVAL Value
INTERVAL Literalp. 45
Numeric Time Intervalp. 46
""
Function Callp. 39
Named Valuep. 39
Integer Expressionp. 41
UNITS keyword
-
+ Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Numeric Date44
Numeric Date
yymo
yyyyseparator dd separator
DATETIMEQualifier
YEAR
MONTH
DAY
MINUTE
SECOND
FRACTION
HOUR
( scale )
TO DAY
TO HOUR
TO MINUTE
TO SECOND
TO FRACTION
TO YEAR
TO MONTH
(3)
DATETIME LiteralDATETIME QualifierNumeric Date
and TimeDATETIME ( )
Numeric Date andTime
yyyy
-mo
-dd
space
hh
mi
ss
fffff
:
.
:
INTERVAL Qualifier 45
INTERVALQualifier
DAY
MINUTE
SECOND
FRACTION
TO DAY
TO HOUR
TO MINUTE
TO SECOND
TO FRACTION
HOUR
(precision)
(precision)
(precision)
(precision)
( scale )
YEAR
MONTH
TO YEAR
TO MONTH
(y-precision)
(precision)
(2)
(2)
(2)
(2)
(2)
(4)
(3)Case II: Time units greater than DAY
Case I: Time units smaller than MONTH
INTERVAL Literal
( )Numeric Time Intervalp. 46
INTERVAL INTERVALQualifier
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Numeric Time Interval46
Case II: Time units greater than DAY
Numeric TimeInterval Case I: Time units smaller than MONTH
dd
space
hh
mi
ss
fffff
.
-
:
:
yyyy
-mo
-
Field Clause,
. *
field
FORMONLY
THRUNotation
line[ ][ 1 ]
table reference
screen record
screen array
Table Qualifier
@server
database
OL
:owner.
" owner."
THRU Notation
THROUGH same.lastfirst
THRU
4GL Forms
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
DATABASE Section48
FormSpecificationSyntax ATTRIBUTES
Sectionp. 49
DATABASESection
SCREENSection
TABLESSection
p. 49
INSTRUCTIONSSection
p. 49
DATABASE
DATABASESection
FORMONLY
databaseDATABASE SectionDatabase Reference WITHOUT NULL INPUT
DATABASE SectionDatabaseReference
" / / server / database"
database
database @server
OL
SE " / pathname / database @server"
" / / server / pathname / database"
SCREENSection
SCREEN { }Screen Layout
ENDSIZE lines BY characters
Screen Layout
character
field-tag[ ]
[ field-tag | field-tag ]
TABLES Section 49
TABLESSection
TABLES
alias = Table Qualifierp. 46
END
table
ATTRIBUTESSection
ATTRIBUTES
END
;field-tag = Field Description
Field Description
column
FORMONLY. field name
data-type NOT NULL
TYPE LIKE table .
,
,
Attributesp. 50
INSTRUCTIONSSection
INSTRUCTIONS recordSCREEN RECORD
array
DELIMITERS
size END
( )
"
[ ]
"opening-delimiter closing-delimiter
Field Listp. 50
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Field List50
Values for display mode consists of zero or one color and zero or more intensities:
Color Keywords Intensity Keywords
BLACK MAGENTA REVERSEBLUE RED LEFTCYAN WHITE BLINKGREEN YELLOW UNDERLINE
Field List
table
,
reference *
first
last
THROUGHreferencetable
THRU
.
.
Attributes
AUTONEXTAttribute
AUTONEXT
COLOR Attribute
COLOR =
WHERE BooleanExpressions
for 4GL Formsp. 51
display mode
Boolean Expressions for 4GL Forms 51
BooleanExpressions for
4GL Forms
IS
NOT
field-tag
=<>
<=>=< >!=
NOT
OR
FALSE
AND
4GL Expression(Subset)
p. 39
BETWEEN
IN
AND
(
4GLExpression
(Subset)p. 39
4GLExpression
(Subset)p. 39
)
field-tag
NOT
field-tag
NULL
field-tag
field-tag
CharacterExpression
p. 42ESCAPE " char"LIKE
character" "MATCHES
4GL Expression(Subset)
p. 39
4GL Expression(Subset)
p. 39
TRUE
,
)( Boolean Expressionfor 4GL Forms
COMMENTSAttribute
COMMENTS = " message"
DEFAULTAttribute
DEFAULT = value
DISPLAY LIKEAttribute
DISPLAY LIKE column
table .
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
DOWNSHIFT Attribute52
For DATE data types, format-string consists of:
All other characters are literals.
For DECIMAL, SMALLFLOAT, or FLOAT data types, format-string consistsof pound signs (#) to represent digits and a decimal point. If you are using NLS,the period is a placeholder for the decimal separator and the comma is aplaceholder for the thousands separator.
SpecialCharacters Meaning
mm 2-digit representation of the monthmmm 3-letter abbreviation of the monthdd 2-digit representation of the day of the monthddd 3-letter abbreviation of the day of the weekyy 2-digit representation of the year, discarding
the leading digitsyyyy 4-digit representation of the year
DOWNSHIFTAttribute
DOWNSHIFT
FORMATAttribute
FORMAT = " format-string"
INCLUDE Attribute
INCLUDE = (
TO
)
,
NULL
value
value
INVISIBLE Attribute
INVISIBLE
NOENTRY Attribute
NOENTRY
PICTURE Attribute 53
A format-string can include these three special symbols:
Symbol Meaning
A Any letter# Any digitX Any character
PICTURE Attribute
PICTURE " format-string"=
PROGRAMAttribute
PROGRAM = " command "
REQUIREDAttribute
REQUIRED
REVERSEAttribute
REVERSE
UPSHIFT Attribute
UPSHIFT
VALIDATE LIKEAttribute
VALIDATE LIKE column
table .
VERIFY Attribute
VERIFY
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
WORDWRAP Attribute54
WORDWRAPAttribute
WORDWRAP
COMPRESS
NONCOMPRESS
Reports
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
REPORT56
REPORT END REPORT)
argument DEFINESection
)
( FORMATSection
p. 58
OUTPUTSection
p. 56
ORDER BYSection
p. 57
,report
ReportSpecificationSyntax
DEFINESection ,
variable data typeData Type Declaration(Subset) p. 37
DEFINE
OUTPUTSection
REPORT TO " filename "
BOTTOM
RIGHT
TOP
LEFT
PAGE LENGTH
TOP OF PAGE
PIPE
MARGIN
" command "
" string "
variable
size
PRINTER
OUTPUT
1
1
1
1
1
1
1
ORDER BY Section 57
LEFT MARGIN size (default = 5 characters)
MARGIN size
MARGIN size
RIGHT MARGIN size (default = 132 lines)
PAGE LENGTH size
(default = 3 lines)
(default = 3 lines)
(default = 66 lines)
TOP
BOTTOM
(for default reports or PRINT WORDWRAP only)
EXTERNAL
BY argument
ASC
DESC
, ORDER BY
Section
ORDER
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
FORMAT Section58
Following is the execution sequence of report control blocks.
BEFORE GROUP OF a {1}BEFORE GROUP OF b {2}
BEFORE GROUP OF c {3}ON EVERY ROW {4}
AFTER GROUP OF c {3}AFTER GROUP OF b {2}
AFTER GROUP OF a {1}
FORMATSection
FORMAT END REPORT
BEFORE GROUP OFControl Block
AFTER GROUP OFControl Block
ON LAST ROWControl Block p. 59
ON EVERY ROWControl Block p. 59
PAGE TRAILERControl Block p. 59
FIRST PAGE HEADERControl Block
PAGE HEADERControl Block p. 59
EVERY ROW
1
1
1
1
1
AFTER GROUP OFControl Block
AFTER GROUP OF variable statement
BEFORE GROUPOF
Control Block
BEFORE GROUP OF variable statement
FIRST PAGE HEADER Control Block 59
sics
FIRST PAGEHEADER
Control Block
FIRST PAGE HEADER statement
PAGE HEADERControl Block
PAGE HEADER statement
ON EVERY ROWControl Block
ON EVERY ROW statement
ON LAST ROWControl Block
ON LAST ROW statement
PAGE TRAILERControl Block
PAGE TRAILER statement
ReportExecutionStatements
lines LINESNEED
" string "PAUSE
Ba
4GLFormsReports
SQLSQLCA
DebuggerVariables
Keys
PRINT60
PRINT 4GL Expressionp. 39
FILE
LINENO
PAGENO
COLUMN
SPACES
" filename"
WORDWRAP RIGHT MARGIN
left offset
temporary
Aggregate Report Functions
relative offset SPACE
TEXT variable
BYTE variable
;
CharacterExpression
p. 42
,
Aggregate ReportFunctions
GROUP
PERCENT ( * )COUNT
AVG
SUM
MAX
MIN ( )
WHERE4GL BooleanExpression
p. 40
( )
Number Expressionp. 42
INTERVAL Valuep. 43
4GL Expressionp. 39
( )
integer
TO TOP OF PAGE
LINE
LINES
SKIP
SQL Statements
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
ALTER INDEX62
The 4GL source compiler does not recognize SQL statements identified in this Guideby the icon nor SQL statements containing a clause identified by theicon. To compile 4GL source code containing such statements, you must do thefollowing:
1. Store the 6.0 SQL statement as a character string.
2. Set up the statement for execution by means of the PREPARE statement (see p. 79).
3. Process the statement by means of the EXECUTE statement (see p. 75).
SE6.0 SE6.0
ALTER INDEX TO
NOT
CLUSTERIndex Name
p. 92
+
ALTER TABLE
SynonymNamep. 92
DROP Clause p. 63
MODIFY Clause p. 63
LOCK MODEClause p. 64
MODIFY NEXT SIZEClause p. 64
DROP CONSTRAINTClause p. 64
ADD CONSTRAINTClause p. 64
ADD Clause
OL
Table Namep. 92
+,
,
Add ColumnClausep. 63
( )
ADD
ADD Clause6.0
Add ColumnClausep. 63
ALTER TABLE 63
,
BEFORE column name
newcolumnname
DEFAULTClausep. 67
NOTNULL Column-Level
Constraint Definitionp. 68
6.0
Add ColumnClause
SQLData Type
p. 93
,
column name
column nameDROP
( )
DROP Clause
6.0
,
Modify ColumnClause
( )
MODIFY
Modify ColumnClause
MODIFY Clause
6.0
, columnname
SQLData Type
p. 93
DEFAULTClausep. 67
NOTNULL
Modify ColumnClause
6.0 Column-LevelConstraint Definition
p. 68
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
BEGIN WORK64
,
( )
ADD CONSTRAINT
ConstraintDefinition
p. 68
ADDCONSTRAINT
Clause
6.0
ConstraintDefinition
p. 68
,
( )
DROP CONSTRAINT
ConstraintNamep. 92
ConstraintNamep. 92
6.0
DROPCONSTRAINT
Clause
MODIFY NEXT SIZE kbytes
MODIFYNEXT SIZE
Clause
( )LOCK MODE PAGE
ROW
LOCK MODEClause
BEGIN WORK
+
CLOSECursorNamep. 92
CLOSE DATABASE 65
CLOSEDATABASE
+
COMMIT WORK
CREATE AUDIT FOR IN " pathname"TableNamep. 92
SynonymNamep. 92
+SE
CREATEDATABASE
IN dbspace
OL Log Clause
SE Log ClauseSEOL
OL
DatabaseNamep. 93
MODE ANSI
SE Log Clause
WITH LOG IN pathname
BUFFERED
LOG
LOG MODE ANSI
OL Log Clause
WITH
+
" "
databasename ""
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
CREATE INDEX66
CREATE INDEX
CLUSTER
DISTINCT
UNIQUE
ONClause
FILLFACTOR percent
OL
+
SynonymNamep. 92
ON TableNamep. 92
,
column name
DESC
ASC
( )ON Clause
IndexNamep. 92
6.0
filenameCREATE
PROCEDUREFROM " "
+6.0
Named Value p. 103
CREATE FOR
View Namep. 92
Table Namep. 92
SynonymNamep. 92
PRIVATE
PUBLIC
+
6.0
SYNONYM
CREATE TABLE 67
CREATE
tempTEMPTABLE name
table
TableName p. 92
ConstraintDefinition
p. 68
+
StorageOptionp. 69
( )Column
Definitionp. 67
Temp TableConstraintDefinition
p. 68
( )
,Temp Table
ColumnDefinition
, ,
TABLE ,
,
,
WITH NO LOG
column SQL Data Typep. 93
Column Definition
Column-LevelConstraintDefinition
NOT NULL
DEFAULTClause
6.0
Temp TableColumn Definition
column
NOT NULL
DEFAULTClause
SQL Data Typep. 93
Temp TableColumn
Constraintp.68
6.0
DEFAULT
DEFAULT Clause ConstantExpression
p. 97
NULL Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
CREATE TABLE68
UNIQUE
PRIMARY KEY
ConstraintNamep. 92
+
REFERENCESClausep. 69
CHECKClausep. 69
CONSTRAINT
Column-LevelConstraintDefinition
6.0
+
DISTINCT
Temp-Table ColumnConstraint
UNIQUE
PRIMARYKEY
CHECKClausep. 69
DISTINCT
+
UNIQUE
PRIMARY KEY
column
,
)(
FOREIGN KEY REFERENCESClausep. 69
+
CHECKClausep. 69
CONSTRAINT
column
,
)(
ConstraintDefinitiion
6.0
+
DISTINCT
ConstraintNamep. 92
CREATE TABLE 69
Temp-TableConstraintDefinition
UNIQUE column
,
)(
CHECKClausep. 69
DISTINCT
PRIMARY KEY
+
REFERENCESClause
( )
TableNamep. 92 ,
column
REFERENCES
ON DELETE CASCADE
OL+
6.0
CHECK Clause
)( Conditionp. 91CHECK
IN dbspace
SE
OL
LOCK MODEClausep. 70
Extent Option
Storage Option
IN pathname" "
Extent Option
EXTENT SIZE first kpages NEXT SIZE next kpages
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
CREATE TRIGGER70
LOCK MODE
PAGE
ROW
LOCK MODEClause
CREATE TRIGGER
+6.0
TriggerName
DELETE
UPDATEClausep. 71
ON
ON
InsertREFERENCING
Clausep. 71
ActionClause
71
TableNamep. 92
DeleteREFERENCING
Clausep. 71
ActionClausep. 71
TableNamep. 92
UpdateREFERENCING
Clausep. 72
ActionClausep. 71
TableNamep. 92
INSERT ON
ActionClause
Referencingp. 72
ActionClause
Referencingp. 72
ActionClause
Referencingp. 72
Trigger Name
Identifierp. 100
owner.
CREATE TRIGGER 71
UPDATE Clause
,
column name
UPDATE
OF
Action Clause
FOR EACHROW
BEFORETriggeredAction List
p. 72 TriggeredAction List
p. 72AFTER
TriggeredAction List
p. 72
FOR EACHROW
TriggeredAction List
p. 72
AFTERTriggeredAction List
p. 72
AFTERTriggeredAction List
p. 72
INSERTREFERENCING
ClauseREFERENCING NEW correlation name
AS
DELETEREFERENCING
Clause
REFERENCING OLD correlation name
AS
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
CREATE VIEW72
UPDATEREFERENCING
Clause
1
REFERENCING
AS
OLD correlationname
AS
NEW correlationname
1
ACTION ClauseReferencing
TriggeredAction ListBEFORE
FOR EACHROW
TriggeredAction List
AFTER TriggeredAction List
Triggered ActionList
,
Conditionp. 91WHEN
INSERTStatement
p. 77
UPDATEStatement
p. 88
DELETEStatement
p. 73
,
( )
( )
EXECUTEPROCEDURE
p. 75
CREATE VIEW AS
( )
,View
Name p. 92
SELECT(Subset)
p. 82
columnname
WITH CHECKOPTION
DATABASE
+
EXCLUSIVE
DatabaseNamep. 93
DECLARE 73
DECLARE
,
INSERTStatement(Subset)
p. 77
SELECTStatement
p. 82
FOR
+
++
+
WITHHOLD
FOR
SELECTStatement(Subset)
p. 82
WITHHOLD
SCROLLCURSOR
CURSOR
FORUPDATE
CursorNamep. 92
PreparedStatement
Namep. 103
columnOF
DELETE FROM
CURRENT OF
TableNamep. 92
ViewNamep. 92
Conditionp. 91
SynonymNamep. 92
CursorNamep. 92
WHERE
Table Namep. 92
SynonymNamep. 92
FORDROP AUDIT
+SE
DROP DATABASE
+
databasename
DatabaseNamep. 93
""
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
DROP INDEX74
DROP INDEXIndexNamep. 92
+
DROPPROCEDURE
ProcedureNamep. 92
+6.0
DROP SYNONYMSynonym
Namep. 92
+
DROP TABLE TableNamep. 92
SynonymNamep. 92
+
DROP TRIGGER TriggerNamep. 70
+6.0
DROP VIEW ViewNamep. 92
SynonymNamep. 92
+
EXECUTE 75
A procedure that returns no values must be executed by using PREPARE andEXECUTE. A procedure that returns values must be handled by using PREPARE andDECLARE, and then either a FOREACH loop or OPEN, FETCH, or CLOSE.
EXECUTE
,
USING
PreparedStatement
Name p. 103
+
Named Value p. 103
EXECUTEPROCEDURE
+6.0
,
ProcedureNamep. 92
( ),
Argument INTO Named Value p. 103
FETCH
PRIOR
FIRST
LAST
PREVIOUS
CURRENT
ABSOLUTE
-
++NEXT
INTO
,
data variable
RELATIVE
+
CursorName p. 92
row position
Named Value p. 103
FLUSHCursorName p. 92
+
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
FREE76
The 4GL compiler treats the name of the object to be freed in the order shown in thediagram. In other words, the compiler looks first for a TEXT or BYTE variable havingthe given name; if one exists, that is the object that is freed. If no TEXT or BYTE vari-able having that name exists, the compiler then looks for a prepared statement or acursor having that name and frees that.
When a TEXT or BYTE variable has the same name as a prepared statement or cursor,you cannot free resources allocated to the prepared statement or to the cursor.
FREE
CursorName p. 92
+
PreparedStatement
Name p. 103
TEXT or BYTENamed Value
p. 103
GRANT
ON
WITH GRANT OPTION
TO PUBLIC
user
,
AS grantor
TO PUBLIC
user
,
TableNamep. 92
+
+
ViewNamep. 92
Database-Level
Privilegesp. 81
Table-Level
Privilegesp. 77
SynonymNamep. 92
EXECUTE ONProcedure
Namep. 92
6.0
INSERT INTO 77
ALL
PRIVILEGES
DELETE
SELECT
UPDATE
REFERENCES
INDEX
ALTER
+
INSERT
Table-LevelPrivileges
,
6.0
,
columnname
( )+
,
columnname
( )
,
columnname
( )
1
1
1
1
1
1
1
INSERT INTO
,
SynonymNamep. 92
,
columnname
( )
TableName p. 92
ViewName p. 92
EXECUTE PROCEDUREProcedure
Namep. 92
Argumentp. 78
)(
VALUES Clause p. 78
SELECTStatement(Subset)
p. 82
6.0Basics
4GLForms
ReportsSQL
SQLCADebuggerVariables
Keys
INSERT INTO78
SPL parameter name =
Argument
SELECTStatement(singleton)
p. 82
SPLExpression
p. 112
NULL
)VALUES Clause
VALUES (
,
ConstantExpression
p. 97
Named Value p. 103
THRU
.*
. member
. member
RecordReference
p. 104
RecordReference
p. 104
RecordReference
p. 104
LOAD FROM 79
LOAD FROM
(
,
)
INSERT INTO
DELIMITER " delimiter"
column
TableNamep. 92
" filename "
SynonymNamep. 92
ViewNamep. 92
+
Named Value p. 103
Named Value p. 103
Named Value p. 103
LOCK TABLE IN SHARE
EXCLUSIVE
MODETableNamep. 92
SynonymNamep. 92
+
OPEN
,
USING
CursorName p. 92
Named Value p. 103
PREPAREQuotedString p. 104
FROM
PreparedStatement
Name p. 103
Named Value p. 103
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
PUT80
PUT
,
FROM
CursorName p. 92
+
Named Value p. 103
RECOVER TABLETableNamep. 92
+SE
TableNamep. 92
+. old column TO new columnRENAME COLUMN
RENAME TABLE
owner .
old name TO new name
+
REVOKE ON FROM PUBLIC
user
,
SynonymNamep. 92
ViewNamep. 92
TableNamep. 92
Table-LevelPrivileges
p. 81
Database-LevelPrivileges
p. 81
Procedure Namep. 92
+
6.0 EXECUTE ON
ROLLBACK WORK 81
PRIVILEGES
SELECT
UPDATE
INSERT
DELETE
INDEX
ALTER
,
REFERENCES
ALL
Table-LevelPrivileges
6.0
CONNECT
RESOURCE
DBA
Database-LevelPrivileges
ROLLBACK WORK
ROLLFORWARDDATABASE
DatabaseNamep. 93
+SE
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
SELECT82
SELECT
UNION
UNION ALLFROMClausep. 83
HAVINGClausep. 85
GROUP BYClausep. 85
WHEREClausep. 84
SelectClause
ORDER BYClausep. 86
INTO TEMPClausep. 86
+
INTOClausep. 83
SelectItemp. 83
SELECT Clause,
DISTINCT
ALL
+
UNIQUE
SELECT 83
Select Item
*
.
.
.Synonym
Namep. 92
ViewNamep. 92
TableNamep. 92
SQL Expressionp. 96
AS
+display label
INTOINTO Clause
,
Named Value p. 103
FROMAdditional
Tablesp. 84
,
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
tablealias
FROM Clause
AS
+
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
SELECT84
Additional Tables
OUTER
OUTER
( )
,
+
,
table alias
AdditionalTables
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
tablealias
table alias
AS
+
AS
AS
WHERE
AND
Conditionp. 91
Joinp. 85
WHERE Clause
SELECT 85
.
.
.
.
Join RelationalOperator
p. 104column name
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
table alias
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
table alias
column name
.
.
.
.
GROUP BY
,
select number
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
+
GROUP BY Clause
table alias
column name
.
.
.
.
HAVING Conditionp. 91
HAVING Clause
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
SET CONSTRAINTS86
ORDER BY
,
ASC
DESC
ORDER BY Clause
TableNamep. 92
ViewNamep. 92
SynonymNamep. 92
.
.table alias
select number
column name
display label
.
.
rowid
INTO TEMP Clause
WITH NO LOG
INTO TEMP temp table name
SETCONSTRAINTS IMMEDIATEALL
,Constraint Name
p. 92
+
DEFERRED
6.0OL
SET DEBUG FILE TO filename" "
WITH APPEND
character expression
+6.0
Named Value p. 103
SET EXPLAIN 87
SET EXPLAIN
+OFF
ON
SET ISOLATION DIRTY READ
COMMITTED READ
CURSOR STABILITY
REPEATABLE READ
TO
+OL
SET LOCK MODE WAIT
NOT WAIT
seconds
OL
+TO
SET LOG
BUFFERED
+OL
SETOPTIMIZATION
+6.0
HIGH
LOW
MODE ANSI
WITH LOG IN " pathname"Database
Namep. 93
+SE
START DATABASE
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
UNLOAD88
UNLOAD
+TO
DELIMITER " delimiter "" filename " SELECT
Statementp. 82
Named Value p. 103
Named Value p. 103
UNLOCK TABLETableNamep. 92
SynonymNamep. 92
+
UPDATE SET
WHERE
TableNamep. 92
ViewNamep. 92
Conditionp. 91
SET Clausep. 89
SynonymNamep. 92
CURRENT OFCursorNamep.92
UPDATE 89
*
,
( ) = ( )
=column name
columnname
TableNamep. 92
ViewNamep. 92
.*
.*
.*
SQL Expression(Subset)
p. 96
SELECTStatement(Subset)
p. 82
SQL Expression(Subset)
p. 96
SELECTStatement(Subset)
p. 82
SynonymNamep. 92
SET Clause
,
ReferencedValues
( )
ReferencedValues
. member
,
Record Reference
p. 104
Referenced Values
. member THRU
.*
. member
Record Reference
p. 104
Record Reference
p. 104
Record Reference
p. 104. member
RecordReference
p. 104
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
UPDATE STATISTICS90
UPDATESTATISTICS
+
FOR PROCEDURE6.0
ProcedureNamep. 92
LOWFOR
TABLE TableSpecification
6.0
DROP DISTRIBUTIONS
6.0
MEDIUM
FORTABLE RESOLUTION
percentconf
HIGH
FORTABLE RESOLUTION percent
6.0
TableSpecification
TableSpecification
Table Specification
Synonym Namep. 92
6.0
( )
,
column
Table Namep. 92
WHENEVER
+SQLERROR
NOT FOUND
ANY
CONTINUE
CALL function name
ERROR
STOP
+:label
label
WARNING
SQLWARNING
GO TO
GOTO
6.0
Condition 91
Condition
AND
OR
NOT
ComparisonCondition
INSubquery
p. 92
EXISTSSubquery
p. 92
ALL/ANY/SOMESubquery
p. 92
SQLSegments
ComparisonCondition
RelationalOperator
p. 104
IS
SQL Expressionp. 96
NOT
NOT
NOT
LIKEQuotedStringp. 104
,
BETWEEN AND
)(
MATCHES
INConstant
Expressionp. 97
NULL
NOT
+
+
ColumnExpression
p. 96
ColumnExpression
p. 96
NamedValue p. 103
SQL Expressionp. 96
SQL Expressionp. 96
SQL Expressionp. 96
SQL Expressionp. 96
SQL Expressionp. 96
ESCAPE " character"Basics
4GLForms
ReportsSQL
SQLCADebuggerVariables
Keys
IN Subquery92
IN Subquery
NOT
IN ( )SELECT(Subset)
p. 82
SQL Expressionp. 96
EXISTS Subquery
NOT
EXISTS ( )SELECT(Subset)
p. 82
ALL/ANY/SOMESubquery Relational
Operatorp. 104
ALL
ANY
SOME
SELECT(Subset)
p. 82)(SQL Expression
p. 96
Constraint Name
Synonym Name
@dbservername
' owner.'database
OL
Identifierp. 100
:
Table Name
View Name
Procedure Name
Index Name
Cursor NameIdentifierp. 100
Database Name 93
For SE engines, database identifiers can have up to ten characters in UNIX.
When the identifier for a database is also the name of a 4GL variable, the compiler usesthe variable. To override this compiler action, quote the database identifier.
Database NameIdentifierp. 100
@dbservernameOL
" //dbservername/dbname"
"/ pathname/dbname@dbservername"
SE
OL
Named Value p. 103
"// dbservername/pathname/dbname"
SQL Data TypeCharacterData Type
p. 94
NumberData Type
p. 94
TimeData Type
p. 95
Large ObjectData Type
p. 95 Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Character Data Type94
Character DataType
( 1 )
CHAR
VARCHAROL+
,0
NCHAR
CHARACTER6.0
+NLS
)size(
, reserve
)
6.0NLS
NVARCHAR
maximum(
NumberData Type
MONEY
REAL
( )+
+
+
16
precision
SERIAL
(start)
, 2, scale
INT
INTEGER
DOUBLE PRECISION
SMALLINT
( float precision )
FLOAT
SMALLFLOAT
DECIMAL
DEC
NUMERIC
precision( )
, scale16
( 1 )
Time Data Type 95
TimeData Type
+
+ DATETIME Field Qualifier
DATE
+ INTERVAL Field Qualifierp. 101
DATETIME
INTERVAL
Large ObjectData Type
BYTE IN TABLE
blobspace
OL+ TEXT
DATETIMEField Qualifier
YEAR
MONTH
DAY
MINUTE
SECOND
FRACTION
TO YEAR
TO MONTH
TO DAY
TO HOUR
TO MINUTE
TO SECOND
TO FRACTION
HOUR
( 3 )(digit)
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
SQL Expression96
When you refer to a column whose name is identical to that of a variable, youmust prefix the column name with an @ symbol; otherwise the 4GL compilertreats it as a variable.
SQL Expression
/
-
*
+
-+
Column Expression
p. 96
ConstantExpression
p. 97
FunctionExpression
p. 98
AggregateExpression
p. 100
)(
| |6.0
n UNITS datetime unit
Named Valuep. 103
SQL Expression
[first, last ]
table alias
TableNamep. 92
+
SynonymNamep. 92
ColumnExpression
.column name
ROWID
ViewNamep. 92
.
.
.
+@
Constant Expression 97
ConstantExpression
SITENAME
Literal Numberp. 103+
DATETIME FieldQualifier
p. 95
Literal DATETIMEp. 101
Literal INTERVALp. 102
OL
DBSERVERNAME
6.0
CURRENT
TODAY
USER
Quoted Stringp. 104
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Function Expression98
FunctionExpression
( ), ,
EXTEND ( ),
)
variable name
+
Quoted Stringp. 104
integerexpression
monthinteger
expression
dayinteger
expression
year
column name
.Table Namep. 92
(
( integer expression )HEX
DATETIMEField Qualifier
p. 95
date expression
datetime expression
date expression
datetime expression
SPL Expressionp. 112 )(Procedure
Namep. 92
6.0
MDY
LENGTH
DATE nondate expression )(
WEEKDAY
MONTH
YEAR
DAY
Algebraic Functionsp.99
DBINFO Functionp. 99
Exponential and Logarithmic Functionsp. 99
Trigonometric Functionsp. 100
( )
Algebraic Functions 99
AlgebraicFunctions
SQLExpression
p. 96
ABS
base, exponent
integer expression
numeric expression
ROUND
, rounding factor
dividend, divisor
POW
MOD
ROOT radicand
TRUNC
, truncating factor
SQRT
, index
)(
)
)
(
(
( )
)(
( )
)(
, 2
, 0
, 0
SQLExpression
p. 96
6.0
DBINFO Function
DBINFO 'DBSPACE' ,
'sqlca.sqlerrd1'
'sqlca.sqlerrd2'
OL tblspace num
expression
( )
Exponentialand Logarithmic
Functions
LOG10
float expressionLOGN
EXP float expression
float expression
)
)
)
(
(
(
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Trigonometric Functions100
TrigonometricFunctions
TAN
SIN
COS
ATAN2 y, x
numeric expression
radian expression )(
)
)
(
(
ACOS
ASIN
ATAN
AggregateExpression
TableNamep. 92
( )columnname
AVG
MAX
MIN
SUM
COUNT
DISTINCT
AVG
MAX
MIN
SUM
(
ALL
Expression(Subset)
p. 96
)
.
COUNT (*)
(
UNIQUE
DISTINCT
UNIQUE
Identifierletter
17 letter
digit
underscore
INTERVAL Field Qualifier 101
INTERVALField Qualifier
YEAR
MONTH
DAY
MINUTE
SECOND
FRACTION
TO YEAR
TO MONTH
TO DAY
TO HOUR
TO MINUTE
TO SECOND
TO FRACTION
HOUR
(y-precision)(4)
(precision)(2)
(precision)(2)
(precision)(2)
(precision)(2)
(precision)(2)
(f-precision)(3)
Literal DATETIMEDATETIME ( ) DATETIME
Field Qualifierp. 95
NumericDatetime
p. 102
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Numeric Datetime102
yyyy
-
mo
-
dd
space
hh
mi
ss
f
:
.
:
Numeric Datetime
Literal INTERVAL
INTERVAL ( ) INTERVALField Qualifier
p. 101Numeric Interval
yyyy
-mo
dd
space
hh
mi
ss
f
:
.
:
Numeric Interval
Literal Number 103
Literal Numberdigit
digit.-+
E digit
+-
.
Named Value
integer expression
,
[array3 ]
.record
variable
Function Call
function (,
integer expression
)
PreparedStatement Name
Identifierp. 100
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Quoted String104
Quoted String
character
" "
character
'" "
'
+
''
Record Reference
integer expression
,
[array3 ]
.record
program record
RelationalOperator
<
<=
=
<>
>=
>
!=
105
It is important to recognize that Stored Procedure Language (SPL) statements arenot part of 4GL. This means that you cannot include these statements within a 4GLprogram. Doing so causes compile errors.
To create a stored procedure from a 4GL program, do the following:
1. Put the text of the CREATE PROCEDURE statement in a file.
2. Use a PREPARE statement to prepare a CREATE PROCEDURE FROM statementthat refers to the text file created in Step 1.
3. Use an EXECUTE statement to execute the prepared statement, which thencompiles the stored procedure.
Refer to the Informix Guide to SQL: Reference, Version 6.0 for a full description of theCREATE PROCEDURE statement.
You may explicitly invoke stored procedures from within your 4GL program bypreparing and executing the following SQL statements:
• CREATE PROCEDURE FROM
• DROP PROCEDURE
• EXECUTE PROCEDURE
• GRANT
• INSERT INTO
• REVOKE
• SET DEBUG FILE TO
• UPDATE STATISTICS
Refer to the Informix Guide to SQL: Reference, Version 6.0 for a description ofworking with dynamic SQL.
Also, you may implicitly invoke a stored procedure through a reference to thatprocedure within the context of an SQL expression. For example, the reference toavg_price( ) in the following SELECT statement implicitly invokes the stored pro-cedure having the name avg_price:
selectmanu_code, unit_price,
(avg_price(1) - unit_price) variancefrom stockwhere stock_num = 1
Such implicit references to stored procedures do not require thestatement to be prepared.
StoredProcedureLanguageStatements
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
CALL106
CALLProcedure
Namep. 92
;( )
,
SPLExpression
p. 112
SELECTStatement(Subset)
p. 82
parameter name =
Argument RETURNINGprocedurevariable
,
Argument
FOREACH
WHILE
FOR ;CONTINUE
GLOBAL SQL Data Type(Subset)
p. 93
DefaultValuep. 107
DEFAULT
,
variablename
DEFAULTNULL
REFERENCES
REFERENCES
SQL Data Type(Subset)
p. 93
BYTE
TEXT
PROCEDURE
Table Namep. 92 . columnLIKE
BYTE
TEXT
;
,variablename
OL
OL
SynonymNamep. 92
View Namep. 92
DEFINE
EXIT 107
ConstantExpression
p. 97
Default Value
NULL
EXIT
FOREACH
WHILE
FOR ;
FOR )
,variablename left
expressionTO right
expressionIN (
StatementBlockp. 108
ENDFOR
,
expression
;incrementexpression
leftexpression
TO rightexpression
=
incrementexpression
STEP
STEP
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
FOR108
BEGIN END
CONTINUEStatement
p. 106
IFStatement
p. 109
EXITStatement
p. 107
FORStatement
p. 107
FOREACHStatement
p. 109
LETStatement
p. 111
RAISE EXCEPTIONStatement
p. 111
RETURNStatement
p. 111
TRACEStatement
p. 112
WHILEStatement
p. 112
SYSTEMStatement
p. 111
EXECUTE PROCEDUREStatement
see SQL:S, Version 6.0
CALLStatement
p. 106
SQL Statement
ONEXCEPTION
Statementp. 111
DEFINEStatement
p. 106
StatementBlock
StatementBlock
FOREACH 109
FOREACH
,
SELECT...INTOStatement
p. 83
StatementBlockp. 108
ENDFOREACH
;cursorname FOR
WITH HOLD
WITH HOLD
EXECUTEPROCEDURE
ProcedureNamep. 92
( )
variablenameINTO
SPLExpression
(Subset)p. 112
,
variablename =
IF
;
Conditionp. 91
THEN
ELIF Conditionp. 91 THEN
IF StatementList
p. 110
IF StatementList
p. 110
END IF
IF StatementList
p. 110
ELSE
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
IF110
BEGIN END
CONTINUEStatement
p. 106
IFStatement
p. 109
EXITStatement
p. 107
FORStatement
p. 107
FOREACHStatement
p. 109
LETStatement
p. 111
RAISE EXCEPTIONStatement
p. 111
RETURNStatement
p. 111
TRACEStatement
p. 112
WHILEStatement
p. 112
SQL Statement
SYSTEMStatement
p. 111
CALLStatement
p. 106
IF Statement ListStatement
Blockp. 108
LET 111
LET
,
,variablename = Procedure
Namep. 92
,
(SPL
Expressionp. 112
;)
SPL Expression
p. 112
calledvariable =
,
,
StatementBlockp. 108
END EXCEPTION
errornumberIN )(
SETSQLerror
variable
;
errordata
variable
WITH RESUME
,
ISAMerror
variable,
ON EXCEPTION
;SQL error
, ISAM error
, error text
RAISEEXCEPTION
,SPL
Expressionp. 112
WITH RESUME
;RETURN
character expression" ;"
character variable
SYSTEM
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
TRACE112
TRACE ON
OFF
PROCEDURE
SPLExpression
;
Conditionp. 91
StatementBlockp. 108
END WHILE
;
WHILE
SPL Expression
+-*
procedurevariablename
SQL Expressionp. 96
/ ( )SPLExpression
ProcedureNamep. 92
calledvariable
,
( )=
SPL Expression
| |
Basics4GL
FormsReports
SQLSQLCA
Debugger
SQLCA Record
VariablesKeys
114
DEFINE SQLCA RECORDSQLCODE INTEGER,SQLERRM CHAR(71),SQLERRP CHAR(8),SQLERRD ARRAY [6] OF INTEGER,SQLAWARN CHAR (8)
END RECORD
Summary of fields:
SQLCODE indicates the result of executing an SQL statement.It is set as follows:
• To zero for a successful execution of most statements.
• To NOTFOUND (defined as 100) for a successfully executed query thatreturns zero rows or for a FETCH that seeks beyond the end of an activeset. (However, in an ANSI-compliant database, when an INSERT INTO/SELECT statement or a DELETE, UPDATE, or SELECT INTO TEMP state-ment fails to access any rows, the value of SQLCA.SQLCODE is set toNOTFOUND rather than 0.)
• To a negative value for an unsuccessful execution.
INFORMIX-4GL sets the global variable STATUS equal to SQLCODE aftereach SQL statement. However, any subsequent 4GL statement can resetSTATUS.
SQLERRM contains parameters for the error message.
SQLERRP is reserved for future use.
SQLERRD is an array of six integers:
SQLERRD[1] is the estimated number of rows returned.
SQLERRD[2] is the SERIAL value returned or an error code.
SQLERRD[3] is the number of rows processed.
SQLERRD[4] is a weighted sum of disk accesses and total rowsprocessed, the estimated CPU cost of the query.
SQLERRD[5] is the offset of error into the SQL statement.
SQLERRD[6] is the rowid of the last row processed.
Result Code Details of Statement Execution Special Conditions
STATUSorSQLCA.SQLCODE
SQLCA.SQLERRD[1]throughSQLCA.SQLERRD[6]
SQLCA.SQLAWARN[1]throughSQLCA.SQLAWARN[8]
115
SQLAWARN is a character string of length eight whose individual characters signalvarious warning conditions (as opposed to errors) following the exe-cution of an SQL statement. The characters are blank if no problemsor exceptional conditions are detected.
SQLAWARN[1] is set to W if one or more of the other warningcharacters has been set to W. If SQLAWARN[1] isblank, you do not have to check the remainingwarning characters.
SQLAWARN[2] is set to W if one or more data items were truncated tofit into a character variable or if a DATABASE state-ment selected a database with transactions.
SQLAWARN[3] is set to W if an aggregate function (SUM, AVG, MAX,or MIN) encountered a null value in its evaluation orif a DATABASE statement selected an ANSI-compli-ant database.
SQLAWARN[4] is set to W if a DATABASE statement selected anINFORMIX-OnLine Dynamic Server<Default ¶ Fo>database or when the number of items in the select-list of a SELECT clause is not the same as the numberof program variables in the INTO clause. In the lattercase, the number of values INFORMIX-4GL returns isthe smaller of these two numbers.
SQLAWARN[5] is set to W if float-to-decimal conversion is used.
SQLAWARN[6] is set to W when your program executes an Informixextension to ANSI-compliant standard syntax andthe DBANSIWARN environment variable is set or the-ansi option is specified.
SQLAWARN[7] is reserved for future use.
SQLAWARN[8] is reserved for future use.
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
116
InteractiveDebuggerCommands
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
118
The following table lists the Debugger commands, options, and accelerators.
Command Option Shortest Form
? ?/ /ALIAS alAPPLICATION
DEVICEap
ap dBREAK
IFb
b ifCALL caCLEANUP
ALLcl
cl aCONTINUE coDATABASE daDISABLE
ALLdi
di allDUMP
ALLGLOBALS
dudu adu g
ENABLEALL
enen all
EXIT exFUNCTIONS fGROW
SOURCECOMMAND
gg sg c
HELPALL
hh a
LET leLIST
BREAKTRACE
lili bli t
NOBREAKALL
nobnob all
NOTRACEALL
notnot all
PRINT pREAD reRUN ruSTEP
INTONOBREAK
ss is n
TIME DELAYSOURCE
COMMAND
titi sti c
Command-Line Syntax 119
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
After setting a breakpoint (or tracepoint), the Output text region displays:
TRACEFUNCTIONS
trtr functions
TURNONOFF
tutu ontu of
USE usVARIABLE
ALLGLOBALS
vava all
va globalsVIEW
LINEvi
vi lWHERE whWRITE
ALIASBREAKTRACE
wrwr awr bwr t
To: Type:
Escape ! commandInterrupt CONTROL-D or Del keyRedraw CONTROL-R
Screen CONTROL-P
Toggle CONTROL-T
Search for characters / pattern? pattern
Command Option Shortest Form
referencenumber
(2) break show_menu:91 [customer.4gl]scope function: show_menu
checkpointtype function
linenumber module
checkpoint scope
Command-Line Syntax
ALIAS120
These built-in operators can be used in a boolean expression:
CURRENT ENTEND( ) TODAYDATE( ) INTERVAL( ) UNITSDATETIME( ) MDY( ) WEEKDAY( )DAY( ) MONTH( ) YEAR( )
pattern/
pattern?
ALIASAL
alias name = command
*
CommandList
p. 127
DEVICE
APPLICATIONAP
break line
CommandList
p. 127
CheckpointTargetp. 127
- countCheckpointInitializaton
p. 126
IF boolean expressionBREAKB
,
argument
function name ( )CALLCA
CLEANUP 121
Basics4GL
FormsReports
SQLSQLCA
ebuggerariables
Keys
To select a remote database, use one of the following formats:
Remote Database Engine Format of database name
INFORMIX-OnLineDynamic Server
database@servernameor//servername/database
INFORMIX-SE //servername/path/database
CLEANUPCL
ALL
CONTINUECO
databaseDATABASEDA
CheckpointIdentification
p. 126
DISABLEDI
ScopeList
p. 128Output
Redirectionp. 127
DUMPDU
CheckpointIdentification
p. 126ENABLE
EN
EXITEX
DV
FUNCTIONS122
A pattern is a string of no more than 50 characters and blanks or up to80 characters if enclosed in quotation marks.
You can use the following wildcard characters within the pattern:
Pattern Matches
? any single character
* zero or more characters
[characters] one or more unseparated characters[character-character] characters within the range
in ASCII collating sequence
FUNCTIONSF
patternOutput
Redirectionp. 127
GROWG
–
integer
SOURCE
COMMAND
HELPH
ALL
command
ScopeQualification
p. 128
variable = 4GL expression LETLE
BREAK
TRACE
LISTLI
NOBREAK 123
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
These built-in operators can be used within a 4GL expression:
To pass arguments to the p-code runner, include them on theDebugger command line.
CURRENT ENTEND( ) TODAYDATE( ) INTERVAL( ) UNITSDATETIME( ) MDY( ) WEEKDAY( )DAY( ) MONTH( ) YEAR( )
NOBREAKNOB
CheckpointIdentification
p. 126
CheckpointIdentification
p. 126
NOTRACENOT
PRINTP
OL
4GL expression
OutputRedirection
p. 127PROGRAM = " program"
filename
.4db
READRE
argument
RUNRU
STEPS
number INTO NOBREAK
TIME DELAY124
TIME DELAYTI
integer
SOURCE
COMMAND
CheckpointTargetp. 127
FUNCTIONSCheckpointInitialization
p. 126
CommandList
p. 127
OutputRedirection
p. 127
TRACETR
EXITSOURCE
AUTOTOGGLE
ON
OFF
PRINTDELAY
SOURCETRACE
DISPLAYSTOPS
TURNTU
=pathname
,USE
US
VARIABLEVA
variableScopeQualification
p. 128
ScopeList
p. 128Output
Redirectionp. 127
VIEW 125
VIEWVI
filename
function
number
LINE
OutputRedirection
p. 127
WHEREWH
BREAK
TRACE
ALIAS
>>
filename
WRITEWR
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Checkpoint Identification126
4GLInteractiveDebuggerCommandSegments
A reference name must:• Be unique among other checkpoint names.• Begin with an alphabetic character.• Contain only letters, numbers, or the underscore ( _ ) character.
CheckpointIdentification
reference number
reference name
function name
ALL
CheckpointInitialization
* ( function name ) " reference name"
Checkpoint Target 127
Type Valid Entities Triggered When
statement executable statements within 4GLfunctions
Execution completes previousstatement.
variable †active variables Variable is assigned a different value.function 4GL functions (including MAIN), 4GL
reports, ESQL/C functions, C functionsFunction is called.
†You cannot set a checkpoint on an entire array or record structure.
Checkpoint Target
ScopeQualification
p. 128
function name
variable
statement line
module .
Command List
{ }command
;
Output Redirection
>> filename
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Scope List128
Scope List
GLOBALS
ALL
Scope Qualification
MODULE. module
FUNCTION. function
.GLOBAL
EnvironmentVariables
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Environment Variables130
INFORMIXEnvironment Variable Restrictions
INFORMIX-4GL ReferencePage
DBANSIWARN D-8DBDATE D-9DBDELIMITER D-11DBEDIT D-11DBFORMAT D-14DBLANG D-18DBMONEY D-21DBPATH D-23DBPRINT D-26DBREMOTECMD OnLine only D-27DBSPACETEMP OnLine only D-28DBTEMP SE only D-29DBUPSPACE D-29ENVIGNORE D-30INFORMIXCONRETRY D-30INFORMIXCONTIME D-31INFORMIXDIR D-32INFORMIXSERVER D-33INFORMIXSHMBASE OnLine only D-33INFORMIXSTACKSIZE OnLine only D-34INFORMIXTERM D-34ONCONFIG OnLine only D-36PSORT_DBTEMP OnLine only D-36PSORT_NPROCS OnLine only D-37SQLEXEC D-38SQLRM SQL APIs only D-38SQLRMDIR SQL APIs only D-39
Environment Variables 131
sics4GLrmsortsSQLLCAggerbleseys
NLS Environment VariableINFORMIX-4GL ReferencePage
COLLCHAR E-18DBAPICODE E-23DBNLS E-16LANG E-25LC_COLLATE E-27LC_CTYPE E-29LC_MONETARY E-31LC_NUMERIC E-35
UNIX Environment VariableINFORMIX-4GL ReferencePage
PATH D-40TERM D-41TERMCAP D-41TERMINFO D-42
Ba
FoRep
SQDebuVaria
K
Environment Variables132
Basics4GL
FormsReports
SQLSQLCA
Debugger
Default KeyAssignments
VariablesKeys
Default Key Assignments134
Logical command keys at runtime and their default assignments:
Effect of special keys on interactive 4GL statements and within 4GL menus:
KeyName Purpose of Key Default Keystroke
Accept Selects the current menu option in a MENUstatement; terminates input during CONSTRUCT,INPUT and INPUT ARRAY; terminates DISPLAYARRAY.
Escape
Interrupt Represents the external interrupt signal; availablewhen interrupts are deferred with the DEFERstatement.
CONTROL-C
Insert Requests insertion of a new line during INPUTARRAY, starting execution of a BEFORE INSERT block.
F1
Delete Requests deletion of the current line during INPUTARRAY, starting execution of a BEFORE DELETEblock.
F2
Next Causes scrolling to the next page (group of lines)during DISPLAY ARRAY and INPUT ARRAY.
F3
Previous Causes scrolling to the previous page (group of lines)during DISPLAY ARRAY and INPUT ARRAY.
F4
Help Starts the display of the specified HELP message fromthe current help file.
CONTROL-W
Quit Terminates the program unless DEFER QUIT isspecified.
CONTROL-\
Key NameUse in CONSTRUCT, INPUT, andINPUT ARRAY Use in MENU
CONTROL-A Switches between overtype and insertmodes.
None.
CONTROL-D Deletes from the cursor to the end of thefield.
None.
CONTROL-H(backspace)
During text entry, moves the cursor left oneposition (nondestructive backspace).
Moves highlight to nextoption left.
CONTROL-Ior TAB
Cursor moves to next field; except in aWORDWRAP field, inserts a tab or skips to atab depending on mode.
None.
CONTROL-J(Linefeed)
Cursor moves to next field; except in aWORDWRAP field, inserts a newline ormoves down one line depending on mode.
Moves the highlight tothe next option right.
CONTROL-L During text entry, moves the cursor rightone position.
Moves the highlight tothe next option right.
Default Key Assignments 135
Default function key assignments in the Debugger:
CONTROL-Mor RETURN
Completes entry of the current field. Cursormoves to next field if any; else same asAccept.
Accepts the option thatis currently highlighted.
CONTROL-N Cursor moves to beginning of current field. None.CONTROL-R Causes the screen to be redrawn. Causes the screen to be
redrawn.CONTROL-X Deletes the character under the cursor. None.Left Arrow Same as Backspace. Same as Backspace.Right Arrow Same as CONTROL-L. Same as CONTROL-L.
Up Arrow Moves to previous field; except ina WORDWRAP field moves up one line infield and in an INPUT ARRAY moves to thecorresponding field in the previous row.
Moves the highlight tothe next option left.
Down Arrow Moves to next field; except in a WORDWRAPfield moves down one line in field and in anINPUT ARRAY moves to the correspondingfield in the next row.
Moves the highlight tothe next option right.
Default Key Equivalent Command
F1 HELP
F2 STEP
F3 STEP INTO
F4 CONTINUE
F5 RUN
F6 LIST BREAK TRACE
F7 LIST
F8 DUMP
F9 EXIT
Key NameUse in CONSTRUCT, INPUT, andINPUT ARRAY Use in MENU
Basics4GL
FormsReports
SQLSQLCA
DebuggerVariables
Keys
Default Key Assignments136