Updated July 2020; see History
Dot variables, so named because they begin with a period (dot), are read-only system variables useful for retrieving certain kinds of information like the date, program name, etc. In many cases, the same information is available via other methods, such as subroutines, but the dot variable approach is generally the most elegant, efficient, and transparent. They were originally considered part of the d/BASIC extensions (COMPIL /D), because most of them originated with d/BASIC. But over time, A-Shell has added its own dot variables and they are available as part of the A-Shell extensions (COMPIL/X:2). All string dot variable values are stripped of trailing spaces.
Extension |
Notes |
---|---|
.ACCOUNT |
Evaluates to the user’s current ppn (e.g. "100,22"). |
Number of parameters passed in the last function, procedure call, or SBX. |
|
.CCYYMMDD |
Returns current date in CCYYMMDD format. |
.DATE |
Returns the date as a decimal number which displays as MMDDYY. So March 16, 2009 should return the numeric value 31609. |
.DDMMYY |
Returns current date in DDMMYY format |
.DEVICE |
Returns the user’s current device (e.g. "DSK0:") |
.EXPERIENCE |
Returns the numeric value 100 (since "experience" level is not one of the AMOS job attributes that is emulated under A-Shell). |
.FALSE |
.TRUE and .FALSE may be used as self-documenting replacements for -1 and 0. |
.FN |
Alias for the variable holding the return value of a function. See Return Expression. |
.FN'xxx |
Used to simplify referencing the result of a previously called function without having to map a variable and explicitly assign the value to it. See Implicit Function Return Value Capture. |
.JOBNAME |
Returns the jobname. |
.LAST_LABEL |
Name of last label passed. Requires ++PRAGMA TRACK_LAST_LABEL. |
.LAST_ROUTINE |
Name of last called function or procedure. Requires ++PRAGMA TRACK_LAST_ROUTINE. |
.LINENO |
Returns the last line number, similar to err(1) except without requiring an error. Not to be confused with the dot function .LINENO(ch) (which returns the physical line # since the last page break in the output file open on the specified channel). |
.LOCATION |
Returns the current program location counter, i.e. the offset in bytes from the start of the current program (RUN, LIT or SBX) to the current statement position. Note that the location counter is generally represented in hex (as it appears in the LSX files created by the compiler /LF switch), so you would probably want to print it using the SOSLIB function Fn'Dec2Hex(.LOCATION). |
.MILLITIME |
Returns number of milliseconds since midnight. |
.MICROTIME |
Returns number of microseconds since midnight. Note that due to quirks of the system scheduling clocks on different platforms, the resolution of the results may not be as granular as one might expect. |
.MMDDYY |
Returns current date in MMDDYY format. |
.MONTH |
Returns the three character abbreviation for the current month. |
.NEST_LEVEL |
Number of levels deep with nested function/procedure calls. |
Special string value distinguished from the empty string "" with particular uses. Also see .NULL Files. |
|
.PGMNAME |
Returns the current program name. |
.PGMVERSION |
Returns the current program version (e.g. "1.2A(100)"). |
.SBXNAME |
Returns name of current SBX or "" if not applicable. |
.SBXVERSION |
Returns version string for current SBX or "" if not applicable. |
.TERMINAL |
Returns the current TRMDEF name. |
.TIME |
Returns the current time, in HHMMSS format. |
.TRUE |
.TRUE and .FALSE may be used as self-documenting replacements for -1 and 0. |
.USERNAME |
Returns the user name. |
.YYMMDD |
Returns the current date in YYMMDD (String) format. |
See Also
History
2020 July, A-Shell 6.5.1687, compiler edit 935: Add new variables .MILLITIME, .MICROTIME. Use of these will tag the RUN file as requiring A-Shell version 6.5.1687 or higher to run.
2020 July, A-Shell 6.5.1685, compiler edit 933: Add new variables .SBXNAME, .SBXVERSION, .CCYYMMDD, .MMDDYY, .DDMMYY, .RECSIZ(ch). Use of these will tag the RUN file as requiring A-Shell version 6.5.1685 or higher to run.
2016 December, A-Shell 6.3.1538, compiler edit 792: Add .LINENO and .LOCATION
2016 September, A-Shell 6.3.1524: Add special file name .NULL
2014 October, A-Shell 6.1.1391, compiler edit 710: Add .TRUE and .FALSE