'SHUTSHOP - shutdown routine - returns to BOSS menu if allowed

external   cpath sch scw $menu messbox() progress() remove() dpath jobs[6]
external   arytostr() userid SetPRN_JNR()

public     ptary[1] ptstr $jobstr

global     x i

MAIN
  if $menu ! "boss"
    screen clear box 1 1 sch scw 0 0 no-border
    execute "bossmenu.pop" in-memory
    transfer cpath|"pm_menu.psl" in-memory
  elseif $menu ! "offc"
    screen clear box 1 1 sch scw 0 0 no-border
    execute "offcmenu.pop" in-memory
    transfer cpath|"pm_menu.psl" in-memory
  else
' 	ReturnToMenu()
'    tools os "C:\aw\awlogoff /w"
'    messbox(" #!EXIT!# ",0,1,1)
'    screen clear box 1 1 sch scw 0 0 no-border
'    repaint off
'    progress(15,10," Deleting all local indices ",0)
'    file unload all
'      remove("*.idx")
'     redimension ptary[6]
'     for i = 1 to 6
'       ptary[i] = jobs[i]
'     end for
'     x = arytostr(6)
'     $jobstr = ptstr                      'message "Job string to unload is:"&str($jobstr)
'
'     if $jobstr <> 0
'       fopen dpath|userid|".jnr" as 1
'       fwrite 1 from $jobstr
'       fclose 1
'     end if

'     SetPRN_JNR()
'     execute "logout.rf3" in-memory
'     wait 3
'     window border
'     execute "entappl.rf3" in-memory
  end if
END MAIN

