NPR Training at Mass Bay Community College in Wellesley

If you are a Boston-area individual with a computer science background interested in NPR training, this may be of interest:

Joe Cocuzzo, our Vice President of NPR Services, is teaching a non-credit evening class in NPR Report writing (C/S platform). The plan is to offer a 10 week class, two evening sessions of 2 hours each, beginning 2/9.

The training would be for someone with a computer science background but no MEDITECH and no health-care experience and after 40 hours of classroom training, be a productive Report Writer.

If you are interested in this class, please let us know. Time is short, because if the enrollment does not improve, the college will cancel the class.

The college is planning an open house on 1/31, and the plan would be to offer classes on Tuesday and Thursday nights thru 4/17.

Please email

NPR Report Writing Tips : January 2012

NPR Tip: Stripping characters for a Download Report

by Joe Cocuzzo, Vice President – NPR Services

This month, we will show you an easy way to filter output in a download report to remove characters which will cause problems for the parsing of fields and records in the receiving system. A simple example would be when the other party asks for a comma delimited file without “quote qualifiers.” In such a file, you need to remove any commas in the data or the comma in the field will be interpreted as a record delimiter. A more complex example is XML output, where you have to filter for certain reserved characters and replace them with some alternate text. Additionally, we will show how you can suppress the “Record Limit Reached” message from the end of your file that will otherwise be included. This can be inconvenient if you are using the record limit feature to make a sample file for an outside party because they will typically object to the extra data at the end of the file, and it can be tedious to remove it by hand.

Let’s look at the simple case where the other party wants a comma delimited file without quotes, making it impossible to send any data with an embedded comma. Since a MEDITECH patient name field always includes an imbedded comma, we will need to remove it, and it is probably a good idea to screen all fields that might include a comma to prevent the stray name or comment field from causing problems.

One way to remove all commas in a field would be to check each character in the string by position and remove the character if it is a comma. We use the “Not #” syntax to strip the offending character: Notice that the DAT attribute of all the fields on the report are set to INT. This will suppress any quotes around non-numeric fields (by treating them as numeric). You can do this to a standard field also, but if you do it to a date, you will change the format to YYYYMMDD, unless you use a computed field and

NPR Tip 1 image

You can also change the data type of a standard field by adding a DAT= attribute:

NPR Tip image

This code puts the data from the field into a variable “STRING”, takes the length of the string, and then loops from position zero to the last position in the string, stripping out any commas found.

This will work fine, but there is an easier way, using the L() locate function in a DO loop:

NPR Tip 3 image

An advantage of this approach is that if you had multiple characters to strip, you can just string them together in the L() function arguments, like so:

NPR Tip 4 image

Here we are stripping the commas, hyphens, and periods from the string.

If you want to replace the comma with a space, we need to use $ (to the left) and % (to the right) with a space concatenated (_) in the middle:

NPR Tip 5 image

If you have a lot of fields in your download, you can create a macro as a program and use it from your computed field. Assuming you write a utility report called and call the macro “comma”: (I have placed a report with this name in our library).

NPR Tip 6 image

The code in the macro looks like this (we replace the comma with a space in this utility):

NPR Tip 7 image

Here is the output of a report that uses all these methods to strip the comma from the name field:

NPR Tip 8 image

Let’s look at a more complicated example, such as an XML formatted export where we need to look for certain reserved characters when we are putting data between tags, and substitute a string for the reserved character as follows:

Character Substitute
> >
< &lt;
& &amp
% %#37;

We can write a utility macro called “xml” that strips them as follows:

NPR Tip 9 image

Notice that we have a two-step process to fix “&” and turn it into “&amp”. That is because if we directly searched for & and replaced it with &amp in a DO loop, the loop would be infinite as it would find the & in the “&amp” and be stuck until the string exceeds 255 and the program crashes. To solve this, we replace with “*amp;” first and then change the “*amp;” with “&amp;”.

