M
I
N
I
S
Y
S
©
O
R
G
T
U
T
O
R
I
A
L
S
  M[UMPS] Functions - $A[SCII]
Introduced in the 1977 ANSI M[UMPS] language standard.

This function returns the internal code number for a character in a string.
The standard defines a one-to-one correspondence between the codes 0 through 127 and the characters from the (7-bit) ASCII set. Code numbers >127 are character-set-specific; code numbers <0 do not indicate valid characters. The special value -1 indicates a reference to a character that does not occur in the string that is passed as the first parameter.

Assume that
X="ABCDE"

Reference Value Remarks
$ASCII(X) 65  
$ASCII(X,1) 65 "A"
$ASCII(X,2) 66 "B"
$ASCII(X,3) 67 "C"
$ASCII(X,0) -1 no character there...
$ASCII(X,6) -1 no character there...
$ASCII(X,-2) -1 no character there...
$ASCII(X,1.92) 65 "A" in position 1

Assume that X=""

Reference Value Remarks
$ASCII(X) -1 no character there...
$ASCII(X,N) -1 no character there...

Assume that X="AB"

Reference Value Remarks
$ASCII(X,0) -1 no character there...
$ASCII(X,3) -1 no character there...
$ASCII(X,-7) -1 no character there...
$ASCII(X,1.92) 65 1.92 truncates to 1


Examples with naked references:

$ASCII(VALUE)
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET ^(3,4)=$ASCII(^(5,6))

; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. store ^(3,4) = ^ABC(1,5,3,4)
; Naked indicator is now: ^ABC(1,5,3,

$ASCII(VALUE,POS)
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET ^(3,4)=$ASCII(^(5,6),^(7,8))

; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. fetch ^(7,8) = ^ABC(1,5,7,8)
; 3. store ^(3,4) = ^ABC(1,5,7,3,4)
; Naked indicator is now: ^ABC(1,5,7,3,


This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.

This document describes the various operators that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).

The information in this document is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.


In this document, information is included that will appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.