Programmer Guide/Command Reference: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{STX|caps}} {{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
The Command Reference documents all the commands available in the {{STX}} macro language. This is with the notable exception of the {{Stx}} shell item commands, which are documented in the chapter [[Programmer_Guide/Shell_Items|Shell Items]].
The {{STx}} command reference documents all the commands available in the {{STX}} macro language. This is with the notable exception of the {{Stx}} shell item commands, which are documented in the chapter [[Programmer_Guide/Shell_Items|Shell Items]].


Each {{STx}} command generates a result value (the return value of the command) and a completion code, the latter indicating success or failure of the command. The completion code is stored in the shell variables <var>RC</var> (a numerical error or warning code, 0 indicating success) and <var>EMSG</var> (textual error message according to value of <var>RC</var>).  
Each {{STx}} command generates both a ''result value'' (the return value of the command) and a ''completion code'', the latter indicating success or failure of the command. The completion code is stored in the shell variables <var>RC</var>. This is either 0, indicating success, or a numerical error or warning code. The shell variable <var>EMSG</var> will contain a textual error message according to value of <var>RC</var>.


;Notes:
;Notes:
:* You should make it a habit to always end the list of options with the [[Programmer_Guide/Command_Reference_Options/-|"end of options" option, <code>/-</code>]] (q.v.) because, otherwise, you will get into trouble when command arguments start with a slash.
:* You should make it a habit to always end the list of options with the [[Programmer_Guide/Command_Reference_Options/-|"end of options" option, <code>/-</code>]] (q.v.) because, otherwise, you will get into trouble when command arguments start with a slash.
:*Most commands overwrite the variables <var>RC</var> and <var>EMSG</var>. There are a few commands, though, which touch <var>RC</var> and <var>EMSG</var> only if an execution error occours. The most prominent commands in the latter group are [[/IF|IF]] and [[/GOTO|GOTO]] and, actually, most other control commands.
:*Most commands overwrite the variables <var>RC</var> and <var>EMSG</var>. There are a few commands, though, which touch <var>RC</var> and <var>EMSG</var> only if an execution error occours. The most prominent commands in the latter group are [[/IF|IF]] and [[/GOTO|GOTO]] and, actually, most other control commands.
:* Some commands return the completion code also as their return value.
:* Some commands return the completion code also as their result value.
:* In contrast to commands, ''macros'' store their return value (generated with the [[/EXIT|EXIT]] command) in the variable <var>RESULT</var>, meaning that macro calls do not affect the variables <var>RC</var> and <var>EMSG</var>.
:* In contrast to commands, ''macros'' store their return value (generated with the [[/EXIT|EXIT]] command) in the variable <var>RESULT</var>, meaning that macro calls do not affect the variables <var>RC</var> and <var>EMSG</var>, unless they use commands!


;See also: [[Programmer_Guide/Introduction|Introduction]], [[Programmer_Guide/Shell_Items|shell items]]
;See also: [[Programmer_Guide/Introduction|Introduction]], [[Programmer_Guide/Shell_Items|shell items]]
Line 23: Line 23:


== Common {{STX}} options ==
== Common {{STX}} options ==
<splist
 
parent=Programmer_Guide/Command_Reference_Options
{{Programmer_Guide/Command_Reference_Options}}
sort=asc
sortby=title
showpath=no
liststyle=unordered
kidsonly=yes
></splist>

Latest revision as of 15:23, 14 August 2019

The STx command reference documents all the commands available in the STx macro language. This is with the notable exception of the STx shell item commands, which are documented in the chapter Shell Items.

Each STx command generates both a result value (the return value of the command) and a completion code, the latter indicating success or failure of the command. The completion code is stored in the shell variables RC. This is either 0, indicating success, or a numerical error or warning code. The shell variable EMSG will contain a textual error message according to value of RC.

Notes
  • You should make it a habit to always end the list of options with the "end of options" option, /- (q.v.) because, otherwise, you will get into trouble when command arguments start with a slash.
  • Most commands overwrite the variables RC and EMSG. There are a few commands, though, which touch RC and EMSG only if an execution error occours. The most prominent commands in the latter group are IF and GOTO and, actually, most other control commands.
  • Some commands return the completion code also as their result value.
  • In contrast to commands, macros store their return value (generated with the EXIT command) in the variable RESULT, meaning that macro calls do not affect the variables RC and EMSG, unless they use commands!
See also
Introduction, shell items

STx commands (alphabetical list)

ARG · ATTRIBUTES · BREAK · CHECKIT · COND · CONTINUE · DELETE · DISPATCH · DO · DRIVE · ELSE · EMSG · END · ENV · EVAL · EVALCHECK · EXIT · FIND · FOR · FOREVER · FORMAT · GOSUB · GOSUBX · GOTO · IF · IFNOT · INT · INTCHECK · INTERPRET · IREF · KEYWORD · LENGTH · LINELENGTH · LIST · LOAD · LOGMSG · LOWER · MACRO · MACROX · MESSAGE · NAME · NEW · NUM · NUMCHECK · PARSECELLMESSAGE · POSITION · PRINTDIALOG · PRINTSETTINGS · PWD · QUERY · QUOTE · READ · REVERSE · SEGMENT · SET · SFTRUNCATE · SHELL · STRCHR · STXCONSTANTS · SUBSTR · SYSINFO · SYSTEM · TAGS · TGET · TIME · TOKEN · TRANSLATE · TRIM · TSET · UNIQUE · UNLOAD · UPPER · WHILE · WORD · WORDS · WRITE · WRITELOG

Common STx options

Template:Programmer Guide/Command Reference Options

Navigation menu

Personal tools