PS TEXT FORMAT Reference Manual
Examples of Function and Macro Constructs
11387 Tandem Computers Incorporated G-11
5
4b
4c
4e
4a
4
4d
\ IF UPPER(ARG(1,1))="BUILD"
\ ASSIGN k 1
\ ASSIGN last1 idx_count
\ LOOP
\ IF idx_count<=0
\ EXITLOOP
\ ENDIF
\ ASSIGN first 1
\ ASSIGN j 2
\ LOOP last1-1
\ IF idx_item\(j\)<idx_item\(first\)
\ ASSIGN first j
\ ENDIF
\ ASSIGN j j+1
\ ENDLOOP
\ ASSIGN item idx_item\(first\)
\ ASSIGN page idx_page\(first\)
\ ASSIGN sorted\(k\) item&" "&STRING(page)
\ ASSIGN k k+1
\ ASSIGN idx_item\(first\) idx_item\(last1\)
\ ASSIGN idx_page\(first\) idx_page\(last1\)
\ ASSIGN last1 last1-1
\ ENDLOOP
\ NEW
\ SET JOIN OFF
\ CENTER
INDEX
\ SPACE 3
\ ASSIGN k 1
\ LOOP idx_count
\ ASSIGN printline sorted\(k\)
\ (printline\)
\ ASSIGN k k+1
\ ENDLOOP
\ ELSE
\ ASSIGN idx_count idx_count+1
\ ASSIGN idx_item\(idx_count\) ARG(1)
\ ASSIGN idx_page\(idx_count\) SYS_PAGENUMBER
\ ENDIF
\ENDMACRO idx