C/S and MAGIC versions of these example reports and has been uploaded to our report library.

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Read Joe’s blog posts at MEDI-Talk.

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email

(This article originally appeared in the January 2012 issue of Iatric Systems’ Updates! newsletter.)

MEDITECH Community Bulletin

Highlights of this month’s issue include:

  • I had the opportunity to visit with a MEDITECH site which completed it’s attestation period and met the requirements for Stage 1 Meaningful Use. To learn about how “Holyoke Medical Center Measures Up!”, please read the article in our Customer Spotlight column.
  • In this month’s Tricks of the Trade column, John Sharpe of Comstock Software writes about an “Unpredictable Result when MEDITECH BAR Index Used by Default”.
  • Our Featured Employer column this month features a Sr. Systems Analyst – Advanced Clinicals position at Noyes Memorial Hospital in Dansville, New York.
  • The Recent News section is chock full of press releases from numerous organizations.
  • This month’s Worth a Read section contains the usual assortment of articles of interest to the Health IT field.

Check out the current issue.

NPR Report Writing Tips : December 2011

by Joe Cocuzzo, Vice President – NPR Services

NPR Tip: Make “Program Call” macros rename automatically (MAGIC and Client/Server)

You may know that you can make a macro in a report that can be called as a program, rather than used as a block of code that is incorporated into your main report logic based on a keyword in a footnote. This has certain advantages, but if you make a copy of your report and fail to track down and change the program calls, your new report will still call the macros from the original.

In this month’s tip, we will show how you can add some code to a “start” macro of your report that will use the name of the new page program to make sure that you always call the “program macros” of the current report, without needing to track down and edit the program calls every time you make a copy.

The big advantage of making your macro a program is that it is completely separate code with separate variables. Two big advantages: you do not need to re-translate your report after changing the macro and you can change the value of subscripts in the macro without worrying that you will affect the behavior of the report by possibly changing the value of a subscript the report is looping on.

A typical use of a macro as a program would be to create a download file:
(C/S Version shown, for MAGIC just omit the PFF NO footnote).

NPR Tip 1 image

The two macros look like this (MAGIC versions):

NPR Tip 2 imageNPR Tip 3 image


The difference for Client/Server (C/S) is that you cannot send a tab character to the printer without surrounding it with some extra codes so that it can sneak by the print manager:

NPR Tip 4 image

Important Note: If you do not do any output in the picture, you will get a “no records found” message at the end of the report, and if your export is large, the report will run slowly. To fix this for both MAGIC and C/S, add a call the @.line in your “detail” macro. We don’t need to do this in this example report because we have an HR and D region in our picture, so the report will call @.line per record for us.

NPR Tip 5 image

Now (finally), onto the tip. When you call a macro with a keyword like this: AL D, if you make a copy, the new version of the report uses “its own” macro. If you call it as a program (start with %, pass arguments in ()) like this AL D, unless you change the call in the copy, you will call the macro of the original report. It is easy to miss this if you call your macro from a line attribute or computed field.

Fortunately, the report keeps its own name in a slash variable called (translates to /R.NEW.PAGE.PGM). For MAGIC, the value stored is the name of the report with a “.R” at the end. In C/S, the value stored is the internal name of the macro, including the prefix. If we write a start macro that uses the data stored in to build the program names from the report name in, we can be sure that any copy of our report will call its own macros, with no hand-editing necessary.

For MAGIC, we can attach a start macro that creates two program names in two variables, using the value, then modify the footnote to call the programs using those variables:

NPR Tip 6 image

Then we modify our footnotes to call the start macro and to call the programs using the HEADER and DETAIL variables we set up in the start macro.

NPR Tip 7 image

The C/S code is just slightly different, as we have to cope with the fact that the holds the translated name of the program. If you use the “List Object Code” option in Process Reports, you can see what these look like:

NPR Tip 8 image

So, our start macro has to use some extra dots, and in the footnote, we call the program from within square brackets with no % sign on the outside:

