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

ABSPOSAY.m

Go to the documentation of this file.
  1. ABSPOSAY ; IHS/FCS/DRS - Packet print utils ; [ 09/12/2002 10:07 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
  1. ;---------------------------------------------------------------------
  1. Q
  1. ;
  1. ; D DUMPLAST ; look at most recent response and associated claim.
  1. ;
  1. ; D DUMPN(pointer to 9002313.02) prints claim and response both
  1. ;
  1. ; Development and low-level support utilities
  1. ; Most useful callable entry points are:
  1. ; PRINT02(pointer to 9002313.02)
  1. ; PRINT03(pointer to 9002313.03)
  1. ; DIAGPRT(string) to print diagram in pretty formatted form
  1. ;
  1. ;
  1. DUMPLAST ; Print the most recently-received claim-response pair
  1. N IEN03 S IEN03=$P(^ABSPR(0),U,3)
  1. N IEN02 S IEN02=$P(^ABSPR(IEN03,0),U)
  1. D PRINT02(IEN02),PRINT03(IEN03)
  1. Q
  1. ;
  1. ;
  1. DUMP(REQ) ; given REQ = ien or ID of request packet, do the whole thing
  1. I REQ'?1N.N D Q:REQ=""
  1. . S REQ=$O(^ABSPC("B",REQ,0))
  1. D PRINT02(REQ)
  1. N IEN03 S IEN03=$O(^ABSPR("B",REQ,""),-1) ; most recent response!
  1. I IEN03 D PRINT03(IEN03)
  1. Q
  1. ;
  1. ; Useful entry points now that we retain raw packet in 9002313.02,.03
  1. ; (earlier versions just saved the one single most recent packet)
  1. ;
  1. PRINT02(N) ;EP - dump of a claim packet
  1. D PRINT0X(9002313.02,N) Q
  1. PRINT03(N) ;EP - dump of a response packet
  1. D PRINT0X(9002313.03,N) Q
  1. PRINT0X(FILE,N) ; dump of a claim or response, given file number and IEN
  1. I FILE=9002313.02 D
  1. . W "Claim `",N," ",$P(^ABSPC(N,0),U)
  1. . N X S X=$P(^ABSPC(N,0),U,5)
  1. . I X W " transmitted ",X
  1. . S X=$P(^ABSPC(N,0),U,6)
  1. . I X W " created ",X
  1. E W "Response `",N," received ",$P(^ABSPR(N,0),U,2)
  1. N PKT S PKT=$$GETPKT(FILE,N)
  1. D DIAGPRT(PKT)
  1. Q
  1. GETPKT(FILE,N) ; reassemble
  1. N X,ROOT
  1. S X="",ROOT="^ABSP"_$S(FILE=9002313.02:"C",FILE=9002313.03:"R")
  1. F I=1:1:$P(@ROOT@(N,"M",0),U,3) D
  1. . S X=X_@ROOT@(N,"M",I,0)
  1. Q X
  1. ;
  1. ; DIAGPRT(string) to print the given string in a pretty formatted way
  1. ;
  1. DIAGPRT(A) ;
  1. N I,J,K,X
  1. I $E(A)=$C(2) S A=$E(A,2,$L(A))
  1. I $E(A,1,3)="HN."!($E(A,1,3)="HN*") S A=$E(A,4,$L(A))
  1. F I=1:15:$L(A) D
  1. .W !,$J(I,4),"/ "
  1. .F J=0:1:14 S K=I+J Q:K>$L(A) S X=$E(A,K) D
  1. ..I X=" " W " ","sp"," "
  1. ..E I X?1ANP W " ","'",X,"'"
  1. ..E W $J($A(X),4)
  1. W ! Q