Index: FOIAVistA/tag/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR2.m
===================================================================
--- FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR2.m	(revision 631)
+++ FOIAVistA/tag/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR2.m	(revision 636)
@@ -1,4 +1,4 @@
-HLOUSR2 ;ALB/CJM -ListManager Screen for viewing messages(continued);12 JUN 1997 10:00 am ;07/17/2007
- ;;1.6;HEALTH LEVEL SEVEN;**126,134,137**;Oct 13, 1995;Build 21
+HLOUSR2 ;ALB/CJM -ListManager Screen for viewing messages(continued);12 JUN 1997 10:00 am ;03/19/2007
+ ;;1.6;HEALTH LEVEL SEVEN;**126,134**;Oct 13, 1995;Build 30
  ;Per VHA Directive 2004-038, this routine should not be modified
  ;
@@ -8,5 +8,6 @@
  Q
  ;
-SHOWLIST ;
+SHOWLIST(TYPE) ;
+ ;TYPE= "SE", "AE", "TF"
  N PARMS,I,ERRCOUNT
  S (VALMBG,VALMCNT,I,ERRCOUNT)=0
@@ -17,11 +18,11 @@
  .N APP
  .S APP=""
- .F  S APP=$O(^HLB("ERRORS",APP)) Q:APP=""  D  Q:ERRCOUNT>PARMS("MAX")
+ .F  S APP=$O(^HLB("ERRORS",TYPE,APP)) Q:APP=""  D  Q:ERRCOUNT>PARMS("MAX")
  ..N TIME,IEN
  ..S TIME=PARMS("START")
- ..Q:($O(^HLB("ERRORS",APP,TIME))="")
+ ..Q:($O(^HLB("ERRORS",TYPE,APP,TIME))="")
  ..S @VALMAR@($$I,0)="Application: "_APP
  ..D CNTRL^VALM10(VALMCNT,14,$L(APP),IOINHI,IOINORM)
- ..F  S TIME=$O(^HLB("ERRORS",APP,TIME)) Q:'TIME  Q:ERRCOUNT>PARMS("MAX")  S IEN="" F  S IEN=$O(^HLB("ERRORS",APP,TIME,IEN)) Q:IEN=""  D ADDTO(IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
+ ..F  S TIME=$O(^HLB("ERRORS",TYPE,APP,TIME)) Q:'TIME  Q:ERRCOUNT>PARMS("MAX")  S IEN="" F  S IEN=$O(^HLB("ERRORS",TYPE,APP,TIME,IEN)) Q:IEN=""  D ADDTO(TYPE,IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
  E  D
  .N APP
@@ -29,40 +30,44 @@
  .N TIME,IEN
  .S TIME=PARMS("START")
- .Q:$O(^HLB("ERRORS",APP,TIME))=""
+ .Q:$O(^HLB("ERRORS",TYPE,APP,TIME))=""
  .S @VALMAR@($$I,0)="Application: "_APP
  .D CNTRL^VALM10(VALMCNT,14,$L(APP),IOINHI,IOINORM)
- .F  S TIME=$O(^HLB("ERRORS",APP,TIME)) Q:'TIME  Q:ERRCOUNT>PARMS("MAX")  S IEN="" F  S IEN=$O(^HLB("ERRORS",APP,TIME,IEN)) Q:IEN=""  D ADDTO(IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
+ .F  S TIME=$O(^HLB("ERRORS",TYPE,APP,TIME)) Q:'TIME  Q:ERRCOUNT>PARMS("MAX")  S IEN="" F  S IEN=$O(^HLB("ERRORS",TYPE,APP,TIME,IEN)) Q:IEN=""  D ADDTO(TYPE,IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
  ;
 SHOW S VALMBCK="R"
  ;
  Q
-ADDTO(IEN,TIME,ERRCOUNT) ;
+ADDTO(LTYPE,IEN,TIME,ERRCOUNT) ;
  N NODE,MSG
  Q:'$$GETMSG^HLOMSG(+IEN,.MSG)
  S ERRCOUNT=ERRCOUNT+1
