Statement syntax: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 898: Line 898:
<hr>
<hr>
   
   
<p class="syntaxUL">TAG %screenname:inputname <span class="squareb">[</span>attributes<span class="squareb">]</span> <span class="squareb">[</span>WITH 'c'<span class="squareb">]</span>
<p class="syntaxUL">TAG <span class="term">%screenname</span>:<span class="term">inputname</span> <span class="squareb">[</span><span class="term">attributes</span><span class="squareb">]</span> <span class="squareb">[</span>WITH 'c'<span class="squareb">]</span>
</p>
</p>
   
   
Line 904: Line 904:
   
   
<p class="syntaxUL"><b><sup>(+)</sup></b>TEST [FOR]  
<p class="syntaxUL"><b><sup>(+)</sup></b>TEST [FOR]  
     <span class="squareb">{</span>ANY RECEIPT RETURN %variable  
     <span class="squareb">{</span>ANY RECEIPT RETURN <span class="term">%variable</span>
     <span class="squareb">|</span> RECEIPT <span class="squareb">{</span>cid <span class="squareb">|</span> processname <span class="squareb">|</span> %variable<span class="squareb">}</span><span class="squareb">}</span>
     <span class="squareb">|</span> RECEIPT <span class="squareb">{</span><span class="term">cid</span> <span class="squareb">|</span> <span class="term">processname</span> <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span><span class="squareb">}</span>
</p>
</p>
   
   
<hr>
<hr>
   
   
<p class="syntaxUL">TITLE <span class="squareb">{</span>'text' <span class="squareb">|</span> promptname<span class="squareb">}</span>  
<p class="syntaxUL">TITLE <span class="squareb">{</span>'<span class="term">text</span>' <span class="squareb">|</span> <span class="term">promptname</span><span class="squareb">}</span>  
  [AT [COLUMN] n] [TO [COLUMN] m <span class="squareb">|</span> [LEN m]  
  [AT [COLUMN] <span class="term">n</span>] [TO [COLUMN] <span class="term">m</span> <span class="squareb">|</span> [LEN <span class="term">m</span>]
  [DP <span class="squareb">{</span>k <span class="squareb">|</span> *<span class="squareb">}</span>]]  
  [DP <span class="squareb">{</span><span class="term">k</span> <span class="squareb">|</span> *<span class="squareb">}</span>]]  
  [DEFAULT 'value']  
  [DEFAULT '<span class="term">value</span>']  
  [[READ] attributes] [REREAD attributes] [PRINT attributes]
  [[READ] <span class="term">attributes</span>] [REREAD <span class="term">attributes</span>] [PRINT <span class="term">attributes</span>]  
</p>
</p>
   
   
<hr>
<hr>
   
   
<p class="syntaxUL">TRANSFER [CONTROL] TO PROCESS <span class="squareb">{</span>processname <span class="squareb">|</span> %variable<span class="squareb">}</span>  
<p class="syntaxUL">TRANSFER [CONTROL] TO PROCESS <span class="squareb">{</span><span class="term">processname</span> <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span>  
  [WITH] [USERID <span class="squareb">{</span>%variable <span class="squareb">|</span> 'string'<span class="squareb">}</span>]  
  [WITH] [USERID <span class="squareb">{</span><span class="term">string</span> <span class="squareb">|</span> '<span class="term">%variable</span>'<span class="squareb">}</span>]  
  [PASSWORD <span class="squareb">{</span>variable <span class="squareb">|</span> 'string'<span class="squareb">}</span>]  
  [PASSWORD <span class="squareb">{</span><span class="term">variable</span> <span class="squareb">|</span> '<span class="term">string</span>'<span class="squareb">}</span>]  
  [ACCOUNT <span class="squareb">{</span>%variable <span class="squareb">|</span> 'string'<span class="squareb">}</span>]  
  [ACCOUNT <span class="squareb">{</span><span class="term">%variable</span> <span class="squareb">|</span> '<span class="term">string</span>'<span class="squareb">}</span>]  
  [PASSING <span class="squareb">{</span>IMAGE imagename <span class="squareb">|</span> 'string' <span class="squareb">|</span> %variable<span class="squareb">}</span>]
  [PASSING <span class="squareb">{</span>IMAGE <span class="term">imagename</span> <span class="squareb">|</span> '<span class="term">string</span>' <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span>]
</p>
</p>


Line 933: Line 933:
   
   
<p class="syntaxUL">VARIABLES ARE  
<p class="syntaxUL">VARIABLES ARE  
  <span class="squareb">{</span>FIXED [DP n] <span class="squareb">|</span> FLOAT  
  <span class="squareb">{</span>FIXED [DP <span class="term">n</span>] <span class="squareb">|</span> FLOAT  
  <span class="squareb">|</span> STRING [LEN n] [DP <span class="squareb">{</span>n <span class="squareb">|</span> *<span class="squareb">}</span>]  
  <span class="squareb">|</span> STRING [LEN <span class="term">n</span>] [DP <span class="squareb">{</span><span class="term">n</span> <span class="squareb">|</span> *<span class="squareb">}</span>]  
  <span class="squareb">|</span> UNDEFINED<span class="squareb">}</span>  
  <span class="squareb">|</span> UNDEFINED<span class="squareb">}</span>  
</p>
</p>
Line 940: Line 940:
<hr>
<hr>
   
   
<p class="syntaxUL">[DECLARE] %variable [IS]  
<p class="syntaxUL">[DECLARE] <span class="term">%variable</span> [IS]  
  <span class="squareb">{</span>FIXED [DP n] <span class="squareb">|</span> FLOAT<span class="squareb">}</span> [ARRAY (d1[,d2[,d3]])]  
  <span class="squareb">{</span>FIXED [DP <span class="term">n</span>] <span class="squareb">|</span> FLOAT<span class="squareb">}</span> [ARRAY (<span class="term">d1</span>[,<span class="term">d2</span>[,<span class="term">d3</span>]])]  
  [COMMON]
  [COMMON]
</p>
</p>
Line 947: Line 947:
<hr>
<hr>
   
   
<p class="syntaxUL">[DECLARE] %variable [IS]  
<p class="syntaxUL">[DECLARE] <span class="term">%variable</span> [IS]  
  STRING [LEN n] [DP <span class="squareb">{</span>n <span class="squareb">|</span> *<span class="squareb">}</span>] [ARRAY (d1[,d2[d3]])]  
  STRING [LEN <span class="term">n</span>] [DP <span class="squareb">{</span><span class="term">n</span> <span class="squareb">|</span> *<span class="squareb">}</span>] [ARRAY (<span class="term">d1</span>[,<span class="term">d2</span>[<span class="term">d3</span>]])]  
  [NO FIELD SAVE] [COMMON]  
  [NO FIELD SAVE] [COMMON]  
  %variable [(subscript)] = expression
  <span class="term">%variable</span> [(<span class="term">subscript</span>)] = <span class="term">expression</span>
</p>
</p>
   
   
<hr>
<hr>
   
   
<p class="syntaxUL"><b><sup>(+)</sup></b>WAIT [<span class="squareb">{</span>n <span class="squareb">|</span> %variable<span class="squareb">}</span> SEC[S]] [FOR]  
<p class="syntaxUL"><b><sup>(+)</sup></b>WAIT [<span class="squareb">{</span><span class="term">n</span> <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span> SEC[S]] [FOR]  
     <span class="squareb">{</span>ANY RECEIPT RETURN %variable  
     <span class="squareb">{</span>ANY RECEIPT RETURN <span class="term">%variable</span>
     <span class="squareb">|</span> RECEIPT <span class="squareb">{</span>cid <span class="squareb">|</span> processname <span class="squareb">|</span> %variable<span class="squareb">}</span><span class="squareb">}</span>
     <span class="squareb">|</span> RECEIPT <span class="squareb">{</span><span class="term">cid</span> <span class="squareb">|</span> <span class="term">processname</span> <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span><span class="squareb">}</span>
</p>
</p>
   
   
<hr>
<hr>
   
   
<p class="syntaxUL">WRITE [IMAGE] imagename  
<p class="syntaxUL">WRITE [IMAGE] <span class="term">imagename</span>
  ON <span class="squareb">{</span>seq-filename <span class="squareb">|</span> TERMINAL <span class="squareb">|</span> %variable<span class="squareb">}</span>
  ON <span class="squareb">{</span><span class="term">seq-filename</span> <span class="squareb">|</span> TERMINAL <span class="squareb">|</span> <span class="term">%variable</span><span class="squareb">}</span>
</p>
</p>
   
   
<hr>
<hr>
   
   
<p class="syntaxUL">WRITE IMAGE imagename ON BUFFER  
<p class="syntaxUL">WRITE IMAGE <span class="term">imagename</span> ON BUFFER  
   [POSITION=%pvariable <span class="squareb">|</span> n] [MAXLEN=<span class="squareb">{</span>%lvariable <span class="squareb">|</span> n<span class="squareb">}</span>]
   [POSITION=<span class="term">%pvariable</span> <span class="squareb">|</span> <span class="term">n</span>] [MAXLEN=<span class="squareb">{</span><span class="term">%lvariable</span> <span class="squareb">|</span> <span class="term">n</span><span class="squareb">}</span>]
</p>
</p>


<hr>
==Value specification syntax==
<p>
For all User Language statements and retrieval conditions, wherever the term <var class="term">value</var> appears in the syntax, it can be any of these:</p>
<ul>
<li>Literal number or string </li>
<li><var>VALUE IN</var> clause of the form:
<p class="syntax">VALUE <span class="squareb">[</span>IN<span class="squareb">]</span> <span class="term">label</span>
</p>
</li>
<li>%variable</li>
</ul>
==Retrieval condition syntax==
<p>
A <var>FIND</var> statement can be followed by any number of retrieval conditions separated by an end of line or [[LINEND parameter]] character.</p>
<p>
Conditions can be constructed as follows:      </p>
====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>
Where:
<p>
<var class="term">phrase</var> can be constructed as follows:</p>
<ul style="font-family: Consolas,monospace">
<li>fieldname = <span class="squareb">[</span>NOT<span class="squareb">]</span> value
<li>fieldname LIKE pattern
<li>fieldname IS [NOT] <span class="squareb">{</span>PRESENT <span class="squareb">|</span> LIKE 'pattern'<span class="squareb">}</span>
<li>fieldname 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> > <br>
<span class="squareb">|</span> LESS THAN <span class="squareb">|</span> LT < <span class="squareb">|</span> <= <span class="squareb">|</span> GE <span class="squareb">|</span> >= <span class="squareb">|</span> BEFORE <span class="squareb">|</span> AFTER] value<span class="squareb">}</span>
<li>fieldname IS [NOT] <span class="squareb">{</span>[NUMERICALLY <span class="squareb">|</span> ALPHABETICALLY] <br>
<span class="squareb">{</span>IN RANGE [FROM <span class="squareb">|</span> AFTER] value1 <span class="squareb">{</span>TO <span class="squareb">|</span> [AND] BEFORE<span class="squareb">}</span> <br>
value2 <span class="squareb">|</span> BETWEEN value1 AND value2<span class="squareb">}</span>
<li>FILES filename
<li>FIND$ label
<li>LISTS$ listname
<li>LOCATION <span class="squareb">{</span>location <span class="squareb">|</span> =<span class="squareb">}</span>
<li>POINT$ value
<li>SFGE$ value
<li>SFL$ value
<p>
where <i>value</i> can be:</p>
<ul>
<li>A literal number or string</li>
<li>VALUE <span class="squareb">{</span>[IN] <i>label</i><span class="squareb">}</span> <span class="squareb">|</span> (<i>expression</i>)</li>
<li>A %variable </li>
</ul>
</ul>
<p><b>Notes:</b></p>
<ul>
<li>The first character (<code>,</code>) of the inequality 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 <code>[IS] LIKE</code> and <code>IS NOT</code> clauses, see the syntax of [[Is Like pattern matching#likeSyntax|Is Like patterns]].
</ul>
===Omitting repeated first words===
<p>
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:</p>
<p class="code">LIST$ A AND NOT LIST$ B
</p>
<p>
can be written:</p>
<p class="code">LIST$ A AND NOT B
</p>
<p>
And:</p>
<p class="code">X IS 13 OR X IS LESS THAN 7
</p>
<p>
can be written:</p>
<p class="code">X IS 13 OR IS LESS THAN 7
</p>
===Omitting duplicated equal signs===
<p>
Duplicated equal signs can be omitted. For example, the expression:</p>
<p class="code">A = 3 OR A = 5 OR A = 40
</p>
<p>
is equivalent to:</p>
<p class="code">A = 3 OR 5 OR 40
</p>
===Use of parentheses===
<p>
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:</p>
<p class="code">NOT (A = 2 OR LIST$ Y)
A = 1 AND (B = 2 OR C = 3)
</p>
===Use of expressions===
<p>
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=====
<p class="syntax">POINT$ VALUE(<span class="term">expression</span>)
</p>
Where:
<p>
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, User Language construct, or Boolean expression. It is preceded by the keyword <var>VALUE</var>.</p>
=====Example=====
<p>
This example finds the first <code>MA</code> record on file, and then counts the number of records from this point in the file:</p>
<p class="code">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
</p>
====SFL$ and SFGE$====
=====Syntax=====
<p class="syntax">SFL$ VALUE(<span class="term">expression</span>)
</p>
<p>
or</p>
<p class="syntax">SFGE$ VALUE(<span calss="term">expression</span>)
</p>
Where:
<p>
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, User Language construct, or Boolean expression. It is preceded by the keyword <var>VALUE</var>.</p>
=====Example=====
<p class="code">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
</p>
====EQ VALUE====
=====Syntax=====
<p class="syntax"><span class="term">fieldname</span> EQ VALUE(<span class="term">expression</span>)
</p>
Where:
<p>
<var class="term">expression</var> is a function call, string concatenation, arithmetic operation, User Language construct, or Boolean expression.</p>
=====Example=====
<p class="code">FD: IN FILE PEOPLE FD
LAST EQ VALUE($READ('LAST NAME?') )
END FIND
</p>
==Print specification syntax==
<p>
A  PRINT, SET or AUDIT statement contains print specifications of the following form:</p>
====Syntax====
<p class="syntax">[term] <span class="squareb">{</span>AND <span class="squareb">|</span> TAB <span class="squareb">|</span> WITH]...[[term]
[AND <span class="squareb">|</span> TAB <span class="squareb">|</span> WITH] ...] ... [...]
</p>
Where:
<p>
term can be constructed as follows:</p>
<p class="syntax"><span class="squareb">{</span>'string' <span class="squareb">|</span> %variable <span class="squareb">|</span> COUNT IN label
<span class="squareb">|</span> OCCURRENCE IN label
<span class="squareb">|</span> VALUE IN label <span class="squareb">|</span> function<span class="squareb">}</span>
<span class="squareb">[</span>AT <span class="squareb">[</span>COLUMN<span class="squareb">]</span> m<span class="squareb">]</span> <span class="squareb">[</span>TO <span class="squareb">[</span>COLUMN<span class="squareb">]</span> n<span class="squareb">]</span>
</p>
<p>
or, if the statement is within a record loop:</p>
<p class="syntax"><span class="squareb">{</span><span class="squareb">{</span>EACH <span class="squareb">|</span> n<span class="squareb">}</span> fieldname <span class="squareb">|</span> *RECORD <span class="squareb">|</span> *ID<span class="squareb">}</span>
[AT [COLUMN] m] [TO [COLUMN] n<span class="squareb">}</span>
</p>
==Expression syntax==
<p>
The following syntax can be used in: </p>
<ul>
<li>Assignment statements </li>
<li>Conditional IF statements and ELSEIF clauses</li>
</ul>
<p>
In the simplified syntax for an IF statement, which is:</p>
<p class="syntax">IF condition THEN statements
</p>
<p>
condition expands to the syntax described in this section. Be sure to enclose an expression with parentheses. </p>
<ul>
<li>Computed JUMP TO statements </li>
<li>Subscripts </li>
<li>Function arguments      </li>
</ul>
====Syntax====
<p class="syntax"><span class="squareb">{</span>operand |(expression)<span class="squareb">}</span>
[operator <span class="squareb">{</span>operand <span class="squareb">|</span> (expression)<span class="squareb">}</span>] ...
</p>
Where:
<p>
operand can be constructed as follows:</p>
<p class="syntax">[+ <span class="squareb">|</span> - <span class="squareb">|</span> NOT]
<span class="squareb">{</span>'string' <span class="squareb">|</span> %variable <span class="squareb">|</span> number
<span class="squareb">|</span> fieldname <span class="squareb">[</span>(subscript)<span class="squareb">]</span> IS <span class="squareb">[</span>NOT<span class="squareb">]</span> PRESENT
<span class="squareb">|</span> COUNT IN label <span class="squareb">|</span> OCCURRENCE IN label
<span class="squareb">|</span> VALUE IN label
<span class="squareb">|</span> function<span class="squareb">}</span>
</p>
<p>
and operator may be one of the following:</p>
<table>
<tr>
<td>+</td>
<td>=</td>
<td>EQ</td>
<td>AND</td>
</tr>
<tr>
<td align="right">-</td>
<td>,=</td>
<td>NE</td>
<td>OR</td>
</tr>
<tr>
<td>*</td>
<td>></td>
<td>GT</td>
<td>WITH</td>
</tr>
<tr>
<td>/</td>
<td><</td>
<td>LT</td>
<td>IS PRESENT</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>>=</td>
<td>GE</td>
<td>IS NOT PRESENT</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><=</td>
<td>LE</td>
<td>IS LIKE</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>IS NOT LIKE</td>
</tr>
</table>
<p>
</p>
<blockquote class="note"><b>Notes:</b>
<ul>
<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>IS LIKE</code> and <code>IS NOT</code> clauses, see the syntax of [[Is Like pattern matching|Is Like patterns]].
</ul>
</blockquote >
==IN clause syntax==
<p>
Statements preceded by an asterisk (*), beginning with [[#User Language statements|User Language statements]], support the IN clause. </p>
<p>
The three basic forms of the IN clause are:        </p>
====Syntax====
<ul>
<li><var>IN [PERMANENT <span class="squareb">|</span> TEMPORARY ] GROUP groupname
MEMBER [%member <span class="squareb">|</span> [filename [AT <span class="squareb">{</span>location <span class="squareb">|</span> =<span class="squareb">}</span>]]</var></li>
</li>
<li><var>IN file1 [,file2] ...</var></li>
</li>
<li><var>IN <span class="squareb">{</span>$CURFILE <span class="squareb">|</span> $UPDATE<span class="squareb">}</span></var></li>
<p>
The form IN $CURFILE can be used only within a record loop.    </p>
</li>
</ul>
===IN GROUP MEMBER limitations===
<p>
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:</p>
<ul>
<li>CLEAR LIST</li>
</li>
<li>FIND ALL RECORDS (and its variants)</li>
</li>
<li>FIND ALL VALUES</li>
</li>
<li>FOR RECORD NUMBER (or FRN)</li>
</li>
<li>STORE RECORD</li>
</li>
</ul>
<p>
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.</p>
===Using an IN clause in a BEGIN...END block===
<p>
The file name in the IN clause used within a BEGIN...END block is resolved by the compiler. You can either hard code a file name or use some type of dummy string for the file name. The use of a %variable for the file name is not allowed.</p>
==Subscript syntax==
<p>
A subscript has the format:    </p>
====Syntax====
<p class="syntax">(<span class="term">subscript1</span> [,<span class="term">subscript2</span> [,<span class="term">subscript3</span>]] )
</p>
Where:
<p>
<var class="term">subscript1</var>, <var class="term">subscript2</var>, and <var class="term">subscript3</var> can be any expression. </p>
==Terminal display attributes==
<p>
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:</p>
<table>
<caption>List of attributes</caption>
<tr>
<td>BLINK</td>
</tr>
<tr>
<td>BLUE</td>
</tr>
<tr>
<td>BRIGHT</td>
</tr>
<tr>
<td>DIM</td>
</tr>
<tr>
<td>GREEN</td>
</tr>
<tr>
<td>INV[IS[BLE]] </td>
</tr>
<tr>
<td>NOBLINK</td>
</tr>
<tr>
<td>NOREV[ERSE]</td>
</tr>
<tr>
<td>NOU[NDER]SCORE</td>
</tr>
<tr>
<td>PINK</td>
</tr>
<tr>
<td>PROT[ECTED]</td>
</tr>
<tr>
<td>RED</td>
</tr>
<tr>
<td>REV[ERSE]</td>
</tr>
<tr>
<td>TURQUOISE</td>
</tr>
<tr>
<td>[UNDER]SCORE</td>
</tr>
<tr>
<td>UNPROT[ECTED]</td>
</tr>
<tr>
<td>VIS[IBLE]</td>
</tr>
<tr>
<td>WHITE</td>
</tr>
<tr>
<td>YELLOW </td>
</tr>
</table>
==Type syntax for the DECLARE SUBROUTINE statement==
<p>
The type specification for the DECLARE SUBROUTINE statement has one of the following formats:</p>
<p class="syntax"><span class="squareb">{</span>STRING [LEN <span class="term">n</span>] [DP <span class="squareb">{</span><span class="term">n</span> <span class="squareb">|</span> *<span class="squareb">}</span>] [ARRAY (*[,*[,*]]) [NO FILE SAVE]]
<span class="squareb">|</span> FIXED [DP <span class="term">n</span>] [ARRAY (*[,*[,*]])]
<span class="squareb">|</span> FLOAT<span class="squareb">}</span>
</p>
<p>
or</p>
<p class="syntax">[LIST] [IN [FILE <span class="squareb">|</span> [PERM <span class="squareb">|</span> TEMP] GROUP] <span class="term">name</span>]
</p>
   
   
[[Category:SOUL]]
[[Category:SOUL]]

Revision as of 03:24, 11 January 2014

Overview

This topic summarizes User Language syntax and conventions, many of which are also discussed throughout this manual.

The statements are listed in alphabetical order. Later sections in this topic provide other User Language syntax information.

All of the User Language statements listed can be used between a BEGIN (or MORE) command and an END (or END MORE) statement.

All system control commands are presented in the List of Model 204 commands.

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.

User Language statements

(**)ADD fieldname = {value | (expression)} ADD lob-name=BUFFER,position,length[RESERVE n [BYTES]]


ARRAY [arrayname] OCCURS {n | UNKNOWN} DEPENDING ON {itemname | %variable} [AFTER {itemname | arrayname} | AT {position | itemname | imagename1 | arrayname}]


AUDIT print-specifications


AUDIT ALL FIELDGROUP INFORMATION [CTOFIELDS]


{AUDIT ALL INFORMATION | AAI}


(C)BACKOUT


BYPASS [PENDING STATEMENT]


CALL {label | subname [([expression | %variable | [LIST] listname] [,...])]}


(**)CHANGE fieldname [(subscript)] [= value1 | (expression)] TO (value2 | (expression)) CHANGE lob-fieldname,position1,length TO BUFFER,position2,length[RESERVE n [BYTES]]


CLEAR {[[ALL | TEMP | LISTFDST | POSITION] [GLOBAL]] OBJECTS | GLOBALS | GLOBAL {IMAGE | SCREEN | MENU | LIST | FOUNDSET | POSITION [PERM | TEMP]} {'objectname' | %variable}}


(*)CLEAR LIST listname


CLEAR ON {ATTENTION | ERROR | FIELD CONSTRAINT CONFLICT | FIND CONFLICT | RECORD LOCKING CONFLICT | MISSING FILE | MISSING MEMBER}


CLEAR TAG {screenname | %screenname:inputname}


CLOSE {DATASET {ext-filename | %variable} | [EXTERNAL] {ext-filename | TERMINAL | %variable}}


(+C)CLOSE PROCESS {cid | processname | %variable} [SYNCLEVEL | FLUSH | %variable]


CLOSE PROCESS {cid | processname | %variable} [SYNCLEVEL | CONFIRM | FLUSH | ERROR | %variable]


COMMIT [RELEASE]


(+)CONFIRM {cid | processname | %variable} REQSEND %variable


(+)CONFIRMED {cid | processname | %variable}


CONTINUE


(**)COUNT OCCURRENCES OF fieldname


COUNT RECORDS {IN label | ON [LIST] listname}


[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] [,...])]

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 (* [,*[,*]])]}
  • A list of records of the following format:
    • [LIST] [IN {FILE | [PERM | TEMP] GROUP} name]

DEFAULT CURSOR [READ | REREAD | PRINT] {ITEMID n | itemname | ROW n COLUMN m}


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 fieldname [(subscript)] [= value |(expression)]


(**)DELETE EACH fieldname


(**)DELETE RECORD


DELETE [ALL] RECORDS {IN label | ON [LIST] listname}


END BLOCK label


END {FIND | IF | FOR | ON | REPEAT | STORE | SUBROUTINE} [label]


END {ARRAY | IMAGE | MENU | SCREEN}


END [MORE | NORUN | USE]...


END UPDATE


FILE RECORDS {IN label | ON [LIST] listname} UNDER fieldname = {value | (expression)}


(*)FIND [AND RESERVE] [ALL] RECORDS [IN label | ON [LIST] listname] [FOR WHICH | WITH] retrieval-conditions


(*)FIND [ALL] VALUES OF fieldname [FROM {value1 | (expression1)}] [TO {value2 | (expression2)}] [[NOT] LIKE 'pattern']


(*)FIND AND PRINT COUNT [retrieval-conditions]


(*){FIND WITHOUT LOCKS | FDWOL} [ALL] RECORDS [IN label | ON [LIST] listname] [FOR WHICH | WITH] retrieval-conditions


FLUSH PROCESS {cid | processname | %variable}


(**)FOR {EACH | k} {OCCURRENCE | OCCURRENCES} OF fieldname


(*)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]


(*)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 | k} {VALUE | VALUES} IN label


(*)FOR RECORD NUMBER {value | (expression)}


FOR RECORD NUMBER {value | IN label} [OPTIMIZING FNV]


FOR %variable FROM expression1 {TO expression2 [BY expression3] | [BY expression3] TO expression2}

Note: The BY clause, when omitted, defaults to a value of 1.


IDENTIFY {[IMAGE] imagename | %imagename:itemname LEN {n | %variable} | %imagename:arrayname OCCURS {n | %variable}}


(C)IF expression THEN statements [ELSE statements | ELSEIF expression THEN statements]


[DECLARE] IMAGE imagename [GLOBAL [PERMANENT | TEMPORARY] | [PERMANENT | TEMPORARY] GLOBAL | COMMON [AT [itemname | imagename1 | arrayname}]]


(*)INCLUDE procedurename


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 fieldname [(subscript)] = {value | (expression)}


(+)INVITE {cid | processname | %variable} [SYNCLEVEL | FLUSH | CONFIRM]


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 label


JUMP TO (label1 [, label2] ...) expression


LOOP END


MAX PFKEY n


[DECLARE] MENU menuname [GLOBAL [PERMANENT | TEMPORARY] | [PERMANENT | TEMPORARY] GLOBAL | COMMON]


MODIFY {%menuname:itemname | %screenname:itemname} [TO] attributes [[FOR] {ALL | READ | REREAD | TAB | PRINT}]


MODIFY BUFFER [SIZE=n | %variable [PRESERVE | NOPRESERVE]] [FILL [X'nn'] | CLEAR]


(C)NEW PAGE


(**)NOTE {fieldname [(subscript)]}


NOTE 'string'


ON {ATTENTION | ERROR | FIELD CONSTRAINT CONFLICT | FIND CONFLICT | MISSING FILE | MISSING MEMBER | RECORD LOCKING CONFLICT} statements


OPEN {[DATASET | EXTERNAL] {ext-filename | %variable} | [EXTERNAL] {TERMINAL | %variable}} FOR {INPUT [OUTPUT] | OUTPUT [INPUT] | INOUT} [PASSWORD {value | %variable}]


(C)OPEN [C] [[PERM | TEMP] GROUP | FILE] {name [AT {location | %variable | =}] | %variable} [PASSWORD {value | %variable}]


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 [n | %variable]


(**)PLACE RECORD ON [LIST] listname


PLACE RECORDS {IN label | ON [LIST] listname1} ON [LIST] listname2


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 {[IMAGE] imagename | [MENU] menuname | [SCREEN] screenname}


PRINT print-specifications


(**){PAI | PRINT ALL INFORMATION} INTO array1, array2 [, array3] [FROM start] [COUNT ct]


PRINT [MENU] menuname [ALERT] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]


PRINT SCREEN screenname [ALERT] [[WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]


PROMPT {'text' | promptname} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [DP {k | *}]] [DEFAULT 'value'] [[READ] attributes] [REREAD attributes] [PRINT attributes] [ITEMID n]


(+)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] 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 [SCREEN] screenname [ALERT] [NO REREAD] [ [WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]


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 {ext-filename | %variable}


RELEASE RECORDS {IN label | ON [LIST] listname}


(**)REMEMBER [GLOBAL] position_name [IN foundsortset_name | ON list_name]


(**)REMOVE RECORD FROM [LIST] listname


REMOVE RECORDS {IN label | ON [LIST] listname} FROM [LIST] listname2


REPEAT [FOREVER | n TIMES | WHILE expression]


REREAD [SCREEN] screenname [ALERT] [[WITH] CURSOR] [TITLE {'text' | %variable} [AT [COLUMN] n] [TO [COLUMN] m | LEN m] [attributes]]


RESET {HEADER | TRAILER} m


RETRY [PENDING STATEMENT]


RETURN


[DECLARE] SCREEN screenname [GLOBAL [PERMANENT | TEMPORARY] | [PERMANENT | TEMPORARY] GLOBAL | COMMON]


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 TO {cid | processname | %variable} REQSEND %variable


SET {HEADER | TRAILER} m print-specifications


SIGNAL PROCESS {cid | [processname | %variable} {nnn | %variable}


(+)SIGNAL PROCESS {cid | [processname | %variable}


SKIP n LINE[S]


[itemname IS] SKIP n POSITION[S] [INITIAL {NULL | character | BLANK}]


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 [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 label [IN [ASCENDING | DESCENDING] [CHARACTER | NUMERICAL] | [RIGHT-ADJUSTED] ORDER]


STOP [IF COUNT IN label EXCEEDS n]


(*)STORE RECORD [sort or hash key value] fieldname1=[value1 | (expression1)] [fieldname2=(expression)] ... [THEN CONTINUE statement statement ...] END STORE


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 %screenname:inputname [attributes] [WITH 'c']


(+)TEST [FOR] {ANY RECEIPT RETURN %variable | RECEIPT {cid | processname | %variable}}


TITLE {'text' | promptname} [AT [COLUMN] n] [TO [COLUMN] m | [LEN m] [DP {k | *}]] [DEFAULT 'value'] [[READ] attributes] [REREAD attributes] [PRINT attributes]


TRANSFER [CONTROL] TO PROCESS {processname | %variable} [WITH] [USERID {string | '%variable'}] [PASSWORD {variable | 'string'}] [ACCOUNT {%variable | 'string'}] [PASSING {IMAGE imagename | 'string' | %variable}]


UPDATE RECORD


VARIABLES ARE {FIXED [DP n] | FLOAT | STRING [LEN n] [DP {n | *}] | UNDEFINED}


[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 [{n | %variable} SEC[S]] [FOR] {ANY RECEIPT RETURN %variable | RECEIPT {cid | processname | %variable}}


WRITE [IMAGE] imagename ON {seq-filename | TERMINAL | %variable}


WRITE IMAGE imagename ON BUFFER [POSITION=%pvariable | n] [MAXLEN={%lvariable | n}]