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

BPSOSU9.m

Go to the documentation of this file.
  1. BPSOSU9 ;BHAM ISC/FCS/DRS/FLS - copied for ECME ;03/07/08 10:41
  1. ;;1.0;E CLAIMS MGMT ENGINE;**1,7**;JUN 2004;Build 46
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ;----------------------------------------------------------------------
  1. ;Standard W and String Formatting Functions
  1. ;----------------------------------------------------------------------
  1. WCENTER(TEXT,IOM,UL) ;EP
  1. S:$G(IOM)="" IOM=80
  1. W ?IOM-$L(TEXT)/2,TEXT,!
  1. I $G(UL) W ?IOM-$L(TEXT)/2,$TR($J("",$L(TEXT))," ","-"),!
  1. Q
  1. ;----------------------------------------------------------------------
  1. ;W Standard Underlined HEADER
  1. WHEADER(TEXT,IOF,IOM) ;EP
  1. Q:$G(TEXT)=""
  1. S:$G(IOF)="" IOF="#"
  1. S:$G(IOM)="" IOM=80
  1. W @IOF,!
  1. D WCENTER(TEXT,IOM)
  1. D WCENTER($TR($J("",$L(TEXT))," ","-"),IOM)
  1. Q
  1. ;----------------------------------------------------------------------
  1. ;W Column HEADERs (with option to underline)
  1. WCOLUMNS(INDENT,COLDEFS,CNAMES,ULINE) ;EP
  1. N CHEAD1,CHEAD2,INDEX,CDEF
  1. Q:$G(CNAMES)=""
  1. S:$G(INDENT)="" INDENT=0
  1. S:$G(COLDEFS)="" COLDEFS=2
  1. S:$G(ULINE)="" ULINE=1
  1. ;
  1. S COLDEFS=$J("",COLDEFS)
  1. S (CHEAD1,CHEAD2)=""
  1. F INDEX=1:1:$L(CNAMES,",") D
  1. .S CDEF=$P(CNAMES,",",INDEX)
  1. .S CHEAD1=CHEAD1_$S(INDEX=1:"",1:COLDEFS)_$$LJBF($P(CDEF,":",1),$P(CDEF,":",2))
  1. .S:ULINE CHEAD2=CHEAD2_$S(INDEX=1:"",1:COLDEFS)_$TR($J("",$P(CDEF,":",2))," ","-")
  1. W ?INDENT,CHEAD1,!
  1. W:ULINE ?INDENT,CHEAD2,!
  1. Q
  1. ;----------------------------------------------------------------------
  1. WDATA(INDENT,COLDEFS,VNAMES) ;EP
  1. N INDEX,DEF,DLINE,VAR,LEN
  1. Q:$G(VNAMES)=""
  1. S:$G(INDENT)="" INDENT=0
  1. S:$G(COLDEFS)="" COLDEFS=2
  1. ;
  1. S COLDEFS=$J("",COLDEFS)
  1. S DLINE=""
  1. F INDEX=1:1:$L(VNAMES,",") D
  1. .S DEF=$P(VNAMES,",",INDEX)
  1. .S VAR=$P(DEF,":",1)
  1. .S LEN=$P(DEF,":",2)
  1. .S DLINE=DLINE_$S(INDEX=1:"",1:COLDEFS)_$$LJBF($S(VAR="":"",1:$G(@VAR)),LEN)
  1. W ?INDENT,DLINE,!
  1. Q
  1. ;
  1. ;----------------------------------------------------------------------
  1. ;Left justifies and blank fills
  1. LJBF(X,L) ;EP
  1. Q $E(X_$J("",L-$L(X)),1,L)
  1. ;----------------------------------------------------------------------
  1. ;Right justifies and blank fills
  1. RJBF(X,L) ;EP
  1. Q $E($J("",L-$L(X))_X,1,L)
  1. ;----------------------------------------------------------------------
  1. ;CENTER justifies and blank fills
  1. CJBF(X,L) ;
  1. Q $$LJBF($E($J("",(L-$L(X))\2)_X,1,L),L)
  1. ;----------------------------------------------------------------------
  1. ;Convert lower case characters to upper case characters
  1. UCASE(X) ;EP
  1. Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. ;----------------------------------------------------------------------
  1. ;Convert upper case characters to lower case characters
  1. LCASE(X) ;
  1. Q $TR(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
  1. ;----------------------------------------------------------------------
  1. ;Delete leading and trailing blanks
  1. CLIP(X) ;EP
  1. F D Q:$E(X,1)'=" "
  1. .S:$E(X,1)=" " X=$E(X,2,$L(X))
  1. F D Q:$E(X,$L(X))'=" "
  1. .S:$E(X,$L(X))=" " X=$E(X,1,$L(X)-1)
  1. Q X