We put two dots between the M and the macro name:

NPR Tip 9 image

And we call the macros like this [MACRO](0)

NPR Tip 10 image

C/S and MAGIC versions of this example report has been uploaded to our report library.

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email

(This article originally appeared in the December 2011 issue of Iatric Systems’ Updates! newsletter.)

Tis the Season to be Learning with MUSE

MUSE still has a couple of webcasts coming up this month, including:
General Ledger (GL) Report Writer: Tips, Tricks and Cheat Sheets
Register for the December 13, 2011 webinar.

The Essentials of Project Management
Register for either the December 15 or 29, 2011 webinar.

NPR Report Writing Tip: November 2011

Joe Cocuzzo, Vice President – NPR Services
NPR Tip: American Recovery and Reinvestment Act (ARRA) Changes to Log Patient Inclusion on Custom Reports (MAGIC and Client/Server)

The ARRA changes to MAGIC and Client/Server introduce a “Patient Audit” feature for custom (and standard) NPR reports. This month we will describe how the auditing feature works and tell you how you can set a flag in a report to suppress the auditing feature. References to spooling apply to MAGIC sites only.

For more details on the Patient Audit, you should refer to KB article 39339 (MAGIC) or 39865 (Client/Server). These articles describe the default audit settings that log any CREATE, EDIT, EXPORT or VIEW activity, but suppress logging of PRINT activity. This article is based on testing at sites that used the MEDITECH default setting.

With the default settings, if you run an NPR report that contains protected health information (PHI) fields, MEDITECH saves the user, date, time, and report title in a Patient Audit Report if the report is printed to DOWNLOAD. It does not track activity if the report is spooled and transferred to a PC. It does not track activity if the report is spooled and exported to an FTP remote host. If your report was written pre-ARRA and not re-translated, no logging from the report will occur.

I assume that if you added tracking of “PRINT” activity, MEDITECH would log printing to paper or preview and viewing of spool file pages.

How does this work?

To support this feature, MEDITECH created a new PHI attribute and added PHI=Y flag to all PHI fields in the data definition. If you use such fields in your report (and sometimes even if you do not) a call to %Z.patient.activity is added to your report when you translate. This program creates entries in a temporary structure /..PTACT per page of output. The program and the programs handle logging to the spool file and writing to a patient audit log as the MIS parameters indicate.

Here is an example of the new flags in the data definition:

NPR Tip 1 image

Here is the call to the new %Z.patient.activity program in the report object code:

NPR Tip 1 image

Since MEDITECH did not, as far as I can tell, do any mass translation of reports as part of delivery of the 5.64 ARRA updates, your hospital will have a mix of old reports that do not have the Z.patient.activity call inserted by the translator, and new or more recently translated reports that do have it.

Post ARRA, if you translate a report and it slows down when downloaded, suspect logging as the cause. Even if you are printing or are going to export via FTP (and therefore not logging), the report still builds a /..PTACT structure for each patient on the page and kills the structure after each page, and you’d expect this would slow down report compiles to some extent.

Setting Lines Per Page to 999 and Page Size to 999 might influence the impact of logging as you would increase the size of the /..PTACT structure, but reduce the frequency of the logging calls. If you built the report to do all output in a macro, but the translator includes a call to %Z.patient.activity (say in a detail region used to send just a CR/LF) you might have a report that sets off high buffer use alarms (magic) or effectively hangs a client machine (C/S).

Here is the section of the Patient Audit Log, showing an “EXPORT”

NPR Tip 1 image

We can see proof that standard reports also include logging when exported:

NPR Tip 1 image

Note that the log also stores activity by background jobs and midnight runs, which is rather a waste of space.

MEDITECH standard reports have two new fields to control logging “Contains PHI” and “Suppress Patient Auditing”. Customer NPR reports do not have such fields. What can we do if an NPR report that is printed or sent via FTP (and will not have any logging anyway) becomes too slow post-ARRA? Or what if we have a report that is downloaded and the hospital feels that ARRA logging per patient is not required and not worth the space and extra compile time?

