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

ABSPOSCF.m

Go to the documentation of this file.
  1. ABSPOSCF ; IHS/FCS/DRS - Low-level format of .02 ; [ 12/02/2002 2:54 PM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3,23,39**;JUN 21, 2001;Build 38
  1. ;
  1. ; This routine will read the formats file. As it reads a field
  1. ; from the formats file, it will execute the needed get, format,
  1. ; and set code from the ABSP NCPDP Field Defs dictionary. Please
  1. ; note that for 5.1, we will use the 5.1 format code from within
  1. ; the Field Defs dictionary. Also please note that the Set code
  1. ; will "set" the value into the ABSP Claims file.
  1. ;
  1. ; Note: The only external entry point is XLOOP, below.
  1. ; It is called only
  1. ; from ABSPOSCE from ABSPOSCA from ABSPOSQG from ABSPOSQ2
  1. ;
  1. ; For 3.2 claims this routine is called four times with
  1. ; NODE=10, 20, 30, 40,
  1. ; for Claim Header Required and then Claim Header Optional,
  1. ; then Claim Data Required and Claim Data Optional, in that order
  1. ;
  1. ; FORMAT is a pointer to 9002313.92
  1. ; NODE = 10, 20, 30, 40 field in the format's record
  1. ; MEDN, pointer into ABSP("RX",*,...) appears only when NODE=30, 40
  1. ;
  1. ; IHS/SD/lwj 8/1/02 NCPDP 5.1 changes
  1. ; For 5.1 the call is made fourteen times, with NODES=100 thru 230
  1. ; The one time segments are the 100, 110, and 120 segments,
  1. ; all other segments could repeat depending on the number
  1. ; of prescriptions on a claim.
  1. ;
  1. ; FORMAT is a pointer to 9002313.92
  1. ; NODE = 100 (5.1 Transaction Header Segment)
  1. ; 110 (5.1 Patient Segment)
  1. ; 120 (5.1 Insurance Segment)
  1. ; 130 (5.1 Claim Segment)
  1. ; 140 (5.1 Pharmacy Provider Segment)
  1. ; 150 (5.1 Prescriber Segment)
  1. ; 160 (5.1 COB/Other Payments Segment)
  1. ; 170 (5.1 Worker's Compensation Segment)
  1. ; 180 (5.1 DUR/PPS Segment)
  1. ; 190 (5.1 Pricing Segment)
  1. ; 200 (5.1 Coupon Segment)
  1. ; 210 (5.1 Compound Segment)
  1. ; 220 (5.1 Prior Authorization Segment)
  1. ; 230 (5.1 Clinical Segment)
  1. ; MEDN set to reflect the prescription for nodes 130 - 230
  1. ;
  1. ; For 5.1 there is only one significant change to this routine -
  1. ; the values used in the NODE field in the XFLDCODE subroutine
  1. ; will be now based on the version of claim we are processing.
  1. ; For 3.2 claims, we will process the 10, 20, and 30 nodes from
  1. ; from the NCPDP Field defs dictionary.
  1. ; For 5.1, we will process 10, 25 and 30.
  1. ;
  1. ; Another change - in 3.2 there would always be fields in the
  1. ; hdr req, hdr opt, det req, and det opt segments - that is no
  1. ; longer true with 5.1 - segments will not also have a fields to
  1. ; print.
  1. ;
  1. ; MAJOR change - in 3.2 there were no repeating fields - in 5.1
  1. ; there are lots of them spread across 4 segments. These fields
  1. ; offer us a special challenge as they must be stored in a multiple
  1. ; and that gives us yet one more index to keep track of.
  1. ; At the onset of 5.1, IHS was not ready to use the repeating fields
  1. ; in the claim segment (procedures), the COB/Other payment segment
  1. ; (payer specific fields, payer amount, and pay reject information)
  1. ; and the Pricing Segment (other amount claimed submitted).
  1. ; Because of time, these repeating fields are not being addressed
  1. ; in V1.0 P3, but in order to pass PCS certification, we did
  1. ; have to address the repeating fields on the DUR/PPS Segment
  1. ; (the entire record is repeating). Chances are extremely slim
  1. ; that the fields in this repeating section are ones that IHS will
  1. ; need at first, so it's possible we may need to rework the logic
  1. ; a little when they actually start to use the repeating fields.
  1. ;
  1. ;IHS/SD/RLT - 06/21/07 - 10/18/07 - Patch 23
  1. ; DIAGNOSIS CODE in CLINICAL segment.
  1. ;
  1. XLOOP(FORMAT,NODE,MEDN) ;EP
  1. N ORDER,RECMIEN,MDATA,FLDIEN,PMODE,FLAG
  1. ;
  1. ;IHS/SD/lwj 8/1/02 for 5.1, segments won't always be defined-just quit
  1. Q:(ABSP("NCPDP","Version")[5)&('$D(^ABSPF(9002313.92,FORMAT,NODE,0)))
  1. ;
  1. ;IHS/SD/lwj 8/20/01 for 5.1 segment 180 is the DUR/PPS segment
  1. ; this is a repeating field segment, and must be handled differently
  1. ; than the regular sections
  1. I NODE=180 D DURPPS^ABSPOSHF(FORMAT,NODE,MEDN) Q
  1. ;
  1. ;IHS/SD/RLT - 06/21/07 - 10/18/07 - Patch 23
  1. ; DIAGNOSIS CODE in CLINICAL segment
  1. I NODE=230 D DIAG^ABSPOSHF(FORMAT,NODE,MEDN) Q
  1. ;
  1. I '$D(^ABSPF(9002313.92,FORMAT,NODE,0)) D IMPOSS^ABSPOSUE("DB,P","TI","FORMAT="_FORMAT,"NODE="_NODE,1,$T(+0))
  1. ;
  1. S ORDER=0
  1. F D Q:'ORDER
  1. .S ORDER=$O(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER)) Q:'ORDER
  1. .S RECMIEN=$O(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER,0))
  1. .I 'RECMIEN D IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"ORDER="_ORDER,2,$T(+0))
  1. .S MDATA=^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,0)
  1. .S FLDIEN=$P(MDATA,U,2)
  1. .I 'FLDIEN D IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"RECMIEN="_RECMIEN,3,$T(+0)) ; corrupt or erroneous format file
  1. .S PMODE=$P(MDATA,U,3)
  1. .I PMODE="" S PMODE="S" ;default it
  1. .;/IHS/OIT/CNI/RAN 06042010 Patch 39 Changes at Emdeon mean we can now use special code for field 104 BEGIN commenting out
  1. .;I PMODE="X",$P(^ABSPF(9002313.91,FLDIEN,0),U)=104 D
  1. .;. ; Processor control number is different for Envoy
  1. .;. ; It's always the Envoy Terminal ID, regardless of payor
  1. .;. ; The XECUTE special code is only for non-Envoy
  1. .;. ; Change it to "standard" mode for Envoy
  1. .;. ;I ABSP("Site","Switch Type")="ENVOY" S PMODE="S"
  1. .;/IHS/OIT/CNI/RAN 06042010 Patch 39 Changes at Emdeon mean we can now use special code for field 104 END commenting out
  1. . S FLAG=$S(PMODE="S":"GFS",1:"FS")
  1. . ; Apply any override values, as needed.
  1. . N OVERRIDE ; the override value, if any
  1. . I $D(MEDN) D ; for a prescription detail
  1. . . I $D(ABSP("OVERRIDE","RX",MEDN,FLDIEN)) D
  1. . . . S OVERRIDE=ABSP("OVERRIDE","RX",MEDN,FLDIEN)
  1. . E D ; for patient/header info
  1. . . I $D(ABSP("OVERRIDE",FLDIEN)) D
  1. . . . S OVERRIDE=ABSP("OVERRIDE",FLDIEN)
  1. . ; ABSP("X") is the field value as it's being computed
  1. . S ABSP("X")=""
  1. . I PMODE="X" D ; special Xecute code, in lieu of the field's Get code
  1. . . I $D(OVERRIDE) S ABSP("X")=OVERRIDE
  1. . . E D XSPCCODE(FORMAT,NODE,RECMIEN)
  1. . I $D(OVERRIDE) D
  1. . . D XFLDCODE(FLDIEN,FLAG,OVERRIDE)
  1. . E D
  1. . . D XFLDCODE(FLDIEN,FLAG)
  1. Q
  1. ;Execute Get, Format and/or Set MUMPS code for a NCPDP Field
  1. ;
  1. ;Parameters: FLDIEN - NCPDP Field Definitions IEN
  1. ; FLAG - If variable contains:
  1. ; "G" - Execute Get Code
  1. ; "F" - Execute Format Code
  1. ; "S" - Execute S Code
  1. ; OVERRIDE - if defined, it's used instead of Get Code
  1. ;---------------------------------------------------------------------
  1. XFLDCODE(FLDIEN,FLAG,OVERRIDE) ;EP
  1. ;Manage local variables
  1. ;IHS/SD/lwj 8/1/02 added logic to work with the 5.1 format
  1. ; code instead of the 3.2 format code. If the claim is for
  1. ; 5.1, we will loop with 10, 25, 30 and if it is 3.2 we will
  1. ; loop with 10, 20, 30.
  1. ;
  1. ; This subroutine was flagged as an entry point with the NCPDP
  1. ; 5.1 changes. The only call to this subroutine from outside
  1. ; of this program is done in ABSPOSHF.
  1. ;
  1. N NODE,INDEX,MCODE
  1. N FNODE ;IHS/SD/lwj 8/1/02 format node
  1. S FNODE=25 ;IHS/SD/lwj 8/1/02 default to 5.1 node
  1. ;
  1. ;I FLDIEN=50 W $T(+0) ZW FLDIEN ; temporary!!
  1. ;
  1. ;Check if record exist and FLAG variable is set correctly
  1. ; (Changed from Q: to give fatal error 10/18/2000)
  1. I 'FLDIEN D IMPOSS^ABSPOSUE("DB,P","TI","FLDIEN="_FLDIEN,,"XFLDCODE",$T(+0))
  1. I '$D(^ABSPF(9002313.91,FLDIEN,0)) D IMPOSS^ABSPOSUE("DB,P","TI","FLDIEN="_FLDIEN,,"XFLDCODE",$T(+0))
  1. I FLAG="" D IMPOSS^ABSPOSUE("DB,P","TI","FLAG null",,"XFLDCODE",$T(+0))
  1. ;
  1. ; IHS/SD/lwj 8/1/02 added next line of code
  1. I ABSP("NCPDP","Version")[3 S FNODE=20
  1. ;
  1. ;Loop through Get, Format and Set Code fields and execute code
  1. ;
  1. ; IHS/SD/lwj 8/1/02 nxt line remarked out - new line added
  1. ;F NODE=10,20,30 D
  1. F NODE=10,FNODE,30 D
  1. .;
  1. .; IHS/SD/lwj 8/21/02 nxt line remarked out- new line added
  1. .; Q:FLAG'[$S(NODE=10:"G",NODE=20:"F",NODE=30:"S",1:"")
  1. .Q:FLAG'[$S(NODE=10:"G",NODE=20:"F",NODE=25:"F",NODE=30:"S",1:"")
  1. .I '$D(^ABSPF(9002313.91,FLDIEN,NODE,0)) D IMPOSS^ABSPOSUE("DB","TI","FLDIEN="_FLDIEN,"NODE="_NODE,"XFLDCODE",$T(+0))
  1. . ;If value is being overridden, just take the override value & get out
  1. .I NODE=10,$D(OVERRIDE) S ABSP("X")=OVERRIDE Q
  1. .S INDEX=0
  1. .F D Q:'+INDEX
  1. ..S INDEX=$O(^ABSPF(9002313.91,FLDIEN,NODE,INDEX))
  1. ..Q:'+INDEX
  1. ..S MCODE=$G(^ABSPF(9002313.91,FLDIEN,NODE,INDEX,0))
  1. ..Q:MCODE=""
  1. ..Q:$E(MCODE,1)=";"
  1. ..X MCODE
  1. ..;I NODE=30 W $T(+0)," $ZR=",$ZR," ",@$ZR," ",$P(@$ZR,"^",43),! R ">>>",%,!
  1. Q
  1. ;----------------------------------------------------------------------
  1. ;Execute Special Code (for a NCPDP Field within a NCPDP Record)
  1. ;
  1. ;Parameters: FORMAT - NCPDP Record Format IEN (9002313.92)
  1. ; NODE - Global node value (10,20,30,40)
  1. ; RECMIEN - Field Multiple IEN
  1. ;---------------------------------------------------------------------
  1. XSPCCODE(FORMAT,NODE,RECMIEN) ;EP
  1. ;Manage local variables
  1. ;
  1. ; This subroutine was flagged as an entry point with the NCPDP
  1. ; 5.1 changes. The only call to this subroutine from outside
  1. ; of this program is done in ABSPOSHR.
  1. ;
  1. N INDEX,MCODE
  1. I '$D(^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,0)) D IMPOSS^ABSPOSUE("DB,P","TI","no special code there to XECUTE","FORMAT="_FORMAT,"XSPCCODE",$T(+0))
  1. ;
  1. S INDEX=0
  1. F D Q:'+INDEX
  1. .S INDEX=$O(^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,1,INDEX))
  1. .Q:'+INDEX
  1. .S MCODE=$G(^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,1,INDEX,0))
  1. .Q:MCODE=""
  1. .Q:$E(MCODE,1)=";"
  1. . ;
  1. .;
  1. . S ^BZHD(FORMAT,NODE,RECMIEN,1,INDEX)=MCODE
  1. . ;
  1. .X MCODE
  1. Q