Statement syntax: Difference between revisions
m (→FOR EACH RECORD: mixed case For Each Record) |
m (mixed case for statements) |
||
Line 883: | Line 883: | ||
===Retrieval condition syntax=== | ===Retrieval condition syntax=== | ||
<p> | <p> | ||
A <var> | A <var>Find</var> or <var>For Each Record</var> statement can be followed by any number of retrieval conditions separated by an end of line or [[LINEND parameter]] character.</p> | ||
<p> | <p> | ||
Conditions can be constructed as follows: </p> | Conditions can be constructed as follows: </p> | ||
=====Syntax===== | =====Syntax===== | ||
<p class="syntax">[ | <p class="syntax">[Not] <span class="term">phrase</span> [<span class="squareb">{</span>And <span class="squareb">|</span> Or <span class="squareb">|</span> Nor<span class="squareb">}</span> [Not] <span class="term">phrase</span>] ... | ||
</p> | </p> | ||
Where: | Where: | ||
Line 894: | Line 894: | ||
<var class="term">phrase</var> can be constructed as follows:</p> | <var class="term">phrase</var> can be constructed as follows:</p> | ||
<ul style="font-family: Consolas,monospace"> | <ul style="font-family: Consolas,monospace"> | ||
<li><i>fieldname</i> = <span class="squareb">[</span> | <li><i>fieldname</i> = <span class="squareb">[</span>Not<span class="squareb">]</span> <i>value</i> | ||
<li><i>fieldname</i> | <li><i>fieldname</i> Like <i>pattern</i> | ||
<li><i>fieldname</i> | <li><i>fieldname</i> Is [Not] <span class="squareb">{</span>Present <span class="squareb">|</span> Like '<i>pattern</i>'<span class="squareb">}</span> | ||
<li><i>fieldname</i> | <li><i>fieldname</i> Is [Not] <span class="squareb">{</span>[Numerically <span class="squareb">|</span> Alphabetically] <br> | ||
[ | [Eq <span class="squareb">|</span> = <span class="squareb">|</span> Ne <span class="squareb">|</span> ¬= <span class="squareb">|</span> Greater Than <span class="squareb">|</span> Gt <span class="squareb">|</span> > <span class="squareb">|</span> Less Than <br><span class="squareb">|</span> Lt <span class="squareb">|</span> < <span class="squareb">|</span> Le <span class="squareb">|</span> <= <span class="squareb">|</span> Ge <span class="squareb">|</span> >= <span class="squareb">|</span> Before <span class="squareb">|</span> After] <i>value</i><span class="squareb">}</span> | ||
<li><i>fieldname</i> | <li><i>fieldname</i> Is [Not] <span class="squareb">{</span>[Numerically <span class="squareb">|</span> Alphabetically] <br> | ||
<span class="squareb">{</span> | <span class="squareb">{</span>In Range [From <span class="squareb">|</span> After] <i>value1</i> <span class="squareb">{</span>To <span class="squareb">|</span> [And] Before<span class="squareb">}</span> <br> | ||
<i>value2</i> <span class="squareb">|</span> | <i>value2</i> <span class="squareb">|</span> Between <i>value1</i> And <i>value2</i><span class="squareb">}</span> | ||
<li> | <li>Files <i>filename</i> | ||
<li> | <li>Find$ <i>label</i> | ||
<li> | <li>List$ <i>listname</i> | ||
<li> | <li>Location <span class="squareb">{</span><i>location</i> <span class="squareb">|</span> =<span class="squareb">}</span> | ||
<li> | <li>[[#Point$|Point$]] <i>value</i> | ||
<li> | <li>[[#Sfge$ and Sfl$|Sfge$]] <i>value</i> | ||
<li> | <li>[[#Sfge$ and Sfl$|Sfl$]] <i>value</i> | ||
<p> | <p> | ||
where <i>value</i> can be:</p> | where <i>value</i> can be:</p> | ||
<ul> | <ul> | ||
<li>A literal number or string</li> | <li>A literal number or string</li> | ||
<li> | |||
<li><var>Value <span class="squareb">{</span>[In] <i>label</i><span class="squareb">}</span> <span class="squareb">|</span> (<i>expression</i>)</var> </li> | |||
<li>A %variable </li> | <li>A %variable </li> | ||
</ul> | </ul></li> | ||
</ul> | </ul> | ||
<p><b>Notes:</b></p> | <p><b>Notes:</b></p> | ||
<ul> | <ul> | ||
<li>The first character (<code> | <li>The first character (<code>¬</code>) of the "not-equal" test (<code>¬=</code>) in the fourth of the items in the list above is the EBCDIC "not sign," which has the hexadecimal value <code>5f</code>. | ||
<li>For a description of the pattern in the < | <li>For a description of the pattern in the <var>[Is] Like</var> and <var>Is Not</var> clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]]. | ||
</ul> | </ul> | ||
Line 974: | Line 975: | ||
====Use of expressions==== | ====Use of expressions==== | ||
<p> | <p> | ||
Expressions can be used in <var> | Expressions can be used in <var>Find</var> statements to provide the retrieval condition for the <var>Point$</var>, <var>Sfl$</var>, and <var>Sfge$</var> conditions, as well as for the <var>Eq Value</var> clause: </p> | ||
===== | =====Point$===== | ||
======Syntax====== | ======Syntax====== | ||
<p class="syntax"> | <p class="syntax">Point$ Value(<span class="term">expression</span>) | ||
</p> | </p> | ||
Where: | Where: | ||
<p> | <p> | ||
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, | <var class="term">expression</var> is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression. It is preceded by the keyword <var>Value</var>. </p> | ||
======Example====== | ======Example====== | ||
Line 1,001: | Line 1,002: | ||
</p> | </p> | ||
===== | =====Sfl$ and Sfge$===== | ||
======Syntax====== | ======Syntax====== | ||
<p class="syntax"> | <p class="syntax">Sfl$ Value(<span class="term">expression</span>) | ||
</p> | </p> | ||
<p> | <p> | ||
or</p> | or</p> | ||
<p class="syntax"> | <p class="syntax">Sfge$ Value(<span class="term">expression</span>) | ||
</p> | </p> | ||
Where: | Where: | ||
<p> | <p> | ||
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, | <var class="term">expression</var> is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression. It is preceded by the keyword <var>Value</var>. </p> | ||
======Example====== | ======Example====== | ||
Line 1,035: | Line 1,036: | ||
</p> | </p> | ||
===== | =====Eq Value===== | ||
======Syntax====== | ======Syntax====== | ||
<p class="syntax"><span class="term">fieldname</span> | <p class="syntax"><span class="term">fieldname</span> Eq Value(<span class="term">expression</span>) | ||
</p> | </p> | ||
Where: | Where: | ||
<p> | <p> | ||
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, | <var class="term">expression</var> is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression. </p> | ||
======Example====== | ======Example====== | ||
Line 1,060: | Line 1,061: | ||
<p> | <p> | ||
<var class="term">term</var> can be constructed as follows:</p> | <var class="term">term</var> can be constructed as follows:</p> | ||
<p class="syntax"><span class="squareb">{</span>'<span class="term">string</span>' <span class="squareb">|</span> <span class="term">%variable</span> <span class="squareb">|</span> | <p class="syntax"><span class="squareb">{</span>'<span class="term">string</span>' <span class="squareb">|</span> <span class="term">%variable</span> <span class="squareb">|</span> Count In <span class="term">label</span> <span class="squareb">|</span> Occurrence In <span class="term">label</span> <span class="squareb">|</span> Value in <span class="label">term</span> <span class="squareb">|</span> <span class="term">function</span><span class="squareb">}</span> | ||
<span class="squareb">[</span> | <span class="squareb">[</span>At <span class="squareb">[</span>Column<span class="squareb">]</span> <span class="term">m</span><span class="squareb">]</span> <span class="squareb">[</span>To <span class="squareb">[</span>Column<span class="squareb">]</span> <span class="term">n</span><span class="squareb">]</span> | ||
</p> | </p> | ||
<p> | <p> | ||
or, if the statement is within a record loop: | or, if the statement is within a record loop: | ||
</p> | </p> | ||
<p class="syntax"><span class="squareb">{</span><span class="squareb">{</span> | <p class="syntax"><span class="squareb">{</span><span class="squareb">{</span>Each <span class="squareb">|</span> <span class="n">term</span><span class="squareb">}</span> <span class="term">fieldname</span> <span class="squareb">|</span> *Record <span class="squareb">|</span> *Id<span class="squareb">}</span> | ||
[ | [At [Column] <span class="term">m</span>] [To [Column] <span class="term">n</span><span class="squareb">}</span> | ||
</p> | </p> | ||
Line 1,077: | Line 1,078: | ||
<ul> | <ul> | ||
<li>Assignment statements </li> | <li>Assignment statements </li> | ||
<li>Conditional <var> | <li>Conditional <var>If</var> statements and <var>ElseIf</var> clauses</li> | ||
</ul> | </ul> | ||
<p> | <p> | ||
In the simplified syntax for an <var> | In the simplified syntax for an <var>If</var> statement, which is:</p> | ||
<p class="syntax"> | <p class="syntax">If <span class="term">condition</span> Then <span class="term">statements</span> | ||
</p> | </p> | ||
<p> | <p> | ||
<var class="term">condition</var> expands to the syntax described in this section. Be sure to enclose an expression with parentheses. </p> | <var class="term">condition</var> expands to the syntax described in this section. Be sure to enclose an expression with parentheses. </p> | ||
<ul> | <ul> | ||
<li>Computed <var> | <li>Computed <var>Jump To</var> statements </li> | ||
<li>Subscripts </li> | <li>Subscripts </li> | ||
<li>Function arguments | <li>Function arguments </li> | ||
</ul> | </ul> | ||
Line 1,113: | Line 1,114: | ||
<td>And</td> | <td>And</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><b>-</b></td> | <td><b>-</b></td> | ||
<td><b> | <td><b>¬=</b></td> | ||
<td>NE</td> | <td>NE</td> | ||
<td>Or</td> | <td>Or</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><b>*</b></td> | <td><b>*</b></td> | ||
Line 1,125: | Line 1,128: | ||
<td>With (Note: this can also be achieved via [[Implicit concatenation]])</td> | <td>With (Note: this can also be achieved via [[Implicit concatenation]])</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><b>/</b></td> | <td><b>/</b></td> | ||
Line 1,131: | Line 1,135: | ||
<td>Is [Not] Present (Note: applied either to a field or to an [[Methods#optionalParams|optional or default method parameter]])</td> | <td>Is [Not] Present (Note: applied either to a field or to an [[Methods#optionalParams|optional or default method parameter]])</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> </td> | <td> </td> | ||
Line 1,137: | Line 1,142: | ||
<td>Is [Not] Like</td> | <td>Is [Not] Like</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> </td> | <td> </td> | ||
Line 1,143: | Line 1,149: | ||
<td></td> | <td></td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> </td> | <td> </td> | ||
Line 1,150: | Line 1,157: | ||
</tr> | </tr> | ||
</table> | </table> | ||
<blockquote class="note"><b>Notes:</b> | <blockquote class="note"><b>Notes:</b> | ||
<ul> | <ul> | ||
<li>The first character (<code> | <li>The first character (<code>¬</code>) of the inequality test above is the EBCDIC "not sign," which has the hexadecimal value <code>5f</code>. | ||
<li>For a description of the <code> | |||
<li>For a description of the <code>Is Like</code> and <code>Is Not</code> clauses, see the syntax of [[Is Like pattern matching|Is Like patterns]]. | |||
</ul> | </ul> | ||
</blockquote > | </blockquote > | ||
=== | ===In clause syntax=== | ||
<p> | <p> | ||
The SOUL statements on this page whose syntax display is preceded by an asterisk (<tt>*</tt>) support an <var> | The SOUL statements on this page whose syntax display is preceded by an asterisk (<tt>*</tt>) support an <var>In</var> clause. </p> | ||
<p> | <p> | ||
The three basic forms of the <var> | The three basic forms of the <var>In</var> clause are: </p> | ||
<p class="syntax"> | <p class="syntax">In [Permanent <span class="squareb">|</span> Temporary ] Group <span class="term">groupname</span> | ||
Member [<span class="term">%member</span> <span class="squareb">|</span> [<span class="term">filename</span> [At <span class="squareb">{</span>location <span class="squareb">|</span> =<span class="squareb">}</span>]]</p> | |||
<p class="syntax"> | <p class="syntax">In <span class="term">file1</span> [,<span class="term">file2</span>] ...</p> | ||
<p class="syntax"> | <p class="syntax">In <span class="squareb">{</span>$Curfile <span class="squareb">|</span> $pdate<span class="squareb">}</span></p> | ||
<p>The form | <p> | ||
The form <var>In $Curfile</var> can be used only within a record loop.</p> | |||
==== | ====In Group Member limitations==== | ||
<p> | <p> | ||
In addition to the three basic forms of the | In addition to the three basic forms of the In clause shown above, the <var>In Group Member</var> clause restricts the following statements to one member file in a group context:</p> | ||
<ul> | <ul> | ||
<li><var> | <li><var>Clear List</var></li> | ||
<li><var> | <li><var>Find All Records</var> (and its variants)</li> | ||
<li><var> | <li><var>Find All Values</var></li> | ||
<li><var> | <li><var>For Record Number</var> (or <var>FRN</var>)</li> | ||
<li><var> | <li><var>Store Record</var> </li> | ||
</li> | |||
</ul> | </ul> | ||
<p> | <p> | ||
You cannot use an <var> | You cannot use an <var>In Group Member</var> clause with a <var>For Each Record</var> statement or with an <var>Add</var>, <var>Change</var>, or <var>Delete Record</var> statement. Only the previously listed statements call accept an <var>In Group Member</var> clause.</p> | ||
====Using an | ====Using an In clause in a Begin...End block==== | ||
<p> | <p> | ||
The file name in the <var> | The file name in the <var>In</var> clause used within a <var>Begin...End</var> block is resolved by the compiler. You can hard-code a file name or use some type of dummy string for the file name. Using a %variable for the file name is not allowed. </p> | ||
===Subscript syntax=== | ===Subscript syntax=== | ||
<p> | <p> | ||
A subscript has the format: | A subscript has the format: </p> | ||
=====Syntax===== | =====Syntax===== |
Revision as of 21:52, 1 May 2018
This page summarizes SOUL syntax and conventions, which are discussed in more detail throughout this wiki. The SOUL statements are listed in alphabetical order. Many of the section titles or syntax blocks contain links to the wiki page describing the statement or syntax phrase. A later section provides other SOUL syntax information, including links to information about the "tokens" of SOUL, such as names in SOUL.
All SOUL statements can be used between a Begin (or More) command and an End statement.
External Call Facility (ECF) statements are listed under External.
Various other Model 204 commands also have effects on the results of a SOUL request.
The following unusual notations are used in the presentation of the SOUL syntax:
* ** + ++ C
See the notation conventions section for an explanation of these usages, as well as other general comments about understanding the syntax of SOUL.
ADD
(**)ADD fieldname = {value | (expression)} ADD lob-name=BUFFER,position,length[RESERVE n [BYTES]]
ARRAY
ARRAY [arrayname] OCCURS {n | UNKNOWN} DEPENDING ON {itemname | %variable} [AFTER {itemname | arrayname} | AT {position | itemname | imagename1 | arrayname}]
Assert
Assert cond [, [Snap] [Info info] [Continue] ]
where cond is, like an If statement, the condition(s) being asserted as true. The statement options indicate how to respond to an assertion failure.
AUDIT
AUDIT print-specifications
Audit All Fieldgroup Information (AAFGI)
{AAFGI | Audit All Fieldgroup Information} [lob-option] [CtoFields]
AUDIT ALL INFORMATION
{AUDIT ALL INFORMATION | AAI} [CTOFIELDS]
BACKOUT
(C)BACKOUT
BYPASS
BYPASS [PENDING STATEMENT]
CALL
CALL {label | subname [([expression | %variable | [LIST] listname] [,...])]}
Change
Change fieldname [(subscript)] [= value |(expression)] To (newvalue |(expression))
Change lob-fieldname,position1,length To Buffer,position2,length[Reserve n [Bytes]]
CLEAR
Clear {[[All | Temp | ListFdst | Position] [Global]] Objects | Globals | Global {Image | Screen | Menu | List | Foundset | Position [Perm | Temp]} {'objectname' | %variable}}
CLEAR LIST
(*)CLEAR LIST listname
CLEAR ON
CLEAR ON {ATTENTION | ERROR | FIELD CONSTRAINT CONFLICT | FIND CONFLICT | RECORD LOCKING CONFLICT | MISSING FILE | MISSING MEMBER}
CLEAR TAG
CLEAR TAG {screenname | %screenname:inputname}
CLOSE
CLOSE {DATASET {ext-filename | %variable} | [EXTERNAL] {ext-filename | TERMINAL | %variable}}
CLOSE PROCESS
(+C)CLOSE PROCESS {cid | processname | %variable} [SYNCLEVEL | FLUSH | %variable] CLOSE PROCESS {cid | processname | %variable} [SYNCLEVEL | CONFIRM | FLUSH | ERROR | %variable]
Commit
Commit [Release]
Confirm
Confirm {cid | processname | %variable} REQSEND %variable
Confirmed
Confirmed {cid | processname | %variable}
CONTINUE
CONTINUE
COUNT OCCURRENCES OF
(**)COUNT OCCURRENCES OF fieldname
COUNT RECORDS
COUNT RECORDS {IN label | ON [LIST] listname}
DECLARE
[DECLARE] declaration
where declaration is one of the following:
- LABEL labelname [GLOBAL | COMMON]
- LIST listname [IN [FILE | [PERM | TEMP] GROUP]] name] [GLOBAL | COMMON]
- IMAGE imagename[AT {itemname | imagename1 | arrayname}
| GLOBAL [PERMANENT | TEMPORARY]
| [PERMANENT | TEMPORARY] GLOBAL | COMMON] - MENU menuname [GLOBAL [PERMANENT | TEMPORARY]
| [PERMANENT | TEMPORARY] GLOBAL | COMMON] - SCREEN screenname [GLOBAL [PERMANENT | TEMPORARY]
| [PERMANENT | TEMPORARY] GLOBAL | COMMON] - %variable [IS] {FIXED [DP n] | FLOAT} [ARRAY (d1 [,d2 [,d3]])]
[Initial(numeric-expression)] [STATIC] [COMMON] - %variable [IS] STRING [LEN n] [DP {n | *}] [ARRAY (d1 [,d2[,d3]])]
[NO FIELD SAVE] [COMMON]
[Initial('EBCDIC-string' | expression)] [STATIC] - SUBROUTINE subname [(type [INPUT | OUTPUT | INPUT OUTPUT] [,...])]
and where type is one of the following:
- Scalar %variable of the following format:
- {STRING [LEN] n [DP {n | *}] | [FIXED [DP n] | FLOAT]}
- Array %variable of the following format:
- {STRING [LEN n] [DP [n | *}] [ARRAY (* [,*[,*]]) [NO FIELD SAVE]]
| [FIXED [DP n] | FLOAT] [ARRAY (* [,*[,*]])]}
- {STRING [LEN n] [DP [n | *}] [ARRAY (* [,*[,*]]) [NO FIELD SAVE]]
- A list of records of the following format:
- [LIST] [IN {FILE | [PERM | TEMP] GROUP} name]
See also
DEFAULT CURSOR
DEFAULT CURSOR [READ | REREAD | PRINT] {ITEMID n | itemname | ROW n COLUMN m}
DEFAULT
DEFAULT {TITLE | PROMPT | INPUT [DEBLANK | NODEBLANK] [PAD WITH 'c'] [LEN m [DP [k | *}]] [UPCASE | NOCASE] | [TAG [attributes] [WITH 'c']} [[READ] attributes] [REREAD attributes] [PRINT attributes] DEFAULT SKIP n POSITIONS[S] [INITIAL {NULL | character | BLANK}] DEFAULT [TYPE] {STRING | BINARY | PACKED | ZONED | FLOAT | EFORMAT} {LEN {n | UNKNOWN} | BITS n | DIGITS n} [DP {k | *}] [BP n] [SIGNED | UNSIGNED] [PAD {BLANK | character | NULL}] [STRIP | NOSTRIP] [JUSTIFY {LEFT | RIGHT}] [INITIAL {BLANK | ZERO | NULL | literal}]
DELETE
(**)DELETE fieldname [(subscript)] [= value | (expression)]
(**)DELETE FIELDGROUP [fieldgroupname] [(subscript)] [= value | (expression)]
DELETE EACH
(**)DELETE EACH fieldname
DELETE RECORD
(**)DELETE RECORD
DELETE RECORDS
DELETE [ALL] RECORDS {IN label | ON [LIST] listname}
END BLOCK
END BLOCK label
End
END {FIND | IF | FOR | ON | REPEAT | STORE | SUBROUTINE} [label] END {ARRAY | IMAGE | MENU | SCREEN} End [MORE | NORUN | USE]...
END UPDATE
END UPDATE
External
External { Call callTerms | Delete deleteTerms | Load loadTerms | Module moduleTerms | Name nameTerms | Start startTerms | Stop stopTerms }
FILE RECORDS
FILE RECORDS {IN label | ON [LIST] listname} UNDER fieldname = {value | (expression)}
Find Records
(*){FIND [[ALL] RECORDS] | FD } [IN label | ON [LIST] listname] [FOR WHICH | WITH] retrieval-conditions
Find And Reserve
(*){FIND AND RESERVE [[ALL] RECORDS] | FDR} [IN label | ON [LIST] listname] [FOR WHICH | WITH] retrieval-conditions
Find Values Of (FDV)
label:[In { File filename | Group groupname } ]
{ Find [All] Values Of | FDV } fieldname
[From value1 | (expression1)] [To value2 | (expression2)]
[(Not) Like pattern]
[(Not) Value In value_set]
FIND AND PRINT COUNT
(*){FIND AND PRINT COUNT | FPC} [retrieval-conditions]
Find Without Locks
(*){Find Without Locks [[ALL] Records] | FDWOL} [In label | On [LIST] listname] [For Which | With] retrieval-conditions
FLUSH PROCESS
FLUSH PROCESS {cid | processname | %variable}
FOR EACH OCCURRENCE
(**)FOR {EACH | k} {OCCURRENCE | OCCURRENCES} OF fieldname
For Each Record
(*)FOR {EACH | k} {RECORD | RECORDS} [IN label | ON [LIST] listname] IN [ASCENDING | DESCENDING] [SORTKEY] ORDER [BY [EACH] fieldname] [FROM {value1 | (expression1)}] [TO {value2 | (expression2)}] [BY {%variable | literal}] [OPTIMIZING FNV] [{WHERE | WITH} retrieval-conditions
Note: For retrieval-conditions, see Retrieval condition syntax, below.
FOR EACH VALUE OF
(*)FOR {EACH | k} {VALUE | VALUES} OF fieldname [FROM {value1 | (expression1)}] [TO {value2 | (expression2)}] [[NOT] LIKE pattern] [IN [ASCENDING | DESCENDING] [CHARACTER | NUMERICAL] [RIGHT-ADJUSTED] ORDER]
FOR EACH VALUE IN
FOR {EACH | k} {VALUE | VALUES} IN label
FOR RECORD NUMBER
(*)FOR RECORD NUMBER {value | (expression)}
FOR RECORD NUMBER IN
FOR RECORD NUMBER {value | IN label} [OPTIMIZING FNV]
For %var From %exp1 To %exp2 By %exp3
For %variable From exp1
To exp2 [By exp3]
Note: The BY clause, when omitted, defaults to a value of 1.
IDENTIFY
IDENTIFY {[IMAGE] imagename | %imagename:itemname LEN {n | %variable} | %imagename:arrayname OCCURS {n | %variable}}
If...Then...ElseIf...Else
(C)IF expression THEN statements [ELSE statements | ELSEIF expression THEN statements]
IMAGE
[DECLARE] IMAGE imagename [GLOBAL [PERMANENT | TEMPORARY] | [PERMANENT | TEMPORARY] GLOBAL | COMMON [AT [itemname | imagename1 | arrayname}]]
INCLUDE
(*)INCLUDE procedurename
INPUT
INPUT inputname [AT [COLUMN] n] [TO [COLUMN] m | [LEN m] DP {k | *}]] [UPCASE | NOCASE] [DEFAULT 'value'] [DEBLANK | NODEBLANK] [PAD WITH 'c'] [REQUIRED | ALPHA | ALPHANUM | MUSTFILL | ONEOF literal [, literal]... | [NUMERIC] [RANGE lo [TO] hi [AND lo [TO] hi] ...] | VERIFY 'characters']... [[READ] attributes] [REREAD attributes] [PRINT attributes] [TAG [attributes] [WITH 'c']] [ITEMID n]
INSERT
INSERT fieldname [(subscript)] = {value | (expression)}
Invite
Invite {cid | processname | %variable}
[SYNCLEVEL | FLUSH | CONFIRM]
IS
itemname IS [TYPE] {STRING | BINARY | PACKED | ZONED | FLOAT | EFORMAT} {LEN {n | UNKNOWN} | BITS n | DIGITS n | TO position} [DP {k | *}] [BP n] [SIGNED | UNSIGNED] [PAD {BLANK | character | NULL}] [STRIP | NOSTRIP] [ALIGN] [JUSTIFY {LEFT | RIGHT}] [INITIAL {BLANK | ZERO | NULL | value}] [AFTER {itemname | arrayname} | AT {position | itemname | imagename1 | arrayname}] [OCCURS {n [DEPENDING ON {itemname | %variable}] | UNKNOWN}]
JUMP TO
JUMP TO label JUMP TO (label1 [, label2] ...) expression
Loop End
Loop End
Loop Next
Loop Next
MAX PFKEY
MAX PFKEY n
Menu
Menu block:
[Declare] Menu menuName [Global [Permanent | Temporary] | Common] menuLine menuLine ... End Menu
Menu statement, referring to a menu defined elsewhere in a Menu block:
[Declare] Menu menuName [Global [Permanent | Temporary] | Common]
MODIFY
MODIFY {%menuname:itemname | %screenname:itemname} [TO] attributes [[FOR] {ALL | READ | REREAD | TAB | PRINT}]
MODIFY BUFFER
MODIFY BUFFER [SIZE=n | %variable [PRESERVE | NOPRESERVE]] [FILL [X'nn'] | CLEAR]
NEW PAGE
(C)NEW PAGE
Note
(**)Note {fieldname [(subscript)]} Note 'string'
On
On {Attention | Error | Field Constraint Conflict | Find Conflict | Missing File | Missing Member | Record Locking Conflict} statements End On [label]
Open
Open { [Dataset | External] {ext-filename | %variable} | [External] {Terminal | %variable} } For {Input [Output] | Output [Input] | InOut} [Password {value | %variable}]
Open[C] [File | [Perm | Temp] Group]
{name [At {location | %variable | =}] | %variable}
[Password {value | %variable}]
OPEN PROCESS
OPEN PROCESS {processname | %variable} [CID {name | %variable}] (+)OPEN PROCESS {processname | %variable} [CID {name | %variable}] {outbound-options | inbound-options}
where outbound-options are:
- [AT DESTINATION] [WITH] [USERID {%variable | 'string'}]
- [PASSWORD {%variable | 'string'}]
- [{ACCOUNT | PROFILE {%%variable | 'string'}]
- [INITIAL {DATA 'string' | DATA %variable | IMAGE imagename] ...]
and inbound-options are:
- ACCEPT [INITIAL {DATA %variable | IMAGE image} ...]
Pause
Pause [n | %variable]
PLACE RECORD ON
(**)PLACE RECORD ON [LIST] listname
PLACE RECORDS
PLACE RECORDS {IN label | ON [LIST] listname1} ON [LIST] listname2
POSITION
POSITION {FOUNDSET foundsortset_name | LIST list_name} [AT] position_name
Note: Use this form of the POSITION statement with FOR loop processing; see POSITION statement.
POSITION {ext-filename | %variable} AT KEY operator{value | %variable}
Note: Use this form of the POSITION statement with external file processing using images; see POSITION statement.
PREPARE
PREPARE {[IMAGE] imagename | [MENU] menuname | [SCREEN] screenname}
Print printSpecifications
Print All Fieldgroup Information (PAFGI)
{PAFGI | Print All Fieldgroup Information} [lob-option] [CtoFields]
Print All Information or PAI
{PAI | Print All Information}
[Lob_Flod | Lob_Data | Lob_Short_Data | Lob_No_Data | Lob_None]
[CtoFields]
[Into array1, array2 [, array3] [From start] [Count ct] ]
PRINT MENU
PRINT [MENU] menuname [ALERT] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]
PRINT SCREEN
PRINT SCREEN screenname [ALERT] [[WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]
Query Process
Query Process {cid | processname | %variable} options
where options must be one or more of the following:
- STATE %variable
- PROCESSGROUP %variable
- REMOTEID %variable
- SYNCLEVEL %variable
- MODENAME %variable
Read Image
Read [Image] imagename From {ext-filename | Terminal | %variable} [Prompt {'text' | %variable}] [Next | Key operator {value | %variable}]
Read [Image] imagename From Buffer [Position={%pvariable | n}] [Maxlen={%lvariable | n}]
READ [MENU] menuname [ALERT] [TITLE ['text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]
READ screenname
READ [SCREEN] screenname [ALERT] [NO REREAD] [ [WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]
RECEIVE IMAGE
RECEIVE {IMAGE imagename | %variable} FROM {cid | processname | %variable} [RESULT %variable] (+)RECEIVE {IMAGE imagename | %variable} FROM {cid | processname | %variable} RESULT %variable
Release All Records
RELEASE POSITION
RELEASE POSITION {ext-filename | %variable}
Release Records
Release Records {In label | On [List] listname}
REMEMBER
(**)REMEMBER [GLOBAL] position_name [IN foundsortset_name | ON list_name]
REMOVE RECORD FROM
(**)REMOVE RECORD FROM [LIST] listname
REMOVE RECORDS
REMOVE RECORDS {IN label | ON [LIST] listname} FROM [LIST] listname2
REPEAT
REPEAT [FOREVER | n TIMES | WHILE expression]
REREAD
REREAD [SCREEN] screenname [ALERT] [[WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]
RESET
RESET {HEADER | TRAILER} m
RETRY
RETRY [PENDING STATEMENT]
RETURN
RETURN
Screen
Screen block:
[Declare] Screen screenName [Global [Permanent | Temporary] | Common] screenLine screenLine ... End Screen
Screen statement, referring to a screen defined earlier in a Screen block:
[Declare] Screen screenName Common
SEND
SEND {IMAGE imagename | 'string' | %variable} TO {cid | processname | %variable} [REQSEND %variable] [FLUSH] (+)SEND {IMAGE imagename | 'string' | %variable} TO {cid | processname | %variable} [FLUSH | CONFIRM] [REQSEND %variable]
Send Error
Send Error To {cid | processname | %variable}
Reqsend %variable
SET
SET {HEADER | TRAILER} m print-specifications
SetText
SetText %variable = string
SIGNAL PROCESS
SIGNAL PROCESS {cid | [processname | %variable} {nnn | %variable} (+)SIGNAL PROCESS {cid | [processname | %variable}
SKIP LINES
SKIP n LINE[S]
SKIP POSITIONS
[itemname IS] SKIP n POSITION[S] [INITIAL {NULL | character | BLANK}]
SORT RECORDS
SORT [k] RECORDS {IN label | ON [LIST] listname} BY key [AND key] ...
where key is:
- key = fieldname
[VALUE {[ASCENDING | DESCENDING]
[CHARACTER | NUMERICAL] | RIGHT-ADJUSTED]} ...]
SORT RECORD KEYS
SORT [k] RECORD KEYS {IN label | ON [LIST] listname} BY key [AND key] ...
where key is:
- key = fieldname
[VALUE {[ASCENDING | DESCENDING]
[CHARACTER | NUMERICAL] | [RIGHT-ADJUSTED]} ...]
SORT VALUE IN
SORT VALUE IN label [IN [ASCENDING | DESCENDING] [CHARACTER | NUMERICAL] | [RIGHT-ADJUSTED] ORDER]
STOP
STOP [IF COUNT IN label EXCEEDS n]
STORE RECORD
(*)STORE RECORD [sort or hash key value] fieldname1=[value1 | (expression1)] [fieldname2=(expression)] ... [THEN CONTINUE statement statement ...] END STORE
SUBROUTINE
SUBROUTINE SUBROUTINE subname [(formal-parameter [INPUT | OUTPUT | INPUT OUTPUT] [,...])]
where formal-parameter is one of the following:
- %variable [IS STRING [LEN n] [DP {n | *}] [ARRAY (*[,*[,*]]) [NO FS]]
| IS {FIXED [DP n] | FLOAT} [ARRAY (*[,*[,*]])]] - LIST listname [IN [FILE | [PERM | TEMP] GROUP] name]
TAG
TAG %screenname:inputname [attributes] [WITH 'c']
Test Receipt
Test [For]
{Any Receipt Return %variable
| Receipt {cid | processname | %variable}}
TITLE
TITLE {'text' | promptname} [AT [COLUMN] n] [TO [COLUMN] m | [LEN m] [DP {k | *}]] [DEFAULT 'value'] [[READ] attributes] [REREAD attributes] [PRINT attributes]
Trace
Note: The output of the Trace statement is controlled by the ULTRACE parameter.
TRANSFER
TRANSFER [CONTROL] TO PROCESS {processname | %variable} [WITH] [USERID {string | '%variable'}] [PASSWORD {variable | 'string'}] [ACCOUNT {%variable | 'string'}] [PASSING {IMAGE imagename | 'string' | %variable}]
UPDATE RECORD
UPDATE RECORD
VARIABLES ARE
VARIABLES ARE {FIXED [DP n] | FLOAT | STRING [LEN n] [DP {n | *}] | UNDEFINED}
Declare %variable
[DECLARE] %variable [IS] {FIXED [DP n] | FLOAT} [ARRAY (d1[,d2[,d3]])] [COMMON] [DECLARE] %variable [IS] STRING [LEN n] [DP {n | *}] [ARRAY (d1[,d2[d3]])] [NO FIELD SAVE] [COMMON] %variable [(subscript)] = expression
WAIT
(+)WAIT [{n | %variable} SEC[S]] [FOR] {ANY RECEIPT RETURN %variable | RECEIPT {cid | processname | %variable}}
WRITE
WRITE [IMAGE] imagename ON {seq-filename | TERMINAL | %variable}
WRITE IMAGE
WRITE IMAGE imagename ON BUFFER [POSITION=%pvariable | n] [MAXLEN={%lvariable | n}]
Other syntax
Names, numbers, literals, comments
- Names (for example, %variables, labels): see Model 204 naming conventions
- Other constructs: see Basic request structure (which also discusses some rules for statement labels)
Value specification syntax
For all User Language statements and retrieval conditions, wherever the term value appears in the syntax, it can be any of these:
- Literal number or string
- VALUE IN clause of the form:
VALUE [IN] label
- %variable
Retrieval condition syntax
A Find or For Each Record statement can be followed by any number of retrieval conditions separated by an end of line or LINEND parameter character.
Conditions can be constructed as follows:
Syntax
[Not] phrase [{And | Or | Nor} [Not] phrase] ...
Where:
phrase can be constructed as follows:
- fieldname = [Not] value
- fieldname Like pattern
- fieldname Is [Not] {Present | Like 'pattern'}
- fieldname Is [Not] {[Numerically | Alphabetically]
[Eq | = | Ne | ¬= | Greater Than | Gt | > | Less Than
| Lt | < | Le | <= | Ge | >= | Before | After] value} - fieldname Is [Not] {[Numerically | Alphabetically]
{In Range [From | After] value1 {To | [And] Before}
value2 | Between value1 And value2} - Files filename
- Find$ label
- List$ listname
- Location {location | =}
- Point$ value
- Sfge$ value
- Sfl$ value
where value can be:
- A literal number or string
- Value {[In] label} | (expression)
- A %variable
Notes:
- The first character (
¬
) of the "not-equal" test (¬=
) in the fourth of the items in the list above is the EBCDIC "not sign," which has the hexadecimal value5f
. - For a description of the pattern in the [Is] Like and Is Not clauses, see the syntax of Is Like patterns.
Omitting repeated first words
If a sequence of phrases in a particular retrieval condition all have the same first word, that word can be omitted from the latter phrases. For example:
LIST$ A AND NOT LIST$ B
can be written:
LIST$ A AND NOT B
And:
X IS 13 OR X IS LESS THAN 7
can be written:
X IS 13 OR IS LESS THAN 7
Omitting duplicated equal signs
Duplicated equal signs can be omitted. For example, the expression:
A = 3 OR A = 5 OR A = 40
is equivalent to:
A = 3 OR 5 OR 40
Use of parentheses
Parentheses can be placed around any sequence of phrases to clarify the condition or force the evaluation to occur in a particular order. For example:
NOT (A = 2 OR LIST$ Y) A = 1 AND (B = 2 OR C = 3)
Use of expressions
Expressions can be used in Find statements to provide the retrieval condition for the Point$, Sfl$, and Sfge$ conditions, as well as for the Eq Value clause:
Point$
Syntax
Point$ Value(expression)
Where:
expression is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression. It is preceded by the keyword Value.
Example
This example finds the first MA
record on file, and then counts the number of records from this point in the file:
FD1: IN ICSCUST FPC STATE = MA END FIND FOR 1 RECORD IN FD1 PRINT 'CURREC = ' WITH $CURREC PRINT '>= POINT$' FD2: IN ICSCUST FPC POINT$ VALUE($CURREC) END FIND END FOR
Sfl$ and Sfge$
Syntax
Sfl$ Value(expression)
or
Sfge$ Value(expression)
Where:
expression is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression. It is preceded by the keyword Value.
Example
FOR %CT FROM 1 TO 10 IN EXPRESS STORE RECORD ($EDITN(%CT,'999')) ORD1 = (%REC WITH %CT) ORD2 = (%CT * 2) ORD4 = (%CT * 4) END STORE END FOR COMMIT FOR %CT FROM 1 TO 5 PRINT 'LESS THAN ' WITH %CT FD1: IN EXPRESS FPC SFL$ VALUE($EDITN(%CT,'999')) END FIND PRINT 'GREATER THAN OR EQUAL TO ' WITH %CT FD2: IN EXPRESS FPC SFGE$ VALUE($EDITN(%CT,'999')) END FIND END FOR
Eq Value
Syntax
fieldname Eq Value(expression)
Where:
expression is a function call, string concatenation, arithmetic operation, SOUL construct, or Boolean expression.
Example
FD: IN FILE PEOPLE FD LAST EQ VALUE($READ('LAST NAME?') ) END FIND
Print specification syntax
A Print, Set, Audit, or Trace statement contains print specifications of the following form:
Syntax
[term] [And | Tab | With]...[[term] [And | Tab | With] ...] ... [...]
Where:
term can be constructed as follows:
{'string' | %variable | Count In label | Occurrence In label | Value in term | function} [At [Column] m] [To [Column] n]
or, if the statement is within a record loop:
{{Each | term} fieldname | *Record | *Id} [At [Column] m] [To [Column] n}
Note: For additional Print statement details regarding multiply occurring fields and field groups, see Print and Print n statements for fields.
Expression syntax
The following syntax can be used in:
- Assignment statements
- Conditional If statements and ElseIf clauses
In the simplified syntax for an If statement, which is:
If condition Then statements
condition expands to the syntax described in this section. Be sure to enclose an expression with parentheses.
- Computed Jump To statements
- Subscripts
- Function arguments
Syntax
{operand |(expression)} [operator {operand | (expression)}] ...
Where:
operand can be constructed as follows:
[+ | - | Not] {'string' | %variable | number | fieldname [(subscript)] Is [Not] Present | Count In label | Occurrence In label | Value In label | function}
and operator may be one of the following:
+ | = | EQ | And |
- | ¬= | NE | Or |
* | > | GT | With (Note: this can also be achieved via Implicit concatenation) |
/ | < | LT | Is [Not] Present (Note: applied either to a field or to an optional or default method parameter) |
>= | GE | Is [Not] Like | |
<= | LE | ||
Notes:
- The first character (
¬
) of the inequality test above is the EBCDIC "not sign," which has the hexadecimal value5f
.- For a description of the
Is Like
andIs Not
clauses, see the syntax of Is Like patterns.
In clause syntax
The SOUL statements on this page whose syntax display is preceded by an asterisk (*) support an In clause.
The three basic forms of the In clause are:
In [Permanent | Temporary ] Group groupname Member [%member | [filename [At {location | =}]]
In file1 [,file2] ...
In {$Curfile | $pdate}
The form In $Curfile can be used only within a record loop.
In Group Member limitations
In addition to the three basic forms of the In clause shown above, the In Group Member clause restricts the following statements to one member file in a group context:
- Clear List
- Find All Records (and its variants)
- Find All Values
- For Record Number (or FRN)
- Store Record
You cannot use an In Group Member clause with a For Each Record statement or with an Add, Change, or Delete Record statement. Only the previously listed statements call accept an In Group Member clause.
Using an In clause in a Begin...End block
The file name in the In clause used within a Begin...End block is resolved by the compiler. You can hard-code a file name or use some type of dummy string for the file name. Using a %variable for the file name is not allowed.
Subscript syntax
A subscript has the format:
Syntax
(subscript1 [,subscript2 [,subscript3]] )
Where:
subscript1, subscript2, and subscript3 can be any expression.
Terminal display attributes
One or more of the following terminal display attributes can replace the term attribute in a full-screen formatting statement, if the display attribute is supported by the installation:
BLINK |
BLUE |
BRIGHT |
DIM |
GREEN |
INV[IS[BLE]] |
NOBLINK |
NOREV[ERSE] |
NOU[NDER]SCORE |
PINK |
PROT[ECTED] |
RED |
REV[ERSE] |
TURQUOISE |
[UNDER]SCORE |
UNPROT[ECTED] |
VIS[IBLE] |
WHITE |
YELLOW |
Notation conventions
This page uses the following syntax notation conventions:
Syntax notation | Indicates that... |
---|---|
Single asterisk (*) | Statements can be preceded by an IN clause, if there is no reference to a previous set (label or list). See IN clause syntax for more discussion. |
Two asterisks (**) | Construct can appear only within a record loop. |
Plus sign (+) | Construct requires the optional Horizon feature. |
Two plus signs (++) | Construct requires the optional User Language to Database 2 feature. |
C | The syntax applies to a Model 204 command as well as a User Language statement, except any %variable options or clauses.
Model 204 commands are listed alphabetically and documented in List of Model 204 commands. |
Lowercase italic | Constructs are replaced with variable information. |
- A field name (%%) variable can be used anywhere fieldname appears. The %%variable can contain its own subscript, separate from the field name subscript.
Note: The subscript of an array element must be specified before a field name subscript.
- The lowercase constructs — retrieval-conditions, print-specifications, expression, subscript, attribute, and type — are discussed separately following the syntax summaries, beginning with Value specification syntax.
- For more Model 204 notation conventions, see Notation conventions.