- ;application errors could be an error to a msg within a batch
- ;also, need to go to the ack msg to get the error text from the MSA segment
- ;
- N SUBIEN,MSA,ERRTEXT
- S (ERRTEXT,MSA)=""
- S SUBIEN=$P(IEN,"^",2)
- ;within batch?
- D:SUBIEN GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
- S ERRTEXT=MSG("STATUS","ERROR TEXT")
- I ERRTEXT="",MSG("ACK BY")]"",($$FINDMSG^HLOMSG1(MSG("ACK BY"),.LIST)=1) D
- .N MSG,SEG,FS,AIEN
- .S AIEN=+LIST(1),SUBIEN=$P(LIST(1),"^",2)
- .Q:'$$GETMSG^HLOMSG(AIEN,.MSG)
- .I SUBIEN S MSG("BATCH","CURRENT MESSAGE")=SUBIEN,MSG("LINE COUNT")=0
- .F  Q:'$$HLNEXT^HLOMSG(.MSG,.SEG)  I $E(SEG(1),1,3)="MSA" S MSA=SEG(1),FS=$E(MSA,4),ERRTEXT=$P(MSA,FS,4) Q
- I ERRTEXT="",MSG("ACK BY")="" D
- .N FS
- .S FS=$E(MSG("HDR",1),4)
- .I $L(FS) S ERRTEXT=$P($G(MSG("STATUS","ACCEPT ACK MSA")),FS,4)
- S @VALMAR@($$I,0)="  "_$$LJ(MSG("ID"),15)_$$LJ(MSG("MESSAGE TYPE")_"~"_MSG("EVENT"),8)_$$LJ($$FMTE^XLFDT(MSG("DT/TM CREATED"),2),20)_$E(ERRTEXT,1,35)
- D CNTRL^VALM10(VALMCNT,3,15,IOINHI,IOINORM)
- I $L(ERRTEXT)>35 D
- .S @VALMAR@($$I,0)=$$RJ(" ",45)_$E(ERRTEXT,36,115)
- S:MSG("ID")]"" @VALMAR@("INDEX",MSG("ID"))=IEN
+ I LTYPE'="AE" D
+ .N TYPE
+ .S TYPE=$S(MSG("BATCH"):"BATCH",1:MSG("MESSAGE TYPE")_"~"_MSG("EVENT"))
+ .S @VALMAR@($$I,0)="  "_$$LJ(MSG("ID"),15)_$$LJ(TYPE,8)_$$LJ($$FMTE^XLFDT(TIME,2),20)_MSG("STATUS","ERROR TEXT")
+ .D CNTRL^VALM10(VALMCNT,3,15,IOINHI,IOINORM)
+ .S:MSG("ID")]"" @VALMAR@("INDEX",MSG("ID"))=IEN
+ E  D
+ .;application errors - could be an error to a msg within a batch
+ .;also, need to go to the ack msg to get the error text from the MSA segment
+ .;
+ .N SUBIEN,MSA,ERRTEXT
+ .S (ERRTEXT,MSA)=""
+ .S SUBIEN=$P(IEN,"^",2)
+ .;within batch?
+ .D:SUBIEN GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
+ .S ERRTEXT=MSG("STATUS","ERROR TEXT")
+ .I ERRTEXT="",MSG("ACK BY")]"",($$FINDMSG^HLOMSG1(MSG("ACK BY"),.LIST)=1) D
+ ..N MSG,SEG,FS,AIEN
+ ..S AIEN=+LIST(1),SUBIEN=$P(LIST(1),"^",2)
+ ..Q:'$$GETMSG^HLOMSG(AIEN,.MSG)
+ ..I SUBIEN S MSG("BATCH","CURRENT MESSAGE")=SUBIEN,MSG("LINE COUNT")=0
+ ..F  Q:'$$HLNEXT^HLOMSG(.MSG,.SEG)  I $E(SEG(1),1,3)="MSA" S MSA=SEG(1),FS=$E(MSA,4),ERRTEXT=$P(MSA,FS,4) Q
+ .S @VALMAR@($$I,0)="  "_$$LJ(MSG("ID"),15)_$$LJ(MSG("MESSAGE TYPE")_"~"_MSG("EVENT"),8)_$$LJ($$FMTE^XLFDT(MSG("DT/TM CREATED"),2),20)_$E(ERRTEXT,1,37)
+ .D CNTRL^VALM10(VALMCNT,3,15,IOINHI,IOINORM)
+ .I $L(ERRTEXT)>37 D
+ ..S @VALMAR@($$I,0)="~"_$E(ERRTEXT,38,112)
+ ..D CNTRL^VALM10(VALMCNT,1,1,IORVON,IORVOFF)
+ .S:MSG("ID")]"" @VALMAR@("INDEX",MSG("ID"))=IEN
  Q
  ;
@@ -95,6 +100,8 @@
  N DIR
  S DIR(0)="F^3:60"
- S DIR("A")="Receiving Application"
+ S DIR("A")="Application"
  S DIR("?")="Enter the full name of the application, or '^' to exit."
+ S DIR("?",1)="For transmission failures, enter the sending application. "
+ S DIR("?",2)="For other errors, enter the name of the receiving application. "
  D ^DIR
  I $D(DIRUT)!(Y="") Q ""
@@ -221,6 +228,4 @@
 LJ(STRING,LEN) ;
  Q $$LJ^XLFSTR(STRING,LEN)
-RJ(STRING,LEN) ;
- Q $$RJ^XLFSTR(STRING,LEN)
  ;
 I() ;
