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

IBCNGP1.m

Go to the documentation of this file.
  1. IBCNGP1 ;ALB/CKB - REPORT OF COVERAGE LIMITATIONS (COMPILE/PRINT) ; 07-OCT-2021
  1. ;;2.0;INTEGRATED BILLING;**702**;21-MAR-94;Build 53
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. COMPILE(IBCNGPRTN,IBCNGP) ; Entry Point called from EN^XUTMDEVQ.
  1. ; IBCNGPRTN = Routine name for ^TMP($J,...
  1. ; IBCNGP = Array of params
  1. ; Input:
  1. ; IBCNGP("IBI") 0-Selected, 1-All Insurance Companies
  1. ; IBCNGP("IBIA") 0-Active, 1-Both Active and Inactive, 2-Inactive Insurance Companies
  1. ; IBCNGP("IBIP") 0-Selected, 1-All Group Plans
  1. ; IBCNGP("IBIPA") 0-Active, 1-Both Active and Inactive, 2-Inactive Group Plans
  1. ; IBCNGP("IBIGN") 1-Group Name, 2-Group Number, 3-Both Group Name and Group Number
  1. ; IBCNGP("IBFIL") A^B^C where"
  1. ; A - 1-Begin with, 2-Contains, 3-Range
  1. ; B - A=1 Begin with text, A=2 Contains text, A=3 Range start text
  1. ; C - only if A=3 Range End text
  1. ; IBCNGP("IBICS") 1-Covered, 2-Not Covered, 3-Conditional
  1. ; 4-By Default (blank status), 5-All Coverage Statuses
  1. ; IBCNGP("IBOUT") E-EXCEL, R-REPORT
  1. ;
  1. ; ^TMP("IBCNGP",$J,"INS",ICT)=IEN of the selected Insurance Company, file 36
  1. ; ICT - count of Insurance Companies
  1. ; ^TMP("IBCNGP",$J,"INS",ICT,"GRP",GCT)=IEN of the selected Group Plan, file 355.3
  1. ; GCT - count of Group Plans
  1. ;
  1. ; Compile and Print Report
  1. N GDATA,GCT,GIEN,IBCT,IBPGN,ICT,IIEN,PLANOK
  1. K ^TMP($J,"PR")
  1. ;
  1. I $G(IOST)["C-",IBCNGP("IBOUT")="R" W !,"Compiling report data ...",!
  1. ;
  1. ;If ALL Group Plans, add groups to ^TMP("IBCNGP")
  1. I IBCNGP("IBIP") D
  1. . S IBCT=""
  1. . F S IBCT=$O(^TMP("IBCNGP",$J,"INS",IBCT)) Q:IBCT="" D
  1. . . S IIEN=^TMP("IBCNGP",$J,"INS",IBCT)
  1. . . I $D(^IBA(355.3,"B",IIEN)) D
  1. . . . S GCT=0
  1. . . . S GIEN=0 F S GIEN=$O(^IBA(355.3,"B",IIEN,GIEN)) Q:'GIEN D
  1. . . . . ; checks to see if Group Plan should be included on the report
  1. . . . . K GDATA
  1. . . . . D GETS^DIQ(355.3,GIEN_",",".05;.06;.07;.08;.09;.11;2.01;2.02","EI","GDATA")
  1. . . . . S PLANOK=$$PLANOK^IBCNSU21(.GDATA,IBCNGP("IBIPA"),IBCNGP("IBIGN"),IBCNGP("IBFIL"))
  1. . . . . I 'PLANOK Q
  1. . . . . S GCT=GCT+1
  1. . . . . S ^TMP("IBCNGP",$J,"INS",IBCT,"GRP",GCT)=GIEN
  1. ;
  1. S ICT=0
  1. F S ICT=$O(^TMP("IBCNGP",$J,"INS",ICT)) Q:'ICT D
  1. . S IIEN=^TMP("IBCNGP",$J,"INS",ICT)
  1. . S GCT=0
  1. . F S GCT=$O(^TMP("IBCNGP",$J,"INS",ICT,"GRP",GCT)) Q:'GCT D
  1. . . S GIEN=^TMP("IBCNGP",$J,"INS",ICT,"GRP",GCT)
  1. . . D GETDATA
  1. ;
  1. D PRINT
  1. ;
  1. K ^TMP("IBCNGP",$J)
  1. Q
  1. ;
  1. GETDATA ; Get Insurance Company and Group Plan data
  1. ; Input: IIEN - IEN of the Insurance Company, file 36
  1. ; GIEN - IEN of the Group Plan, file 355.3
  1. ; Output: ^TMP($J,"PR",INSNAME,ICT,GNAME,GCT,IBCAT,CCT)) - C1^C2^..^C4 Where:
  1. ; INSNAME - Insurance Company name
  1. ; ICT - Insurance Company counter from ^TMP("IBCNGP")
  1. ; GNAME - Group Plan name
  1. ; GCT - Group Plans counter from ^TMP("IBCNGP")
  1. ; IBCAT - Coverage Category
  1. ; CCT - Coverage Category counter
  1. ; C1=Coverage Category, C2=Effective Date
  1. ; C3=Coverage Status, C4=Limitation Comment
  1. ;
  1. N CATARR,CCT,CDATA,CTR,GINACT,GIND,GNAME,GNUM,GTYP,I,IBCAT,IBCOV,IBCSTA,IBDT,IBEFDT,IBINS
  1. N IBLIMCOM,IBRECDT,IBRECN,INSNAME,PRINT,STATE,STATECD,XX
  1. ;
  1. ; NOTE: If a category has at least one instance where the Coverage matches the Coverage
  1. ; selected by the user, all instances for that Category will be displayed on the report.
  1. ;
  1. ; Compile Plans Coverage Limitation info
  1. ; File# 355.31 PLAN LIMITATION CATEGORY contains ALL coverage categories
  1. F I=1:1:$O(^IBE(355.31,"B"),-1) S IBCAT=I D
  1. . ; If the Category doesn't exist for the Plan the Coverage Status is BY DEFAULT
  1. . I '$D(^IBA(355.32,"APCD",GIEN,I)) D Q
  1. . . S IBCSTA="BY DEFAULT" ; Coverage Status
  1. . . S IBCOV=$$GET1^DIQ(355.31,I,.01,"E") ; Coverage Category
  1. . . S CATARR(IBCAT,0,0)=IBCOV_U_U_IBCSTA
  1. . . D COVOK
  1. . S IBRECDT=""
  1. . F S IBRECDT=$O(^IBA(355.32,"APCD",GIEN,IBCAT,IBRECDT)) Q:IBRECDT="" D
  1. . . S IBRECN=""
  1. . . F S IBRECN=$O(^IBA(355.32,"APCD",GIEN,IBCAT,IBRECDT,IBRECN)) Q:IBRECN="" D
  1. . . . S IBCOV=$$GET1^DIQ(355.32,IBRECN,.02) ; Coverage Category
  1. . . . S IBEFDT=$$DAT3^IBOUTL($$GET1^DIQ(355.32,IBRECN,.03,"I")) ; Effective Date
  1. . . . S IBCSTA=$$GET1^DIQ(355.32,IBRECN,.04,"I") ; Coverage Status
  1. . . . S IBCSTA=$S(IBCSTA="":"BY DEFAULT",IBCSTA=0:"NO",IBCSTA=1:"YES",1:"CONDITIONAL")
  1. . . . S IBLIMCOM=""
  1. . . . I $O(^IBA(355.32,IBRECN,2,0))'="" S IBLIMCOM="YES" ; Limit Comments?
  1. . . . ; Build local array by Category and Date
  1. . . . S CATARR(IBCAT,IBRECDT,IBRECN)=IBCOV_U_IBEFDT_U_IBCSTA_U_IBLIMCOM
  1. . . . ; Check Coverage to see if it should be displayed
  1. . . . D COVOK
  1. ;
  1. CATARR ; Loop thru CATARR, add the Categories that should be displayed to the Print array.
  1. S IBCAT=0 F S IBCAT=$O(CATARR(IBCAT)) Q:IBCAT="" D
  1. . I $G(CATARR(IBCAT))'=1 Q
  1. . S CCT=0
  1. . S IBDT="" F S IBDT=$O(CATARR(IBCAT,IBDT)) Q:IBDT="" D
  1. . . S CTR="" F S CTR=$O(CATARR(IBCAT,IBDT,CTR)) Q:CTR="" D
  1. . . . S CDATA=CATARR(IBCAT,IBDT,CTR)
  1. . . . S IBCOV=$P(CDATA,U)
  1. . . . S IBEFDT=$P(CDATA,U,2)
  1. . . . S IBCSTA=$P(CDATA,U,3)
  1. . . . S IBLIMCOM=$P(CDATA,U,4)
  1. . . . S CCT=CCT+1
  1. . . . ; The Insurance & Group info only need to be added once (the first category)
  1. . . . ; Build the Print array
  1. . . . I CCT=1 D GETINS,GETGRP ; builds Insurance & Group Plan print array
  1. . . . S ^TMP($J,"PR",INSNAME,ICT,GNAME,GCT,IBCAT,CCT)=IBCOV_U_IBEFDT_U_IBCSTA_U_IBLIMCOM
  1. Q
  1. ;
  1. GETINS ; Get Insurance info
  1. S INSNAME=$$GET1^DIQ(36,IIEN,.01)
  1. S $P(IBINS,U)=INSNAME
  1. S $P(IBINS,U,2)=$S($$GET1^DIQ(36,IIEN,.111)'="":$$GET1^DIQ(36,IIEN,.111),1:"<STREET ADDR 1 MISSING>")
  1. S $P(IBINS,U,3)=$$GET1^DIQ(36,IIEN,.114)
  1. S XX=$$GET1^DIQ(36,IIEN,.115) I XX'="" S STATECD=$O(^DIC(5,"B",XX,""))
  1. S $P(IBINS,U,4)=$S(XX'="":$P($G(^DIC(5,STATECD,0)),U,2),1:"<STATE MISSING>")
  1. S $P(IBINS,U,5)=$$GET1^DIQ(36,IIEN,.116)
  1. S ^TMP($J,"PR",INSNAME,ICT)=IBINS
  1. Q
  1. ;
  1. GETGRP ; Get Group Plan info
  1. S GIND=$$GET1^DIQ(355.3,GIEN,.1,"I")
  1. S GINACT=$$GET1^DIQ(355.3,GIEN,.11,"I")
  1. S GNAME=$S($$GET1^DIQ(355.3,GIEN,2.01)'="":$$GET1^DIQ(355.3,GIEN,2.01),1:"<NO GROUP NAME>")
  1. S GNUM=$S($$GET1^DIQ(355.3,GIEN,2.02)'="":$$GET1^DIQ(355.3,GIEN,2.02),1:"<NO GROUP NUMBER>")
  1. ; Add '+'=individual and/or '*'=inactive
  1. I GIND'="" S GNAME="+"_GNAME
  1. I GINACT S GNUM="*"_GNUM
  1. S GTYP=$S($$GET1^DIQ(355.3,GIEN,.09)'="":$$GET1^DIQ(355.3,GIEN,.09),1:"<NO TYPE OF PLAN>")
  1. S ^TMP($J,"PR",INSNAME,ICT,GNAME,GCT)=GNAME_U_GNUM_U_GTYP
  1. Q
  1. ;
  1. COVOK ; If the Coverage matches what the user selected, flag the Category and set PRINT=1.
  1. ; This Coverage, it's Insurance and Group, will be displayed on the report.
  1. ; IBCNGP("IBICS") - 1-Covered, 2-Not Covered, 3-Conditional
  1. ; 4-By Default (blank status), 5-All Coverage Statuses
  1. I IBCNGP("IBICS")=5 S CATARR(IBCAT)=1,PRINT=1 Q
  1. I IBCNGP("IBICS")=1,IBCSTA="YES" S CATARR(IBCAT)=1,PRINT=1
  1. I IBCNGP("IBICS")=2,IBCSTA="NO" S CATARR(IBCAT)=1,PRINT=1
  1. I IBCNGP("IBICS")=3,IBCSTA="CONDITIONAL" S CATARR(IBCAT)=1,PRINT=1
  1. I IBCNGP("IBICS")=4,IBCSTA="BY DEFAULT" S CATARR(IBCAT)=1,PRINT=1
  1. Q
  1. ;
  1. ;============================PRINT==================================
  1. PRINT ;
  1. ; Input: ^TMP($J,"PR",INSNAME,ICT,GNAME,GCT,IBCAT,CCT)) - C1^C2^..^C4 Where:
  1. ; INSNAME - Insurance Company name
  1. ; ICT - Insurance Company counter from ^TMP("IBCNGP")
  1. ; GNAME - Group Plan name
  1. ; GCT - Group Plans counter from ^TMP("IBCNGP")
  1. ; IBCAT - Coverage Category
  1. ; CCT - Coverage Category counter
  1. ; C1=Coverage Category, C2=Effective Date
  1. ; C3=Coverage Status, C4=Limitation Comment
  1. ;
  1. N CRT,DASHES,EORMSG,FIRST,HDRDATE,HDRNAME,IBPGC,IBPXT,MAXCNT,NONEMSG,SPACES,STOP,ZTSTOP
  1. S (STOP,ZSTOP)=0
  1. S EORMSG="*** End of Report ***"
  1. S NONEMSG="* * * N o D a t a F o u n d * * *"
  1. S HDRNAME="COVERAGE LIMITATION REPORT"
  1. D NOW^%DTC
  1. S HDRDATE=$$DAT2^IBOUTL($E(%,1,12))
  1. S $P(DASHES,"-",132)=""
  1. S $P(SPACES," ",130)=""
  1. S (IBPXT,IBPGC)=0
  1. S MAXCNT=IOSL-3,CRT=1
  1. I 'IOST["C-" S MAXCNT=IOSL-6,CRT=0
  1. ;
  1. ; Print report
  1. D PRT Q:(IBPXT!$G(ZTSTOP))
  1. I CRT,IBPGC>0,$E(IOST,1,2)["C-" D
  1. . I MAXCNT<51 F LIN=1:1:(MAXCNT-$Y) W !
  1. . S DIR(0)="E" D ^DIR K DIR
  1. I IBCNGP("IBOUT")="E",CRT,$E(IOST,1,2)["C-" S DIR(0)="E" D ^DIR K DIR
  1. EXIT ; PRINT exit
  1. K ^TMP($J,"PR")
  1. Q
  1. ;
  1. PRT ; Print report
  1. N BLANK,CAT,CCT,CDATA,DISPDATA,GCT,GPLAN,GDATA,ICT,IDATA,INS
  1. N GDATALN,IDATALN ;702/DTG line spacing
  1. ;
  1. ; EXCEL Format
  1. I IBCNGP("IBOUT")="E" D G PRTEX
  1. . D EHDR ; EXCEL Header
  1. . I '$D(^TMP($J,"PR")) D G PRTEX
  1. . . W !,NONEMSG ; No Data Found
  1. . S INS=0 F S INS=$O(^TMP($J,"PR",INS)) Q:INS="" D
  1. . . S ICT=0 F S ICT=$O(^TMP($J,"PR",INS,ICT)) Q:ICT="" D
  1. . . . S IDATA=^TMP($J,"PR",INS,ICT)
  1. . . . S GPLAN=0 F S GPLAN=$O(^TMP($J,"PR",INS,ICT,GPLAN)) Q:GPLAN="" D
  1. . . . . S GCT=0 F S GCT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT)) Q:GCT="" D
  1. . . . . . S GDATA=^TMP($J,"PR",INS,ICT,GPLAN,GCT)
  1. . . . . . S CAT=0 F S CAT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT)) Q:CAT="" D
  1. . . . . . . S CCT=0 F S CCT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT,CCT)) Q:CCT="" D
  1. . . . . . . . K DISPDATA ; Init dispdata
  1. . . . . . . . S CDATA=^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT,CCT)
  1. . . . . . . . ; build/display data
  1. . . . . . . . S DISPDATA=IDATA_U_GDATA_U_CDATA
  1. . . . . . . . W !,DISPDATA
  1. ;
  1. ; REPORT Format
  1. D HEADER(HDRNAME,HDRDATE)
  1. ;
  1. ; Nothing to print
  1. I '$D(^TMP($J,"PR")) D G PRTEX
  1. . W !,?40,NONEMSG ; No Data Found
  1. ; Process through the Print array
  1. N FGP,FGCT,FINS,FICT
  1. S INS=0 F S INS=$O(^TMP($J,"PR",INS)) Q:INS="" D I STOP G PRTEX
  1. . S FINS=$O(^TMP($J,"PR","")),FICT=$O(^TMP($J,"PR",FINS,""))
  1. . S ICT=0 F S ICT=$O(^TMP($J,"PR",INS,ICT)) Q:ICT="" D I STOP G PRTEX
  1. . . K INSDATA,GPDATA,COVDATA
  1. . . ; Blank line in between ins companies if it's not the first ins company
  1. . . I INS'=FINS!(ICT'=FICT) D LINE(SPACES)
  1. . . D INSDATA,LINE(INSDATA) I (IBPXT!$G(ZTSTOP)) S STOP=1 Q ; build/display data
  1. . . S GPLAN=0 F S GPLAN=$O(^TMP($J,"PR",INS,ICT,GPLAN)) Q:GPLAN="" D I STOP G PRTEX
  1. . . . S FGP=$O(^TMP($J,"PR",INS,ICT,"")),FGCT=$O(^TMP($J,"PR",INS,ICT,FGP,""))
  1. . . . S GCT=0 F S GCT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT)) Q:GCT="" D I STOP G PRTEX
  1. . . . . ; Blank line in between group plans if it's not the first group plan
  1. . . . . I GPLAN'=FGP!(GCT'=FGCT) D LINE(SPACES)
  1. . . . . D GPDATA,LINE(GPDATA) I (IBPXT!$G(ZTSTOP)) S STOP=1 Q ; build/display data
  1. . . . . S CAT=0 F S CAT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT)) Q:CAT="" D I STOP G PRTEX
  1. . . . . . S CCT=0 F S CCT=$O(^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT,CCT)) Q:CCT="" D I STOP G PRTEX
  1. . . . . . . D COVDATA,LINE(COVDATA) I (IBPXT!$G(ZTSTOP)) S STOP=1 Q ; build/display data
  1. ;
  1. PRTEX ;
  1. I IBPXT!$G(ZTSTOP) Q
  1. I IBCNGP("IBOUT")="E" W !,EORMSG
  1. I IBCNGP("IBOUT")="R" D Q:(IBPXT!$G(ZTSTOP))
  1. . I $Y+1>MAXCNT!('IBPGC) D HEADER(HDRNAME,HDRDATE)
  1. . W !!,?40,EORMSG
  1. Q
  1. ;
  1. N DIR,DTOUT,DUOUT,LIN,OFFSET,X,Y
  1. I IBPGC>0,$E(IOST,1,2)["C-" D Q:(IBPXT!$G(ZTSTOP))
  1. . I MAXCNT<51 F LIN=1:1:(MAXCNT-$Y) W !
  1. . S DIR(0)="E" D ^DIR K DIR
  1. . I $D(DTOUT)!($D(DUOUT)) S IBPXT=1 Q
  1. I $E(IOST,1,2)'["C-",$$S^%ZTLOAD() S ZTSTOP=1 Q
  1. S IBPGC=IBPGC+1 I IBPGC>1!($E(IOST,1,2)["C-") W @IOF
  1. W HDRNAME
  1. S HDRDATE=HDRDATE_" Page: "_+IBPGC,OFFSET=(132-($L(HDRDATE)+1))
  1. W ?OFFSET,HDRDATE,!
  1. W DASHES
  1. ; Excel and Report Page 1 Header only
  1. I IBCNGP("IBOUT")="E"!(IBPGC=1) D HDR1
  1. I IBCNGP("IBOUT")="R" D HDR2
  1. Q
  1. ;
  1. EHDR ; EXCEL header
  1. N HDR,HDR2
  1. S HDR="COVERAGE LIMITATION REPORT"_U_HDRDATE
  1. W HDR
  1. D HDR1
  1. S HDR2="INS COMPANY NAME^ADDRESS STREET^CITY^STATE^ZIP"
  1. S HDR2=HDR2_"^GROUP NAME^GROUP NUMBER^TYPE OF PLAN"
  1. S HDR2=HDR2_"^CATEGORY^EFFECTIVE DATE^COVERED?^LIMIT COMMENTS?"
  1. W HDR2
  1. Q
  1. ;
  1. HDR1 ; Report Header for Page 1 and Excel report
  1. W !,"+ =>INDIV. PLAN * => INACTIVE"
  1. W !,"Filters: ",$S(IBCNGP("IBI")=1:"All",1:"Selected")," Insurances"
  1. W ", ",$S(IBCNGP("IBIP")=1:"All",1:"Selected")," Group Plans"
  1. W ", ",$S(+IBCNGP("IBFIL")=2:"Contains = ",+IBCNGP("IBFIL")=3:"Range = ",+IBCNGP("IBFIL")=4:"BLANK",1:"Begins with = ")
  1. W $S(+IBCNGP("IBFIL")=3:$P(IBCNGP("IBFIL"),U,2)_"-"_$P(IBCNGP("IBFIL"),U,3),1:$P(IBCNGP("IBFIL"),U,2))
  1. W ", "
  1. I IBCNGP("IBICS")=5 W "All Coverage Statuses"
  1. I IBCNGP("IBICS")'=5 D
  1. . W "Coverage Status: "
  1. . W $S(IBCNGP("IBICS")=1:"COVERED",IBCNGP("IBICS")=2:"NOT COVERED",IBCNGP("IBICS")=3:"CONDITIONAL",1:"BY DEFAULT")
  1. W !
  1. Q
  1. ;
  1. HDR2 ; Column Headers for the Report format, for all pages
  1. W !,"COMPANY",?15,"GROUP NAME",?38,"GROUP NUMBER",?58,"CATEGORY",?86,"EFFECTIVE DATE"
  1. W ?103,"COVERED?",?116,"LIMIT COMMENTS?"
  1. ; At the beginning of a new page, redisplayed the Insurance Company. Don't display
  1. ; the Group Plan if you're starting a new group on the new page
  1. I IBPGC>1,GPLAN'="" D LINE(INSDATA) I $G(CCT)'="" D LINE(GPDATA)
  1. Q
  1. ;
  1. INSDATA ; Insurance Company info
  1. S IDATA=^TMP($J,"PR",INS,ICT)
  1. S INSDATA=$$FO^IBCNEUT1($P(IDATA,U,1),"40T","L")_$E(SPACES,1,2)
  1. S INSDATA=INSDATA_$P(IDATA,U,2)_", "_$P(IDATA,U,3)_", "
  1. S INSDATA=INSDATA_$P(IDATA,U,4)_" "_$P(IDATA,U,5)
  1. S IDATALN=1,GDATALN=0 ;702/DTG line spacing
  1. Q
  1. ;
  1. GPDATA ; Group Plan info
  1. S GDATA=^TMP($J,"PR",INS,ICT,GPLAN,GCT)
  1. S GPDATA=$E(SPACES,1,15)_$$FO^IBCNEUT1($P(GDATA,U,1),21,"L")_$E(SPACES,1,2)
  1. S GPDATA=GPDATA_$$FO^IBCNEUT1($P(GDATA,U,2),18,"L")_$E(SPACES,1,2)
  1. S GPDATA=GPDATA_"<< "_$P(GDATA,U,3)_" >>"
  1. S GDATALN=1 ;702/DTG line spacing
  1. Q
  1. ;
  1. COVDATA ; Coverage info
  1. S CDATA=^TMP($J,"PR",INS,ICT,GPLAN,GCT,CAT,CCT)
  1. S COVDATA=$E(SPACES,1,58)_$$FO^IBCNEUT1($P(CDATA,U,1),"26T","L")_$E(SPACES,1,2)
  1. S COVDATA=COVDATA_$$FO^IBCNEUT1($P(CDATA,U,2),15,"L")_$E(SPACES,1,2)
  1. S COVDATA=COVDATA_$$FO^IBCNEUT1($P(CDATA,U,3),"11T","L")_$E(SPACES,1,2)
  1. S COVDATA=COVDATA_$$FO^IBCNEUT1($P(CDATA,U,4),5,"L")
  1. Q
  1. ;
  1. LINE(DISPDATA) ; Print data
  1. N NWPG
  1. S NWPG=0
  1. I $TR(DISPDATA," ","")="" G LINEX
  1. I IBCNGP("IBOUT")="R" D Q:(IBPXT!$G(ZTSTOP))
  1. . ; 702/DTG start line spacing
  1. . I IDATALN=1 S IDATALN=0 I ($Y+4)>MAXCNT D HEADER(HDRNAME,HDRDATE) S NWPG=1 Q
  1. . I GDATALN=1 S GDATALN=0 I ($Y+3)>MAXCNT D HEADER(HDRNAME,HDRDATE) S NWPG=1 Q
  1. . ; 702/DTG end line spacing
  1. . I ($Y+2)>MAXCNT!('IBPGC) D HEADER(HDRNAME,HDRDATE) S NWPG=1 I (IBPXT!$G(ZTSTOP)) Q
  1. LINEX ;
  1. S IDATALN=0
  1. W !,DISPDATA
  1. Q
  1. ;
  1. CENTER(LINE,XWIDTH) ;return centered line OFFSET
  1. N LENGTH,OFFSET
  1. S LENGTH=$L(LINE),OFFSET=XWIDTH-$L(LINE)\2
  1. Q OFFSET