; If report is sent to screen, prompt for next page or quit
LOOPN
; Sort by name. Loop through ^XTMP("DGMSRPT","MSINC","NAM", x-ref
EN(DGBEG,DGEND,DGSRT)
; Entry point called from ^DGMSRPT
; INPUT: DGBEG - Starting record number to print
; DGEND - Ending record number to print
; DGSRT - Sort order for report (Name or SSN)
TOT
; Print total records at the end of the report
PRINT
; Print detail
PRTVAR
; Set up variables needed to print report
LOOPS
; Sort by SSN. Loop through ^XTMP("DGMSRPT","MSINC","SSN", x-ref