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

RMPRPIXE.m

Go to the documentation of this file.
RMPRPIXE ;HINCIO/ODJ-FILE 661.7 API ;3/8/01
 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
 Q
 ;
 ; NEXT - is used to get the next (or previous) record keys
 ;        from an input set of keys, on file 661.7, using a
 ;        specified cross-reference and key level.
 ;        The following cross-references are currently supported...
 ;
 ;    XHDS    - HCPCS, Date&Time and Sequence
 ;    XSHIDS  - Station, HCPCS, Item, Date&Time and Sequence
 ;    XSLHIDS - Station, Location, HCPCS, Item,
 ;              Date&Time and Sequence
 ;
 ; Inputs:
 ;    RMPR     - an array of key values which define a record.
 ;               The specification of this array is dependent on which
 ;               cross-reference is entered (see below)
 ;    RMPRXREF - The cross-reference used to order on (see above)
 ;    RMPRLEV  - The level of traversal. This is also dependent on
 ;               which cross-reference is used (see below)
 ;    RMPRT    - Direction of traversal: 1 - Next (ascending)
 ;                                      -1 - Previous (descending)
 ;    RMPROLD  - This is a copy of RMPR prior to changing RMPR values
 ;    RMPREOF  - End Of File flag: 1 - End Of File, 0 - not end of file
 ;
 ; XHDS x-ref:
 ;    RMPR("HCPCS")
 ;    RMPR("DATE&TIME")
 ;    RMPR("SEQUENCE")
 ;    RMPR("IEN")
 ;    Set RMPRLEV to...
 ;        "HCPCS"     - HCPCS
 ;        "DATE&TIME" - DATE&TIME
 ;        "SEQUENCE"  - SEQUENCE
 ;        ""          - All records
 ;
 ; XSHIDS x-ref:
 ;    RMPR("STATION")
 ;    RMPR("HCPCS")
 ;    RMPR("ITEM")
 ;    RMPR("DATE&TIME")
 ;    RMPR("SEQUENCE")
 ;    Set RMPRLEV to...
 ;        "STATION"
 ;        "HCPCS"
 ;        "ITEM"
 ;        "DATE&TIME"
 ;        "SEQUENCE"
 ;        ""
