Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HLCSFMN0

HLCSFMN0.m

Go to the documentation of this file.
  1. HLCSFMN0 ;ALB/JRP - INCOMING/OUTGOING FILER MONITOR;19-MAY-95 ;10/15/99 06:57
  1. ;;1.6;HEALTH LEVEL SEVEN;**15,57**;Oct 13, 1995
  1. ;INPUT : FLRTYPE - Flag indicating type of filer header is for
  1. ; IN = Incoming filer (default)
  1. ; OUT = Outgoing filer
  1. ; The following screen attributes:
  1. ; IOELEOL, IOUON, IOUOFF
  1. ;OUTPUT : None
  1. ;NOTES : Existance of IOUON & IOUOFF is assumed
  1. ; : Header begins on current line (i.e. calling application
  1. ; must put cursor at beginning of line)
  1. ; : Cursor will be put at the beginning of line after header
  1. ; when completed
  1. ;
  1. ;Check input
  1. N X S X=0 X ^%ZOSF("RM")
  1. ;Turn off terminal line wrap
  1. S FLRTYPE=$G(FLRTYPE)
  1. N WHTESPCE,DASHES
  1. ;Set whitespace between columns
  1. S WHTESPCE=$J(" ",3)
  1. ;Convert filer type to long format
  1. S FLRTYPE=$S(FLRTYPE="OUT":"Outgoing",1:"Incoming")
  1. ;Print column headers
  1. W "Task Number of ",WHTESPCE,"Asked"
  1. W IOELEOL,!
  1. W IOUON,FLRTYPE," Filer ",IOUOFF,WHTESPCE
  1. W IOUON,"To Stop",IOUOFF,WHTESPCE
  1. W IOUON,"Last Known Date/Time",IOUOFF,WHTESPCE
  1. W IOUON,"Time Difference",$J(" ",13),IOUOFF
  1. W IOELEOL,!
  1. ;Screen attributes have no value - print dashes
  1. I ((IOUON'="")&(IOUOFF'="")) S X=IOM X ^%ZOSF("RM") QUIT
  1. ;Turn terminal line wrap back on
  1. ;Set longest set of dashes used
  1. S DASHES=$TR($J(" ",28)," ","-")
  1. ;Print dashes
  1. W $E(DASHES,1,15),WHTESPCE,$E(DASHES,1,7),WHTESPCE
  1. W $E(DASHES,1,20),WHTESPCE,DASHES
  1. W IOELEOL,!
  1. S X=IOM X ^%ZOSF("RM")
  1. ;Turn terminal line wrap back on
  1. Q
  1. PROMPT() ;Prompt user for action and execute the selected action
  1. ;INPUT : INFILER(PtrSubEntry) = TaskNumber ^ Last$H ^ StopFlag ^
  1. ; Printable$H ^ ErrorMessage
  1. ; OUTFILER(PtrSubEntry) = TaskNumber ^ Last$H ^ StopFlag ^
  1. ; Printable$H ^ ErrorMessage
  1. ; PtrSubEntry = Pointer to subentry in file 869.3
  1. ; TaskNumber = Task number of filer
  1. ; Last$H = Last known $H (field #.03 of subentry)
  1. ; StopFlag = Whether or not filer has been asked to stop
  1. ; (field #.02 of subentry)
  1. ; Yes - Filer has been asked to stop
  1. ; No - Filer has not been asked to stop
  1. ; Error - Task stopped due to error
  1. ; Printable$H = Last$H in printable format
  1. ; ErrorMessage = Printable error message - only used when
  1. ; task stopped due to error
  1. ; INTOP = Pointer to first incoming filer in list to display
  1. ; OUTTOP = Pointer to first outgoing filer in list to display
  1. ; The following screen attributes
  1. ; IOINORM, IOINHI, IOELEOL
  1. ;OUTPUT : 0 = User didn't choose to quit
  1. ; 1 = User choose to quit
  1. ; INTOP & OUTTOP will be adjusted accordingly
  1. ; NEXT action - INTOP & OUTTOP will be moved down 4 entries
  1. ; in the list. If the end of a list is
  1. ; reached, INTOP/OUTTOP will be set to the
  1. ; last entry in the list.
  1. ; BACKUP action - INTOP & OUTTOP will be moved up 4 entries
  1. ; in the list. If the top of a list is
  1. ; reached, INTOP/OUTTOP will be set to the
  1. ; first entry in the list.
  1. ; START actions - INTOP & OUTTOP will not be changed
  1. ; STOP actions - INTOP & OUTTOP will not be changed
  1. ; DELETE actions - INTOP & OUTTOP will not be changed
  1. ;NOTES : Prompt will be displayed at current cursor position
  1. ; : All input is assumed
  1. ; : When the STOP action is choosen, the first filer in the
  1. ; list of filers will be stopped
  1. ;
  1. ;Declare variables
  1. N ANS,ANS1,LOOP,TMP,ARRAYREF,TMPARR,NEWTOP
  1. ;Turn off terminal line wrap
  1. N X S X=0 X ^%ZOSF("RM")
  1. ;Display prompt
  1. W "(",IOINHI,"+I",IOINORM,") Start incoming filer "
  1. W "(",IOINHI,"-I",IOINORM,") Stop incoming filer "
  1. W "(",IOINHI,"*I",IOINORM,") Delete incoming filer"
  1. W IOELEOL,!
  1. W "(",IOINHI,"+O",IOINORM,") Start outgoing filer "
  1. W "(",IOINHI,"-O",IOINORM,") Stop outgoing filer "
  1. W "(",IOINHI,"*O",IOINORM,") Delete outgoing filer"
  1. W IOELEOL,!
  1. W " (",IOINHI,"N",IOINORM,") Next 4 lines in list "
  1. W " (",IOINHI,"B",IOINORM,") Back 4 lines in list "
  1. W " (",IOINHI,"Q",IOINORM,") Quit"
  1. W IOELEOL,!
  1. W "Type selection: ",IOELEOL
  1. ;Get users response
  1. R ANS#1:5 Q:('$T) 0
  1. ;User hit <RET>
  1. Q:(ANS="") 0
  1. ;User choose to quit
  1. I ("Qq^"[ANS) D Q 1
  1. .;Echo rest of response
  1. .W:(ANS="Q") "UIT"
  1. .W:(ANS="q") "uit"
  1. .W:(ANS="^") " QUIT"
  1. .H 1
  1. ;NEXT action
  1. I ("Nn"[ANS) D Q 0
  1. .;Echo rest of response
  1. .W:(ANS="N") "EXT"
  1. .W:(ANS="n") "ext"
  1. .H 1
  1. .F ARRAYREF="INFILER","OUTFILER" D
  1. ..;Move down 4 entries in list
  1. ..S NEWTOP=$S(ARRAYREF="INFILER":INTOP,1:OUTTOP)
  1. ..F LOOP=1:1:4 S NEWTOP=+$O(@ARRAYREF@(NEWTOP)) Q:('NEWTOP)
  1. ..;Went past bottom of list - set to last entry in list
  1. ..I ('NEWTOP) S NEWTOP="" S NEWTOP=+$O(@ARRAYREF@(NEWTOP),-1)
  1. ..;Save new value into appropriate variable
  1. ..S:(ARRAYREF="INFILER") INTOP=NEWTOP
  1. ..S:(ARRAYREF="OUTFILER") OUTTOP=NEWTOP
  1. ;BACKUP action
  1. I ("Bb"[ANS) D Q 0
  1. .;Echo rest of response
  1. .W:(ANS="B") "ACKUP"
  1. .W:(ANS="b") "ackup"
  1. .H 1
  1. .F ARRAYREF="INFILER","OUTFILER" D
  1. ..;Move up 4 entries in list
  1. ..S NEWTOP=$S(ARRAYREF="INFILER":INTOP,1:OUTTOP)
  1. ..F LOOP=1:1:4 S NEWTOP=+$O(@ARRAYREF@(NEWTOP),-1) Q:('NEWTOP)
  1. ..;Went past top of list - set to first entry in list
  1. ..I ('NEWTOP) S NEWTOP="" S NEWTOP=+$O(@ARRAYREF@(NEWTOP))
  1. ..;Save new value into appropriate variable
  1. ..S:(ARRAYREF="INFILER") INTOP=NEWTOP
  1. ..S:(ARRAYREF="OUTFILER") OUTTOP=NEWTOP
  1. ;START/STOP/DELETE action
  1. I ("+-*"[ANS) D Q 0
  1. .;Remember action
  1. .S ANS1=ANS
  1. .;Get type of filer
  1. .R ANS#1:3 Q:('$T)
  1. .;Invalid response
  1. .S ANS=$TR(ANS,"io","IO")
  1. .Q:("IO"'[ANS)
  1. .;Echo complete selection
  1. .W " ",$S(ANS1="+":"START",ANS1="-":"STOP",1:"DELETE")," "
  1. .W $S(ANS="O":"OUTGOING",1:"INCOMING")," FILER"
  1. .H 1
  1. .;START action
  1. .I (ANS1="+") D Q
  1. ..;Start incoming filer
  1. ..I (ANS="I") S TMP=$$TASKFLR^HLCS1("IN")
  1. ..;Start outgoing filer
  1. ..I (ANS="O") S TMP=$$TASKFLR^HLCS1("OUT")
  1. .;STOP action
  1. .I (ANS1="-") D Q
  1. ..S ARRAYREF=$S(ANS="I":"INFILER",1:"OUTFILER")
  1. ..;Get first filer in list that hasn't been asked to stop
  1. ..S TMP=0
  1. ..F S TMP=+$O(@ARRAYREF@(TMP)) Q:('TMP) Q:($P(@ARRAYREF@(TMP),"^",3)="No")
  1. ..;No filer to stop
  1. ..Q:('TMP)
  1. ..;Stop incoming filer
  1. ..I (ANS="I") D STOPFLR^HLCSUTL1(TMP,"IN")
  1. ..;Stop outgoing filer
  1. ..I (ANS="O") D STOPFLR^HLCSUTL1(TMP,"OUT")
  1. .;DELETE action
  1. .S ARRAYREF=$S(ANS="I":"INFILER",1:"OUTFILER")
  1. .;Find all tasks that have stopped due to error
  1. .K TMPARR
  1. .S LOOP=0
  1. .F S LOOP=+$O(@ARRAYREF@(LOOP)) Q:('LOOP) D
  1. ..;Make sure task stopped due to error
  1. ..S TMP=@ARRAYREF@(LOOP)
  1. ..Q:($P(TMP,"^",3)'="Error")
  1. ..;Get task number
  1. ..S TMP=+TMP
  1. ..;Store by task number
  1. ..S TMPARR(TMP)=LOOP
  1. .;No selection required
  1. .Q:('$O(TMPARR("")))
  1. .;Make selection - autoselects on single entry
  1. .S TMP=$$SELECT^HLCSFMN2("TMPARR","filer task number")
  1. .;Delete selection
  1. .I (TMP>0) D
  1. ..;Delete incoming filer
  1. ..I (ANS="I") D DELFLR^HLCSUTL1(TMPARR(TMP),"IN")
  1. ..;Delete outgoing filer
  1. ..I (ANS="O") D DELFLR^HLCSUTL1(TMPARR(TMP),"OUT")
  1. .;Whitespace - needed for screen refreshing
  1. .W !!!!!
  1. ;Invalid response
  1. Q 0