Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

$JUSTIFY

M[UMPS] by Example

Right Hand Pointer

Introduced in the 1977 ANSI M[UMPS] language standard.

This function returns a formatted reproduction of the string passed as a parameter. The actual formatting depends on further parameters.

In the examples below, the open square character (⋥) is displayed where the resulting strings contain spaces, so that the number if space-characters becomes visible.

Set X=12.35

Reference   Value
$Justify(X,6)   "⋥12.35"
$Justify(X,5)   "12.35"
$Justify(X,4)   "12.35"
$Justify(X,3)   "12.35"
$Justify(X,7,4)   "12.3500"
$Justify(X,7,3)   "⋥12.350"
$Justify(X,7,2)   "⋥⋥12.35"
$Justify(X,7,1)   "⋥⋥⋥12.4"
$Justify(X,7,0)   "⋥⋥⋥⋥⋥12"
$Justify(X,1,1)   "12.4"

Set Y=197

Reference   Value
$Justify(Y,7,2)   "⋥197.00"
$Justify(Y,2,0)   "197"

Set Z="A"

Reference   Value
$Justify(Z,5)   "⋥⋥⋥⋥A"
$Justify(Z,5,2)   "⋥0.00"

Inverse function for adjustment of numeric values: $TRanslate($Justify(123,9)," ")=123

Note that +$Justify(123,9) = +"      123" = 0

Examples with naked references:

$Justify(VALUE,LENGTH)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$Justify(^(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,

$Justify(VALUE,LENGTH,DECIMALS)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$Justify(^(5,6),^(7,8),^(9,10))

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

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2017 MUMPS Development Committee;
Copyright © Examples: 1995-2017 Ed de Moel;
Copyright © Annotations: 2003-2017 Jacquard Systems Research.

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

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 13-Sep-2014, 10:10:46 .

For comments, contact Ed de Moel (demoel@jacquardsystems.com)