NEXT(RMPR,RMPRXREF,RMPRLEV,RMPRT,RMPROLD,RMPREOF) ;
 N RMPRRET,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6,RMPRK7
 I $G(RMPRT)'=-1 S RMPRT=1
 S RMPRRET=0,RMPREOF=0
 ;
 ; HCPCS, Date&Time, Sequence X-ref
 I RMPRXREF="XHDS" D  G NEXTX
 . S RMPRK1=$G(RMPR("HCPCS"))
 . S RMPRK2=$G(RMPR("DATE&TIME"))
 . S RMPRK3=$G(RMPR("SEQUENCE"))
 . S RMPRK4=$G(RMPR("IEN"))
 . I RMPRLEV="HCPCS" D  Q:RMPREOF
 .. S RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT)
 .. I RMPRK1="" S RMPREOF=1 K RMPROLD Q
 .. S (RMPRK2,RMPRK3,RMPRK4)=""
 .. Q
 . I RMPRLEV="DATE&TIME",RMPRK1'="" D
 .. S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S RMPREOF=1
 .. S (RMPRK3,RMPRK4)=""
 .. Q
 . I RMPRLEV="SEQUENCE",RMPRK2'="" D
 .. S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S RMPREOF=1
 .. S RMPRK4=""
 .. Q
 . I RMPRLEV="",RMPRK3'="" D
 .. S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4),RMPRT)
 .. I RMPRK4="" S RMPREOF=1
 .. Q
 . K RMPROLD
 . I RMPREOF D
 .. I RMPRK4="" S:RMPRK3'="" RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S:RMPRK2'="" RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S:RMPRK1'="" RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT) S:RMPRK1="" RMPREOF=1
 .. Q
 . I RMPRK1="",RMPREOF Q
 . S RMPREOF=0
 . M RMPROLD=RMPR
 . I RMPRK1="" S RMPRK1=$O(^RMPR(661.7,RMPRXREF,""),RMPRT)
 . Q:RMPRK1=""
 . I RMPRK2="" S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,""),RMPRT)
 . Q:RMPRK2=""
 . I RMPRK3="" S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,""),RMPRT)
 . Q:RMPRK3=""
 . I RMPRK4="" S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,""),RMPRT)
 . S RMPR("HCPCS")=RMPRK1
 . S RMPR("DATE&TIME")=RMPRK2
 . S RMPR("SEQUENCE")=RMPRK3
 . S RMPR("IEN")=RMPRK4
 . Q
 ;
 ; Station, HCPCS, Item, Date&Time, Sequence X-ref.
 I RMPRXREF="XSHIDS" D  G NEXTX
 . S (RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6)=""
 . S RMPRK1=$G(RMPR("STATION"))
 . S:RMPRK1'="" RMPRK2=$G(RMPR("HCPCS"))
 . S:RMPRK2'="" RMPRK3=$G(RMPR("ITEM"))
 . S:RMPRK3'="" RMPRK4=$G(RMPR("DATE&TIME"))
 . S:RMPRK4'="" RMPRK5=$G(RMPR("SEQUENCE"))
 . S:RMPRK5'="" RMPRK6=$G(RMPR("IEN"))
 . I RMPRLEV="STATION" D  Q:RMPREOF
 .. S RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT)
 .. I RMPRK1="" S RMPREOF=1 K RMPROLD Q
 .. S (RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6)=""
 .. Q
 . I RMPRLEV="HCPCS",RMPRK1'="" D
 .. S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S RMPREOF=1
 .. S (RMPRK3,RMPRK4,RMPRK5,RMPRK6)=""
 .. Q
 . I RMPRLEV="ITEM",RMPRK2'="" D
 .. S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S RMPREOF=1
 .. S (RMPRK4,RMPRK5,RMPRK6)=""
 .. Q
 . I RMPRLEV="DATE&TIME",RMPRK3'="" D
 .. S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4),RMPRT)
 .. I RMPRK4="" S RMPREOF=1
 .. S (RMPRK5,RMPRK6)=""
 .. Q
 . I RMPRLEV="SEQUENCE",RMPRK4'="" D
 .. S RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5),RMPRT)
 .. I RMPRK5="" S RMPREOF=1
 .. S RMPRK6=""
 .. Q
 . I RMPRLEV="",RMPRK5'="" D
 .. S RMPRK6=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6),RMPRT)
 .. I RMPRK6="" S RMPREOF=1
 .. Q
 . K RMPROLD
 . I RMPREOF D
 .. I RMPRK6="" S:RMPRK5'="" RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5),RMPRT)
 .. I RMPRK5="" S:RMPRK4'="" RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4),RMPRT)
 .. I RMPRK4="" S:RMPRK3'="" RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S:RMPRK2'="" RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S:RMPRK1'="" RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT) S:RMPRK1="" RMPREOF=1
 .. Q
 . I RMPRK1="",RMPREOF Q
 . S RMPREOF=0
 . M RMPROLD=RMPR
 . I RMPRK1="" S RMPRK1=$O(^RMPR(661.7,RMPRXREF,""),RMPRT) I RMPRK1="" S RMPREOF=1 Q
 . I RMPRK2="" S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,""),RMPRT) I RMPRK2="" S RMPREOF=1 Q
 . I RMPRK3="" S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,""),RMPRT) I RMPRK3="" S RMPREOF=1 Q
 . I RMPRK4="" S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,""),RMPRT) I RMPRK4="" S RMPREOF=1 Q
 . I RMPRK5="" S RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,""),RMPRT) I RMPRK5="" S RMPREOF=1 Q
 . I RMPRK6="" S RMPRK6=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,""),RMPRT) I RMPRK6="" S RMPREOF=1 Q
 . S RMPR("STATION")=RMPRK1
 . S RMPR("HCPCS")=RMPRK2
 . S RMPR("ITEM")=RMPRK3
 . S RMPR("DATE&TIME")=RMPRK4
 . S RMPR("SEQUENCE")=RMPRK5
 . S RMPR("IEN")=RMPRK6
 . Q
 ;
 ; Station, Location, HCPCS, Item, Date&Time, Sequence
 I RMPRXREF="XSLHIDS" D  G NEXTX
 . S (RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6,RMPRK7)=""
 . S RMPRK1=$G(RMPR("STATION"))
 . S:RMPRK1'="" RMPRK2=$G(RMPR("LOCATION"))
 . S:RMPRK2'="" RMPRK3=$G(RMPR("HCPCS"))
 . S:RMPRK3'="" RMPRK4=$G(RMPR("ITEM"))
 . S:RMPRK4'="" RMPRK5=$G(RMPR("DATE&TIME"))
 . S:RMPRK5'="" RMPRK6=$G(RMPR("SEQUENCE"))
 . S:RMPRK6'="" RMPRK7=$G(RMPR("IEN"))
 . I RMPRLEV="STATION" D  Q:RMPREOF
 .. S RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT)
 .. I RMPRK1="" S RMPREOF=1 K RMPROLD Q
 .. S (RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6,RMPRK7)=""
 .. Q
 . I RMPRLEV="LOCATION",RMPRK1'="" D
 .. S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S RMPREOF=1
 .. S (RMPRK3,RMPRK4,RMPRK5,RMPRK6,RMPRK7)=""
 .. Q
 . I RMPRLEV="HCPCS",RMPRK2'="" D
 .. S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S RMPREOF=1
 .. S (RMPRK4,RMPRK5,RMPRK6,RMPRK7)=""
 .. Q
 . I RMPRLEV="ITEM",RMPRK3'="" D
 .. S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4),RMPRT)
 .. I RMPRK4="" S RMPREOF=1
 .. S (RMPRK5,RMPRK6,RMPRK7)=""
 .. Q
 . I RMPRLEV="DATE&TIME",RMPRK4'="" D
 .. S RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5),RMPRT)
 .. I RMPRK5="" S RMPREOF=1
 .. S (RMPRK6,RMPRK7)=""
 .. Q
 . I RMPRLEV="SEQUENCE",RMPRK5'="" D
 .. S RMPRK6=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6),RMPRT)
 .. I RMPRK6="" S RMPREOF=1
 .. S RMPRK7=""
 .. Q
 . I RMPRLEV="",RMPRK6'="" D
 .. S RMPRK7=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6,RMPRK7),RMPRT)
 .. I RMPRK7="" S RMPREOF=1
 .. Q
 . K RMPROLD
 . I RMPREOF D
 .. I RMPRK7="" S:RMPRK6'="" RMPRK6=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6),RMPRT)
 .. I RMPRK6="" S:RMPRK5'="" RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5),RMPRT)
 .. I RMPRK5="" S:RMPRK4'="" RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4),RMPRT)
 .. I RMPRK4="" S:RMPRK3'="" RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3),RMPRT)
 .. I RMPRK3="" S:RMPRK2'="" RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2),RMPRT)
 .. I RMPRK2="" S:RMPRK1'="" RMPRK1=$O(^RMPR(661.7,RMPRXREF,RMPRK1),RMPRT) S:RMPRK1="" RMPREOF=1
 .. Q
 . I RMPRK1="",RMPREOF Q
 . S RMPREOF=0
 . M RMPROLD=RMPR
 . I RMPRK1="" S RMPRK1=$O(^RMPR(661.7,RMPRXREF,""),RMPRT) I RMPRK1="" S RMPREOF=1 Q
 . I RMPRK2="" S RMPRK2=$O(^RMPR(661.7,RMPRXREF,RMPRK1,""),RMPRT) I RMPRK2="" S RMPREOF=1 Q
 . I RMPRK3="" S RMPRK3=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,""),RMPRT) I RMPRK3="" S RMPREOF=1 Q
 . I RMPRK4="" S RMPRK4=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,""),RMPRT) I RMPRK4="" S RMPREOF=1 Q
 . I RMPRK5="" S RMPRK5=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,""),RMPRT) I RMPRK5="" S RMPREOF=1 Q
 . I RMPRK6="" S RMPRK6=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,""),RMPRT) I RMPRK6="" S RMPREOF=1 Q
 . I RMPRK7="" S RMPRK7=$O(^RMPR(661.7,RMPRXREF,RMPRK1,RMPRK2,RMPRK3,RMPRK4,RMPRK5,RMPRK6,""),RMPRT) I RMPRK7="" S RMPREOF=1 Q
 . S RMPR("STATION")=RMPRK1
 . S RMPR("LOCATION")=RMPRK2
 . S RMPR("HCPCS")=RMPRK3
 . S RMPR("ITEM")=RMPRK4
 . S RMPR("DATE&TIME")=RMPRK5
 . S RMPR("SEQUENCE")=RMPRK6
 . S RMPR("IEN")=RMPRK7
 . Q
NEXTX Q RMPRRET