PSOASAP1 ;BIRM/KML - American Society for Automation in Pharmacy (ASAP) Field Values ;09/30/15
;;7.0;OUTPATIENT PHARMACY;**772**;DEC 1997;Build 105
;
;
; *** PHA Segment continued - Pharmacy Header ***
PHA14() ;pharmacy dispenser type
; pso*7*772 defined for 5.0+ only, earlier versions do not use
Q:+PSOASVER<5.0 "" ;data element is not defined before 5.0
Q "10" ; for Federal
;
PHA15() ; Mail Order Pharmacy
; pso*7*772 defined for 5.0+ only, earlier versions do not use
Q ""
;
; *** PAT Segment continued - Patient Information ***
;
PAT24() ;ASAP 3.0: Language Code (Not Used)
; ASAP 5.0: Patient Preferred or Alias Last Name (new in 5.0)
Q $$PAT24^PSOASAP2()
;
PAT25() ;ASAP 3.0: Work Phone Number (Not Used)
; ASAP 5.0: Patient Preferred or Alias First Name (new in 5.0)
Q $$PAT25^PSOASAP2()
;
PAT26() ;ASAP 3.0: Alternate Phone Number (Not Used)
; ASAP 5.0: Patient Race Category (new in 5.0)
Q $$PAT26^PSOASAP2()
;
PAT27() ;ASAP 3.0: Drivers License Number
; ASAP 5.0: Patient Ethnicity (new in 5.0)
Q $$PAT27^PSOASAP2()
;
PAT28() ;ASAP 3.0: Facility Code (Not Used)
; ASAP 5.0: Veterinary Species Code (new in 5.0)
Q ""
;
PAT29() ;ASAP 3.0: Unit Identifier (Not Used)
; ASAP 5.0: Animal Location Code (new in 5.0)
Q ""
;
PAT30() ;ASAP 3.0: Room Number (Not Used)
Q ""
;
PAT31() ;ASAP 3.0: Bed (Not Used)
Q ""
;
PAT32() ;ASAP 3.0: Medical Record Number (Not Used)
Q ""
;
PAT33() ;ASAP 3.0: Admission Date (Not Used)
Q ""
;
PAT34() ;ASAP 3.0: Admission Time (Not Used)
Q ""
;
PAT35() ;ASAP 3.0: Discharge Date (Not Used)
Q ""
;
PAT36() ;ASAP 3.0: Discharge Time (Not Used)
Q ""
;
PAT37() ;ASAP 3.0: Primary Coverage Start Date (Not Used)
Q ""
;
PAT38() ;ASAP 3.0: Not Used
Q ""
;
PAT39() ;ASAP 3.0: Secondary Coverage Start Date (Not Used)
Q ""
;
PAT40() ;ASAP 3.0: Secondary Coverage Stop Date (Not Used)
Q ""
; *** DSP Segment continued - Dispensing Record ***
;
DSP23() ;ASAP 3.0 to 4.2: Not Used
; ASAP 4.2A-5.0+ : SIG
Q:+PSOASVER<4.2!(PSOASVER=4.2) ""
N I,X,Y,ICNT,SIGX,Z1,INS1,SIGY K SIGOUT S SIGOUT=""
I '$P($G(^PSRX(RXIEN,"SIG")),"^",2) S SIGOK=0 D Q $E($G(SIGOUT),1,200)
.N SIG S SIG=""
.S SIGX=$P($G(^PSRX(RXIEN,"SIG")),"^")
.N INS1 Q:$L(SIGX)<1
.F Z0=1:1:$L(SIGX," ") Q:Z0="" S Z1=$P(SIGX," ",Z0) D Q:'$D(SIGX)
..I $L(Z1)>32 K SIGX Q
..D:$D(SIGX)&($G(Z1)]"") S INS1=$G(INS1)_Z1
...S Z1=$$UPPER^PSOSIG(Z1)
...S SIGY=$O(^PS(51,"B",Z1,0)) Q:'SIGY!($P($G(^PS(51,+SIGY,0)),"^",4)>1) S Z1=$P(^PS(51,SIGY,0),"^",2)
...I $G(^PS(51,+SIGY,9))]"" S SIGY=$P(SIGX," ",Z0-1),SIGY=$E(SIGY,$L(SIGY)) S:SIGY>1 Z1=^(9)
.S SIG=$E($G(INS1),1,200)
.F SG=1:1:$L(SIG) S:$P(SIG," ",SG)'="" SIGOUT=$G(SIGOUT)_$P(SIG," ",SG)
S SIGOK=1
F ICNT=0:0 S ICNT=$O(^PSRX(RXIEN,"SIG1",ICNT)) Q:'ICNT D
. S SIGOUT=$S($L($G(SIGOUT)):$G(SIGOUT)_$P(^PSRX(RXIEN,"SIG1",ICNT,0),"^"),1:$P(^PSRX(RXIEN,"SIG1",ICNT,0),"^"))
Q $E(SIGOUT,1,200)
;
DSP26() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
; ASAP 5.0: Time Written (new with 5.0)
Q ""
;
DSP27() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
; ASAP 5.0: Time Filled (new with 5.0)
Q $$DSP27^PSOASAP2()
;
DSP28() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
; ASAP 5.0: Time Sold (new with 5.0)
; get the data using $$DSP27() method
Q $$DSP27()
;
DSP29() ;ASAP 3.0: Bar Code on Vial Label (Not Used)
; ASAP 5.0: Total Quantity Remaining on Prescription
Q $$DSP29^PSOASAP2()
;
DSP30() ;ASAP 3.0: Group Identifier (Not Used)
; ASAP 5.0: Total Quantity Remaining Drug Dosage Units Code (new in 5.0)
Q $$DSP30^PSOASAP2()
;
DSP31() ;ASAP 3.0: Group Rx Count (Not Used)
; ASAP 5.0: Discount Card (new in 5.0)
Q ""
;
DSP32() ;ASAP 3.0: Partial Fill Indicator (Not Used)
; ASAP 5.0: Classification Code for Additional Payment Type (new in 5.0)
Q:+PSOASVER<5.0 ""
Q "05"
;
DSP33() ;ASAP 3.0: Priority (Not Used)
; ASAP 5.0: Discount Card for Additional Payment Type (new in 5.0)
Q:+PSOASVER<5.0 ""
Q "02"
;
DSP34() ; ASAP 5.0: DEA Schedule/State Designation (new in 5.0)
Q $$DSP34^PSOASAP2
;
DSP35() ; ASAP 5.0: Last Name or Initials of Pharmacist Filling the Prescription (new in 5.0)
Q ""
;
DSP36() ; ASAP 5.0: First Name of PHarmacist Filling the Prescription (new in 5.0)
Q ""
;
; *** PRE Segment continued - Prescriber Information ***
;
PRE11() ;ASAP 5.0: Prescriber Address Information 1 (added in 5.0)
Q $$PRE11^PSOASAP2()
;
PRE12() ;ASAP 5.0: Prescriber Address Information 2 (added in 5.0)
Q $$PRE12^PSOASAP2()
;
PRE13() ;ASAP 5.0: Prescriber City Address (added in 5.0)
Q $$PRE13^PSOASAP2()
;
PRE14() ;ASAP 5.0: Prescriber State Address (added in 5.0)
Q $$PRE14^PSOASAP2()
;
PRE15() ;ASAP 5.0: Zip Code Address (added in 5.0)
Q $$PRE15^PSOASAP2()
;
PRE16() ;ASAP n.0: (Not Used)
Q ""
;
PRE17() ;ASAP n.0:(Not Used)
Q ""
;
PRE18() ;ASAP n.0: (Not Used)
Q ""
;
PRE19() ;ASAP n.0: (Not Used)
Q ""
;
PRE20() ;ASAP n.0: (Not Used)
Q ""
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOASAP1 5135 printed Aug 26, 2025@22:40:24 Page 2
PSOASAP1 ;BIRM/KML - American Society for Automation in Pharmacy (ASAP) Field Values ;09/30/15
+1 ;;7.0;OUTPATIENT PHARMACY;**772**;DEC 1997;Build 105
+2 ;
+3 ;
+4 ; *** PHA Segment continued - Pharmacy Header ***
PHA14() ;pharmacy dispenser type
+1 ; pso*7*772 defined for 5.0+ only, earlier versions do not use
+2 ;data element is not defined before 5.0
if +PSOASVER<5.0
QUIT ""
+3 ; for Federal
QUIT "10"
+4 ;
PHA15() ; Mail Order Pharmacy
+1 ; pso*7*772 defined for 5.0+ only, earlier versions do not use
+2 QUIT ""
+3 ;
+4 ; *** PAT Segment continued - Patient Information ***
+5 ;
PAT24() ;ASAP 3.0: Language Code (Not Used)
+1 ; ASAP 5.0: Patient Preferred or Alias Last Name (new in 5.0)
+2 QUIT $$PAT24^PSOASAP2()
+3 ;
PAT25() ;ASAP 3.0: Work Phone Number (Not Used)
+1 ; ASAP 5.0: Patient Preferred or Alias First Name (new in 5.0)
+2 QUIT $$PAT25^PSOASAP2()
+3 ;
PAT26() ;ASAP 3.0: Alternate Phone Number (Not Used)
+1 ; ASAP 5.0: Patient Race Category (new in 5.0)
+2 QUIT $$PAT26^PSOASAP2()
+3 ;
PAT27() ;ASAP 3.0: Drivers License Number
+1 ; ASAP 5.0: Patient Ethnicity (new in 5.0)
+2 QUIT $$PAT27^PSOASAP2()
+3 ;
PAT28() ;ASAP 3.0: Facility Code (Not Used)
+1 ; ASAP 5.0: Veterinary Species Code (new in 5.0)
+2 QUIT ""
+3 ;
PAT29() ;ASAP 3.0: Unit Identifier (Not Used)
+1 ; ASAP 5.0: Animal Location Code (new in 5.0)
+2 QUIT ""
+3 ;
PAT30() ;ASAP 3.0: Room Number (Not Used)
+1 QUIT ""
+2 ;
PAT31() ;ASAP 3.0: Bed (Not Used)
+1 QUIT ""
+2 ;
PAT32() ;ASAP 3.0: Medical Record Number (Not Used)
+1 QUIT ""
+2 ;
PAT33() ;ASAP 3.0: Admission Date (Not Used)
+1 QUIT ""
+2 ;
PAT34() ;ASAP 3.0: Admission Time (Not Used)
+1 QUIT ""
+2 ;
PAT35() ;ASAP 3.0: Discharge Date (Not Used)
+1 QUIT ""
+2 ;
PAT36() ;ASAP 3.0: Discharge Time (Not Used)
+1 QUIT ""
+2 ;
PAT37() ;ASAP 3.0: Primary Coverage Start Date (Not Used)
+1 QUIT ""
+2 ;
PAT38() ;ASAP 3.0: Not Used
+1 QUIT ""
+2 ;
PAT39() ;ASAP 3.0: Secondary Coverage Start Date (Not Used)
+1 QUIT ""
+2 ;
PAT40() ;ASAP 3.0: Secondary Coverage Stop Date (Not Used)
+1 QUIT ""
+2 ; *** DSP Segment continued - Dispensing Record ***
+3 ;
DSP23() ;ASAP 3.0 to 4.2: Not Used
+1 ; ASAP 4.2A-5.0+ : SIG
+2 if +PSOASVER<4.2!(PSOASVER=4.2)
QUIT ""
+3 NEW I,X,Y,ICNT,SIGX,Z1,INS1,SIGY
KILL SIGOUT
SET SIGOUT=""
+4 IF '$PIECE($GET(^PSRX(RXIEN,"SIG")),"^",2)
SET SIGOK=0
Begin DoDot:1
+5 NEW SIG
SET SIG=""
+6 SET SIGX=$PIECE($GET(^PSRX(RXIEN,"SIG")),"^")
+7 NEW INS1
if $LENGTH(SIGX)<1
QUIT
+8 FOR Z0=1:1:$LENGTH(SIGX," ")
if Z0=""
QUIT
SET Z1=$PIECE(SIGX," ",Z0)
Begin DoDot:2
+9 IF $LENGTH(Z1)>32
KILL SIGX
QUIT
+10 if $DATA(SIGX)&($GET(Z1)]"")
Begin DoDot:3
+11 SET Z1=$$UPPER^PSOSIG(Z1)
+12 SET SIGY=$ORDER(^PS(51,"B",Z1,0))
if 'SIGY!($PIECE($GET(^PS(51,+SIGY,0)),"^",4)>1)
QUIT
SET Z1=$PIECE(^PS(51,SIGY,0),"^",2)
+13 IF $GET(^PS(51,+SIGY,9))]""
SET SIGY=$PIECE(SIGX," ",Z0-1)
SET SIGY=$EXTRACT(SIGY,$LENGTH(SIGY))
if SIGY>1
SET Z1=^(9)
End DoDot:3
SET INS1=$GET(INS1)_Z1
End DoDot:2
if '$DATA(SIGX)
QUIT
+14 SET SIG=$EXTRACT($GET(INS1),1,200)
+15 FOR SG=1:1:$LENGTH(SIG)
if $PIECE(SIG," ",SG)'=""
SET SIGOUT=$GET(SIGOUT)_$PIECE(SIG," ",SG)
End DoDot:1
QUIT $EXTRACT($GET(SIGOUT),1,200)
+16 SET SIGOK=1
+17 FOR ICNT=0:0
SET ICNT=$ORDER(^PSRX(RXIEN,"SIG1",ICNT))
if 'ICNT
QUIT
Begin DoDot:1
+18 SET SIGOUT=$SELECT($LENGTH($GET(SIGOUT)):$GET(SIGOUT)_$PIECE(^PSRX(RXIEN,"SIG1",ICNT,0),"^"),1:$PIECE(^PSRX(RXIEN,"SIG1",ICNT,0),"^"))
End DoDot:1
+19 QUIT $EXTRACT(SIGOUT,1,200)
+20 ;
DSP26() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
+1 ; ASAP 5.0: Time Written (new with 5.0)
+2 QUIT ""
+3 ;
DSP27() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
+1 ; ASAP 5.0: Time Filled (new with 5.0)
+2 QUIT $$DSP27^PSOASAP2()
+3 ;
DSP28() ;ASAP 3.0: Warning/Auxiliary Labels (Not Used)
+1 ; ASAP 5.0: Time Sold (new with 5.0)
+2 ; get the data using $$DSP27() method
+3 QUIT $$DSP27()
+4 ;
DSP29() ;ASAP 3.0: Bar Code on Vial Label (Not Used)
+1 ; ASAP 5.0: Total Quantity Remaining on Prescription
+2 QUIT $$DSP29^PSOASAP2()
+3 ;
DSP30() ;ASAP 3.0: Group Identifier (Not Used)
+1 ; ASAP 5.0: Total Quantity Remaining Drug Dosage Units Code (new in 5.0)
+2 QUIT $$DSP30^PSOASAP2()
+3 ;
DSP31() ;ASAP 3.0: Group Rx Count (Not Used)
+1 ; ASAP 5.0: Discount Card (new in 5.0)
+2 QUIT ""
+3 ;
DSP32() ;ASAP 3.0: Partial Fill Indicator (Not Used)
+1 ; ASAP 5.0: Classification Code for Additional Payment Type (new in 5.0)
+2 if +PSOASVER<5.0
QUIT ""
+3 QUIT "05"
+4 ;
DSP33() ;ASAP 3.0: Priority (Not Used)
+1 ; ASAP 5.0: Discount Card for Additional Payment Type (new in 5.0)
+2 if +PSOASVER<5.0
QUIT ""
+3 QUIT "02"
+4 ;
DSP34() ; ASAP 5.0: DEA Schedule/State Designation (new in 5.0)
+1 QUIT $$DSP34^PSOASAP2
+2 ;
DSP35() ; ASAP 5.0: Last Name or Initials of Pharmacist Filling the Prescription (new in 5.0)
+1 QUIT ""
+2 ;
DSP36() ; ASAP 5.0: First Name of PHarmacist Filling the Prescription (new in 5.0)
+1 QUIT ""
+2 ;
+3 ; *** PRE Segment continued - Prescriber Information ***
+4 ;
PRE11() ;ASAP 5.0: Prescriber Address Information 1 (added in 5.0)
+1 QUIT $$PRE11^PSOASAP2()
+2 ;
PRE12() ;ASAP 5.0: Prescriber Address Information 2 (added in 5.0)
+1 QUIT $$PRE12^PSOASAP2()
+2 ;
PRE13() ;ASAP 5.0: Prescriber City Address (added in 5.0)
+1 QUIT $$PRE13^PSOASAP2()
+2 ;
PRE14() ;ASAP 5.0: Prescriber State Address (added in 5.0)
+1 QUIT $$PRE14^PSOASAP2()
+2 ;
PRE15() ;ASAP 5.0: Zip Code Address (added in 5.0)
+1 QUIT $$PRE15^PSOASAP2()
+2 ;
PRE16() ;ASAP n.0: (Not Used)
+1 QUIT ""
+2 ;
PRE17() ;ASAP n.0:(Not Used)
+1 QUIT ""
+2 ;
PRE18() ;ASAP n.0: (Not Used)
+1 QUIT ""
+2 ;
PRE19() ;ASAP n.0: (Not Used)
+1 QUIT ""
+2 ;
PRE20() ;ASAP n.0: (Not Used)
+1 QUIT ""
+2 ;