ORAMP505 ;HPS/DM - Post Installation Tasks ; 3/12/19 9:24am
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**505**;Dec 17, 1997;Build 1
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 ; This routine uses the following IAs:
 ; #10141 - MES^XPDUTL Kernel (supported)
 ; #10141 - BMES^XPDUTL Kernel (supported)
 ; #2263 - EN^XPAR Kernel (supported)
 ;
 Q
EN ;
 ; Installing commands in the command file...
 D MES^XPDUTL("OR*3.0*505 Post install starting....")
 ;
 D MES^XPDUTL("Updating parameters...")
 ; Update ORAM GUI VERSION with new build number for AntiCoagulate.exe.
 D EN^XPAR("SYS","ORAM GUI VERSION",,"1.0.505.1")
 D MES^XPDUTL("Parameters updated.")
 ;
 D MES^XPDUTL("Stripping control characters from file ORAM(103)...")
 D STRPCCHR
 ;
 D MES^XPDUTL("OR*3.0*505 Post Init complete")
 ;
 Q
STRPCCHR ; This routine will strip out control characters from file #103
 N ORGLB,ORSTR,ORCHR,ORCNTRL,ORDONE,ORI,ORCNT,ORMSG
 S ORCNT=0,ORCNTRL=$C(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
 S ^XTMP("ORPS505",0)=$$FMADD^XLFDT(DT,730)_U_DT
 ; query through all nodes of file #103 - quit when xref encountered
 S ORGLB="^ORAM(103)"
 F  S ORGLB=$Q(@ORGLB) Q:($P(ORGLB,",",2)="B")!(ORGLB="")  D
 . ; skip 0 node (no word processing fields)
 . I $P(ORGLB,",",3)=0 Q
 . ; skip 6 node (no word processing fields)
 . I $P(ORGLB,",",3)=6
 . S ORSTR=@ORGLB,ORI=0
 . ; translate out all characters below ascii 32
 . S ORDONE=0
 . S ORI=0 F  S ORI=ORI+1 Q:ORI>$L(ORSTR)!ORDONE  S ORCHR=$E(ORSTR,ORI) I $A(ORCHR)<32 S ORSTR=$TR(ORSTR,ORCNTRL),ORDONE=1
 . ; if any characters have been stripped out then save old string and reset glb to new string
 . I $L(ORSTR)'=$L(@ORGLB) D
 . . S ORCNT=ORCNT+1
 . . S ^XTMP("ORPS505",ORGLB)=@ORGLB
 . . S @ORGLB=ORSTR
 . . Q
 . Q
 I 'ORCNT S ORMSG="No control characters found during scan of ORAM FLOWSHEET (#103)"
 E  S ORMSG="Control characters were removed from "_ORCNT_" records in ORAM FLOWSHEET (#103)"
 D BMES^XPDUTL(ORMSG)
 D MES^XPDUTL("")
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORAMP505   2077     printed  Sep 23, 2025@20:03:20                                                                                                                                                                                                    Page 2
ORAMP505  ;HPS/DM - Post Installation Tasks ; 3/12/19 9:24am
 +1       ;;3.0;ORDER ENTRY/RESULTS REPORTING;**505**;Dec 17, 1997;Build 1
 +2       ;;Per VA Directive 6402, this routine should not be modified.
 +3       ;
 +4       ; This routine uses the following IAs:
 +5       ; #10141 - MES^XPDUTL Kernel (supported)
 +6       ; #10141 - BMES^XPDUTL Kernel (supported)
 +7       ; #2263 - EN^XPAR Kernel (supported)
 +8       ;
 +9        QUIT 
EN        ;
 +1       ; Installing commands in the command file...
 +2        DO MES^XPDUTL("OR*3.0*505 Post install starting....")
 +3       ;
 +4        DO MES^XPDUTL("Updating parameters...")
 +5       ; Update ORAM GUI VERSION with new build number for AntiCoagulate.exe.
 +6        DO EN^XPAR("SYS","ORAM GUI VERSION",,"1.0.505.1")
 +7        DO MES^XPDUTL("Parameters updated.")
 +8       ;
 +9        DO MES^XPDUTL("Stripping control characters from file ORAM(103)...")
 +10       DO STRPCCHR
 +11      ;
 +12       DO MES^XPDUTL("OR*3.0*505 Post Init complete")
 +13      ;
 +14       QUIT 
STRPCCHR  ; This routine will strip out control characters from file #103
 +1        NEW ORGLB,ORSTR,ORCHR,ORCNTRL,ORDONE,ORI,ORCNT,ORMSG
 +2        SET ORCNT=0
           SET ORCNTRL=$CHAR(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
 +3        SET ^XTMP("ORPS505",0)=$$FMADD^XLFDT(DT,730)_U_DT
 +4       ; query through all nodes of file #103 - quit when xref encountered
 +5        SET ORGLB="^ORAM(103)"
 +6        FOR 
               SET ORGLB=$QUERY(@ORGLB)
               if ($PIECE(ORGLB,",",2)="B")!(ORGLB="")
                   QUIT 
               Begin DoDot:1
 +7       ; skip 0 node (no word processing fields)
 +8                IF $PIECE(ORGLB,",",3)=0
                       QUIT 
 +9       ; skip 6 node (no word processing fields)
 +10               IF $PIECE(ORGLB,",",3)=6
 +11               SET ORSTR=@ORGLB
                   SET ORI=0
 +12      ; translate out all characters below ascii 32
 +13               SET ORDONE=0
 +14               SET ORI=0
                   FOR 
                       SET ORI=ORI+1
                       if ORI>$LENGTH(ORSTR)!ORDONE
                           QUIT 
                       SET ORCHR=$EXTRACT(ORSTR,ORI)
                       IF $ASCII(ORCHR)<32
                           SET ORSTR=$TRANSLATE(ORSTR,ORCNTRL)
                           SET ORDONE=1
 +15      ; if any characters have been stripped out then save old string and reset glb to new string
 +16               IF $LENGTH(ORSTR)'=$LENGTH(@ORGLB)
                       Begin DoDot:2
 +17                       SET ORCNT=ORCNT+1
 +18                       SET ^XTMP("ORPS505",ORGLB)=@ORGLB
 +19                       SET @ORGLB=ORSTR
 +20                       QUIT 
                       End DoDot:2
 +21               QUIT 
               End DoDot:1
 +22       IF 'ORCNT
               SET ORMSG="No control characters found during scan of ORAM FLOWSHEET (#103)"
 +23      IF '$TEST
               SET ORMSG="Control characters were removed from "_ORCNT_" records in ORAM FLOWSHEET (#103)"
 +24       DO BMES^XPDUTL(ORMSG)
 +25       DO MES^XPDUTL("")
 +26       QUIT