Fortunately if you set the /MRM.JOB flag in your report, the Z.patient.activity job does not build a temp file in /..PTACT, and therefore no logging will occur. I do not recommend setting the flag routinely in reports, but it is useful to know that if you need to improve the performance of certain reports post-ARRA, having a method to defeat logging is useful.

To set the flag, add code to a start macro or use an AL START footnote like this:

NPR Tip 1 image

If we look at the source code of Z.patient.activity, we can see that the program does nothing if this flag is set:

NPR Tip 1 image

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email

(This article originally appeared in the November 2011 issue of Iatric Systems’ Updates! newsletter.)

NPR Report Writing Tips: October 2011

by Joe Cocuzzo, Vice President – NPR Services

NPR Tip: Overcoming the 255 Character Limit to Browse to a Long URL from MAGIC

The MAGIC (and Client/Server) 255 character limit makes it difficult to handle a value that exceeds this length. A reasonably common example is a URL that exceeds 255 characters.

You can use the or @Shell.execute macro in C/S or the Z program in MAGIC to pass a URL to the C/S client or MT Report Workstation and cause the PC to use the default browser to go to a website. How can you handle a case where the URL is longer than 255 characters?

There are browser add-ons ( that allow you to map a small private URL to some longer URL, but this won’t work for cases where the information is dynamic, such as sending patient information to Thomson-Reuters/Micromedex to print discharge instructions. Also, a browser add-on requires installation at each PC.

One method I have used in the past is to write out a VB script file to the local PC and execute it. Security or user access restrictions on the local PC can thwart this approach.

Another method I showed in our MUSE 2011 NPR Tips and Tricks session was to write out a small “redirect” page to the PC and then use either @Shell.execute (C/S) or (Magic) to cause your browser to use the nice short URL of that page to then be re-directed to the true URL you need to use.

Details for this approach can be found on our website at: in the zip file here:

For the MAGIC platform, the program has a new(ish) option that allows you to pass a path or URL that exceeds 255 by loading it into an array and then passing a pointer to the array to the Z program, rather than passing the URL itself.

This involves calling the Z program and passing values to it by reference instead of by value. Those of you who have taken a programming class in just about any language learned how to pass values to a procedure or function by reference. This is an essential technique for any situation in which you do not want to make a copy of some large structure or long variable and instead want to send a program a reference to an existing structure so the program works on the exact same thing, not on a copy passed by value.

In MAGIC (or C/S), you use the “name of” operator ⇒ to pass a reference to a structure, rather than its value. (The ⇒ prints as the caret ^ in a program listing, but shows up as a right pointing arrow on your Workstation screen). This is the same character as the “goes to” or “assignment” operator, but when used in the “name of” syntax, it serves as a way to pass a reference or “pointer” to a structure in a program call as one of the program arguments.

Let’s see how to load a long URL into an array and pass it to the utility. We will create a report that has a program call in the title, and suppress the print on prompt and all message displays, so we can have a report that provides a link to the URL from a MEDITECH menu, without a confusing “Print On” prompt or “End of Report” message.

Step one is to write a dummy report. Everything happens in the title program call, so you don’t need anything in the index or detail segment fields on page 1:

NPR Tip 1 image

In the “d” macro, you put a 1 into /Z.SCHED.LOG (this suppresses the “Print On:” prompt) and put a 1 into /R.NO.PRT.MSGS (this gets rid of the “End of Report” message).

Then you build a list in /URL[n] (where n is an integer counter that goes 1,2,3..) of the data needed to be used as the path, URL, or command line.

NPR Tip 2 image

If you are an especially sharp-eyed reader, you might notice that the URL example is only 139 characters in length, but using a list /URL[n] structure allows us to build a URL of any length.

When the report runs, you go directly to the Gaylord Hotel URL in the default browser:

NPR Tip 3 image

This example magic report has been posted to our report library:

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Read Joe’s blog posts at MEDI-Talk

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email

(This article originally appeared in the October 2011 issue of Iatric Systems’ Updates! newsletter.)

NPR Report Writing Tips: September 2011

by Joe Cocuzzo, Vice President – NPR Services

NPR Tip: An Index for B/AR Comments (Client/Server or MAGIC)

One shortcoming of the MEDITECH HCIS is the lack of a complete activity index in B/AR. There is an activity index that includes all financial transactions (purged with batches in MAGIC, purged at 10 days in Client/Server), but this index does not include an entry for B/AR comments.

Many hospitals want to run productivity reports from B/AR to track the number of comments entered for a date range. Because comments are not indexed directly, you would typically run a report through all B/AR transactions to gather this information (or perhaps make an assumption about the oldest service date of interest and use that as a starting point).

Recently, it occurred to me that the somewhat new HIPAA related user activity tracking could be exploited to serve as a kind of activity index, making a report to find comments for a date range much more efficient. Several years ago, MEDITECH started tracking user activity in all applications at the patient level, so checking the accounts accessed from the B/AR database for a date range is an efficient way to find comments for a date range.

The process is as follows:

Since B/AR comments can only be entered via a B/AR routine, the activity of interest is in the B/AR user activity log, kept (in MAGIC) on the B/AR segment.

  1. Loop through the activity index and make a list of all accounts accessed for the date range
  2. Look at those accounts and select comment transactions with a date in the date range

In a start macro, we loop through the user activity as follows:

NPR Tip 1 image

The report is written in the transactions segment with no index, but an LI selection on /ACCT.

NPR Tip 2 image

We don’t want detail on the report, just a count of accounts and comments for each user.

The count of comments is done with @Z.count.

The count of accounts is done with a computed field that includes a “WITH=TK2” attribute and a “FNC” of TOT.

To avoid printing a line per account, we put an LC=”” attribute on the TK2 line:

NPR Tip 3 image
NPR Tip 4 image

The complete list of attributes for xx.accts computed field is:







Running this report for a day takes just a few minutes, instead of the many hours it would take to loop through all of BAR.PAT at the transaction level if we did not exploit the user activity index.

NPR Tip 5 image

Note that you would not be able to find comments entered prior to the purge of user activity. That value is in @MIS.PARAM.user.logs.purge.delay. You could check the user selection range with an FCL:

NPR Tip 6 image

NPR Tip 7 image

The code for the MAGIC and the Client/Server versions of this report is identical (except for the segment name on page 1/general tab). An example report written for each platform has been uploaded to our report library:

You can find additional NPR Tips on our website at, as well as information about our on-site NPR Report Writer Training and NPR Report Writing Services.

Upcoming NPR Training Opportunities:

We are pleased to offer NPR Report Writer training sessions at host sites. Details and a course description are available on our website at

Location Level Instructor Date Cost
Greater Baltimore Medical Center
Baltimore, MD
Intermediate / Advanced Philip Sherry October 10-12, 2011 $750

To subscribe for email notifications for new classes, please follow this link:

For more information or to reserve a seat, please contact Karen Roemer at 978-805-3142 or email

(This article originally appeared in the September 2011 issue of Iatric Systems’ Updates! newsletter.)

MUSE Event – Toronto, ON conference

Join us at the MUSE Event – Toronto, ON conference to learn more about:

Medication Reconciliation
Patient Privacy
Computerized Physician Order Entry (CPOE)
And Much More
MUSE Event – Toronto, ON
September 12 – 13, 2011
Sheraton Parkway Toronto North Hotel & Suites
Richmond Hill, Ontario Canada
Booth #24

Don’t miss this opportunity to improve your NPR Report Writing Skills.
Join Joe Cocuzzo, Vice President of NPR Services, as he presents two
educational sessions on Tuesday, September 13, 2011.

9:00 am – 11:00 am    MAGIC Syntax for NPR Report Writers (MAGIC and C/S)
1:30 pm – 2:30 pm    NPR Tips and Tricks – Fun with Printers, Files and Executables
The NPR peer group meeting will be held immediately following the NPR
Tips and Tricks educational session.

Learn more.

MUSE Toronto

Join the Canadian MEDITECH User Group in Toronto, Ontario September 12-13

Peer Group Meetings

Join your peers for Show & Tell presentations and dedicated networking time at these scheduled peer group meetings …

EDM – Emergency Department Management
Peer Group Leader: Susie Thibeault BScN MISt, Application Specialist
Hamilton Health Sciences, Hamilton, Ontario

CWS – Community Wide Scheduling
Peer Group Leader: Lise Morrissette
Hopital Regional Sudbury Regional Hospital, Sudbury, Ontario

LAB – Laboratory
Peer Group Leader: Joanne Belanger
Hopital Regional Sudbury Regional Hospital, Sudbury, Ontario

NPR Report Writer
Peer Group Leader: Steve Mogg, Applications Analyst
North Bay Regional Health Centre, North Bay, Ontario

ORM – Operating Room Management
Peer Group Leader: Kenneth Tam, Clinical Systems Analyst
Peterborough Regional Health Centre, Peterborough, Ontario

PCS / NUR – Patient Care System / Nursing
Peer Group Leader: Oliver Delapaz, Coordinator, Clinical Informatics
Fraser Health, Surrey, British Columbia

PCI / EMR – Patient Care Inquiry / Electronic Medical Record
Peer Group Leader: Rene Campbell, Senior Consultant, Health Informatics & Knowledge Management
Fraser Health, Surrey, British Columbia

PP – Payroll
Peer Group Leader: Kay Rogers
Hopital Regional Sudbury Regional Hospital, Sudbury, Ontario

Provider Dictionary / Medical Records
Peer Group Leader: Linda Dennison
Hopital Regional Sudbury Regional Hospital, Sudbury, Ontario

SCA – Scanning and Archiving
Peer Group Leader: Brian Nelligan, IS Systems Analyst
Humber River Regional Hospital, Weston, Ontario

Plus, there will be plenty of timely educational presentations:

  • MEDITECH 6.0 Conversion – The Whole Story
  • Canada Health Infoway Update
  • Eastern Health Physician Portal: Improving Communications with Physicians
  • Champlain Association of MEDITECH Partners (CHAMP) – A Regional MEDITECH Implementation
  • The Ascent: Henry Mayo Newhall Memorial Hospital’s EDM Implementation
  • Standardized Care Planning and the Clinical Information System (CIS)
  • Using Excel to Create Intermediate and Advanced NPR Reports
  • Clarity About Cloud: Leveraging Virtual Infrastructure in Healthcare Information Systems
  • Facilitating a Project Planning Workshop
  • An Integrated Operational Assessment by MEDITECH
  • Benchmarking EHR Success
  • Provider Documentation / Provider Computer Order Entry: “Focus” on Lessons Learned
  • Learning Management System Implementation and Development
  • Transfer of Knowledge for the MEDITECH Learner
  • The Workflow to EHR Success – Mapping, Analysis and Design of Clinical Care Processes
  • AOM – A Step Towards Paperless Requisitioning for Ambulatory Patients
  • ORM 101
  • Bedside Medication Scanning at the Point of Care
  • Beyond VNA – Building a Complete Enterprise Healthcare Archive for MEDITECH Data and More

Register to attend.

Attend MEDITECH’s Canadian Regional Event!

Date:  September 14, 2011


  • MEDITECH’s Future Vision/Turning Challenge into Change
  • Preparing for Your Next Step:  Technology Updates and Vendor Relationships
  • Networking Lunch with Mobile Device Demonstrations
  • Using Surveillance to Improve Quality by Monitoring and Preventing Infection
  • Panel Discussion: Physician Engagement and Clinical Transformation