Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## ABSOLUTE function

> Returns the absolute value of a numeric value.

> #### Syntax

>     ABSOLUTE ( n )

> ``n``

> An integer or decimal expression. The return value is the same format as `n`.

> Example

> This procedure calculates the number of miles you drive between highway exit ramps:

> r-abs.p
>     DEFINE VARIABLE mark-start  AS DECIMAL NO-UNDO.
>     DEFINE VARIABLE mark-finish AS DECIMAL NO-UNDO.
>     DEFINE VARIABLE units AS LOGICAL FORMAT "miles/kilometers" NO-UNDO.

>     FORM
>       mark-start  LABEL "Mile marker for highway on-ramp" SKIP
>       mark-finish LABEL "Mile marker next to your exit" SKIP(1)
>       units LABEL "Measure in <m>iles or <k>ilometers" SKIP(1)
>       WITH FRAME question SIDE-LABELS
>       TITLE "This program calculates distance driven.".

>     UPDATE mark-start mark-finish units WITH FRAME question.

>     DISPLAY
>       "You have driven" ABSOLUTE(mark-start - mark-finish) units
>       WITH NO-LABELS FRAME answer.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095