ABME8CAS ; IHS/ASDST/DMJ - 837 CAS Segment
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;Transaction Set Header
;
; IHS/SD/SDR - v2.5 p13 - IM25471
; Added code for CO when SAR=A2
;
EP ;EP - START HERE
; for consistency with other routines
K ABMREC("CAS"),ABMR("CAS")
S ABME("RTYPE")="CAS"
S ABMCNT=1
D LOOP
K ABME,ABM
Q
LOOP ;LOOP HERE
F I=10:10:200 D
.D @I
.I $D(^ABMEXLM("AA",+$G(ABMP("INS")),+$G(ABMP("EXP")),ABME("RTYPE"),I)) D @(^(I))
.I $G(ABMREC("CAS"))'="" S ABMREC("CAS")=ABMREC("CAS")_"*"
.S ABMREC("CAS")=$G(ABMREC("CAS"))_ABMR("CAS",I)
Q
10 ;segment
S ABMR("CAS",10)="CAS"
Q
20 ;CAS01 - Claim Adjustment Group Code
S ABMR("CAS",20)=""
S ABMR("CAS",20)=ABML
Q
30 ;CAS02 - Claim Adjustment Reason Code
S ABMR("CAS",30)=""
S ABMR("CAS",30)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
40 ;CAS03 - Monetary Amount
S ABMR("CAS",40)=""
S ABMR("CAS",40)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
50 ;CAS04 - Quantity
S ABMR("CAS",50)=""
S ABMR("CAS",50)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
60 ;CAS05 - Claim Adjustment Reason Code
S ABMR("CAS",60)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",60)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
70 ;CAS06 - Monetary Amount
S ABMR("CAS",70)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",70)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
80 ;CAS07 - Quantity
S ABMR("CAS",80)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",80)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
90 ;CAS08 - Claim Adjustment Reason Code
S ABMR("CAS",90)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",90)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
100 ;CAS09 - Monetary Amount
S ABMR("CAS",100)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",100)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
110 ;CAS10 - Quantity
S ABMR("CAS",110)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",110)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
120 ;CAS11 - Claim Adjustment Reason Code
S ABMR("CAS",120)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",120)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
130 ;CAS12 - Monetary Amount
S ABMR("CAS",130)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",130)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
140 ;CAS13 - Quantity
S ABMR("CAS",140)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",140)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
150 ;CAS14 - Claim Adjustment Reason Code
S ABMR("CAS",150)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",150)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
160 ;CAS15 - Monetary Amount
S ABMR("CAS",160)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",160)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
170 ;CAS16 - Quantity
S ABMR("CAS",170)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",170)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
180 ;CAS17 - Claim Adjustment Reason Code
S ABMR("CAS",180)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",180)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U)
Q
190 ;CAS18 - Monetary Amount
S ABMR("CAS",190)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",190)=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
I ABML="PR" S ABMF2AMT=$FN($P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
Q
200 ;CAS19 - Quantity
S ABMR("CAS",200)=""
Q:'$D(ABMP(+ABMLINE,ABML,ABMCNT))
S ABMR("CAS",200)=$P($G(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
S ABMCNT=ABMCNT+1
Q
ABME8CAS ; IHS/ASDST/DMJ - 837 CAS Segment
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;Transaction Set Header
+3 ;
+4 ; IHS/SD/SDR - v2.5 p13 - IM25471
+5 ; Added code for CO when SAR=A2
+6 ;
EP ;EP - START HERE
+1 ; for consistency with other routines
+2 KILL ABMREC("CAS"),ABMR("CAS")
+3 SET ABME("RTYPE")="CAS"
+4 SET ABMCNT=1
+5 DO LOOP
+6 KILL ABME,ABM
+7 QUIT
LOOP ;LOOP HERE
+1 FOR I=10:10:200
Begin DoDot:1
+2 DO @I
+3 IF $DATA(^ABMEXLM("AA",+$GET(ABMP("INS")),+$GET(ABMP("EXP")),ABME("RTYPE"),I))
DO @(^(I))
+4 IF $GET(ABMREC("CAS"))'=""
SET ABMREC("CAS")=ABMREC("CAS")_"*"
+5 SET ABMREC("CAS")=$GET(ABMREC("CAS"))_ABMR("CAS",I)
End DoDot:1
+6 QUIT
10 ;segment
+1 SET ABMR("CAS",10)="CAS"
+2 QUIT
20 ;CAS01 - Claim Adjustment Group Code
+1 SET ABMR("CAS",20)=""
+2 SET ABMR("CAS",20)=ABML
+3 QUIT
30 ;CAS02 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",30)=""
+2 SET ABMR("CAS",30)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+3 QUIT
40 ;CAS03 - Monetary Amount
+1 SET ABMR("CAS",40)=""
+2 SET ABMR("CAS",40)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+3 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 QUIT
50 ;CAS04 - Quantity
+1 SET ABMR("CAS",50)=""
+2 SET ABMR("CAS",50)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+3 SET ABMCNT=ABMCNT+1
+4 QUIT
60 ;CAS05 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",60)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",60)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+4 QUIT
70 ;CAS06 - Monetary Amount
+1 SET ABMR("CAS",70)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",70)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+5 QUIT
80 ;CAS07 - Quantity
+1 SET ABMR("CAS",80)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",80)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+4 SET ABMCNT=ABMCNT+1
+5 QUIT
90 ;CAS08 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",90)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",90)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+4 QUIT
100 ;CAS09 - Monetary Amount
+1 SET ABMR("CAS",100)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",100)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+5 QUIT
110 ;CAS10 - Quantity
+1 SET ABMR("CAS",110)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",110)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+4 SET ABMCNT=ABMCNT+1
+5 QUIT
120 ;CAS11 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",120)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",120)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+4 QUIT
130 ;CAS12 - Monetary Amount
+1 SET ABMR("CAS",130)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",130)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+5 QUIT
140 ;CAS13 - Quantity
+1 SET ABMR("CAS",140)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",140)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+4 SET ABMCNT=ABMCNT+1
+5 QUIT
150 ;CAS14 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",150)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",150)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+4 QUIT
160 ;CAS15 - Monetary Amount
+1 SET ABMR("CAS",160)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",160)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+5 QUIT
170 ;CAS16 - Quantity
+1 SET ABMR("CAS",170)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",170)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+4 SET ABMCNT=ABMCNT+1
+5 QUIT
180 ;CAS17 - Claim Adjustment Reason Code
+1 SET ABMR("CAS",180)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",180)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U)
+4 QUIT
190 ;CAS18 - Monetary Amount
+1 SET ABMR("CAS",190)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",190)=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+4 IF ABML="PR"
SET ABMF2AMT=$FNUMBER($PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,2),"-")
+5 QUIT
200 ;CAS19 - Quantity
+1 SET ABMR("CAS",200)=""
+2 IF '$DATA(ABMP(+ABMLINE,ABML,ABMCNT))
QUIT
+3 SET ABMR("CAS",200)=$PIECE($GET(ABMP(+ABMLINE,ABML,ABMCNT)),U,3)
+4 SET ABMCNT=ABMCNT+1
+5 QUIT