Unit 23: Download Reports 1
Preface
Within this portion of the presentation, several predefined reports are used by the presenter to demonstrate the differences between reports which output fixed record length files and report which output variable record length files. These reports are:
ADM.PAT.zcus.mt.rw.level1.dwl.fixed
-Outputs a fixed record length downloadfile
ADM.PAT.zcus.mt.rw.level1.dwl.variable
-Outputs a variablerecord lengthdownload file
Footnotes used for Downloading Reports
We will now introduce you to footnotes which can be used to create reports suitable for downloading to PC based applications. These footnotes will allow you to create fixed and variable length records which will comply with your download specifications and allow for easy uploading to another vendors software package.
Footnotes perform functions which apply to an entire report rather than to specific lines. As you have seen, there are four options available to you in the Process Reports routine when pressing Escape on the Picture/Fields page of a report. To access the Footnote Editor, press the Escape key and choose option 4. Footnotes. Unlike the attributes which you have become accustomed to, the character between a footnote and its expression is a space. This differs from attributes which use an equal sign to separate the attribute and its expression. Remember, footnotes are not attributes. They are followed by a space and not an equal sign.
Note: Since footnotes are not attributes, continuation lines are not allowed. The entire
footnote must fit on one line. This is not an issue unless you are trying to enter MAGIC expressions within your footnotes (which is covered in the Level 2 workshop).
Starting Form Feed
The SFF footnote will suppress the form feed at the beginning of a print job.
Ending Form Feed
The EFF footnote will suppress the form feed at the end of a print job.
Field Delimiter
The FD footnote will use the specified value of the ASCII code to delimit the fields on a report. This footnote is used for files which require a variable length record format.
Considerations When Using the FD Footnote
1. All fields are separated by the specified character.
2. All blank space between the data fields are removed. Therefore, this footnote should only be used for creating variable length records.
3. All non-numeric fields are placed in quotations.
4. Free text should not be placed in the report picture. If this is done, the Report Writer will not insert the field delimiter in the correct positions.
5. If the quotes are not desired for free text fields, you can change the data type of those fields to a numeric data type. This will not affect the output (except for fields with a date data type) and will remove the quotes from the output. Fields with a date data type can be changed to a computed field which uses Z.date.out in the VAL and uses a numeric data type.
Record Length
The RL footnote allows you to create a report whose records are longer than 200 characters.
Considerations When Using the RL Footnote
- The maximum number of characters, entered at the CHAR/LINE prompt on Page 1 of the Report Writer, is still 200. This footnote must be used in conjunction with the NL line attribute. The NL line attribute will suppress the line feed at the end of the line on which it is used. This creates a join between these lines which allows for record lengths longer than 200 characters. The report picture is still limited to 200 characters across.
- Reports can be created for any record length.
- You can spool a report of any length. The width of the report which appears on the spool file is the number from the RL footnote. However, the spool file page calculation ignores the RL footnote and NL attribute when determining the number of pages. Therefore, the number of pages is calculated based on the CHAR/LINE which will result in an inflated figure.
- You can download a report of any length to MEDITECH's MAGIC Office module. However, MAGIC Office will split any files larger than 240 characters into 240 character records.
Formatting Report Output to Download Specifications
You can create reports suitable for downloading to a PC by using certain attributes and footnotes within your report. Downloaded reports usually contain detail records only. However, depending upon your specifications, you may be required to define hierarchical record formats using report header and/or header key regions as well as report trailer and/or trailer key regions.
The Characters Per Line on Page 1 of the Report Writer must be defined between 1 and 200. Therefore, to create records longer than 200 characters, you must suppress the generation of a new line. For example, a 400 character record could be created by joining two lines with a width of 200 characters together. To join the detail lines and suppress the generation of a carriage return/line feed, the NL (New Line) attribute must be used. The NL is defined as a line attribute on all but the last Detail line and has the form: NL=NO
Also, the RL (Record Length) footnote must be used to define the overall length of each record. A four hundred character record would be defined as: RL 400
The number of characters on each line of the report defines the maximum number of characters on each part of the record. When creating records of fixed lengths, the Report Writer strips trailing spaces from each line of the report picture regardless of the NL=NO attribute. Depending on your specifications, you may need to fill blank areas within your report. This can be done by either extending the length of a field or defining a computed fields with a value of “ ” (a space not the nil string) and setting it to the appropriate length.
Example: Fixed Record Length Download
You have been asked to create a report from the main detail segment based on the following specifications:
Create a 150 character fixed record length download report. Include the following information:
Data ElementFormatStart PositionLength
Namefree130
Admit Datemm/dd/yy318
Fillerfree3912
Account Numberfree5112
Unit Numberfree6310
Fillerfree7328
Sexfree1011
Admitting doctorfree10210
Languagefree11239
Since this report is for downloading, we need to suppress page headers and form feeds. This is done on the first page by setting the PAGE BANNER to NONE and answering “N” to the Header and Trailer prompts. No Header or Trailers should be defined on the Sorts/Selects tab. Only the Detail region is defined on the General tab.
Example: Fixed Record Length Download (Cont.)
Notice that the CHARS/LINE is set to 50. Under normal circumstances, you would typically set the CHARS/LINE to 150 and place all of the data on one line. Here, though, this has been setto 50 simply to demonstrate how the NL attribute can be used.
Since our CHARS/LINE is set to 50, we need to define three detail lines on page three to accommodate the 150 character record. We would then define the line attribute of NL=NO on both the first and second detail lines. This will suppress the carriage return/line feeds at the ends of these lines.
We then define the data fields and add them to the report picture:
Example: Fixed Record Length Download (Cont.)
Note that there are no spaces entered between the data fields since the fields must start and end based on your specifications. Any fields which require filler can be set up as follows:
We use this type of field at the end of each of the first two detail lines. Also, we have extended the length of the language field to be 39 characters. This fills the last twenty characters of the record with blank spaces.
The last two things we need to do are to suppress any starting and ending form feeds and to define the record length. These are done by defining the following footnotes:
Example: Fixed Record Length Download (Cont.)
A sample of the report output is listed below:
Quinn,Ryan11/03/08M000012771M002221M
Powell,Katie11/03/08M000012772M002366F
Holmes,Jeff11/03/08M000012804M001906M
Martin,Joe11/03/08M000012821M001751M
Steves,Richard10/31/08M000012806M001539MMCSH
Arnold,Roman11/01/08M000012807M002346MMRKL
Ciemenga,Kasia11/01/08M000012818M002350FMRKL
Boli,Marek11/03/08M000012808M002349MMRKL
Burns,Matthew11/03/08M000012817M002231MHANS
Example: Variable Record Length Download
Variable length records can be produced using a delimiter between each field. Unlike fixed length records which have a specific length associated with each field, variable length records separate the beginning and end of each field with a delimiter. See the previous description of the FD footnote for more information on how field delimiters affect your output.
You have been asked to create a report from the adm.patient.file detail segment in ADM.PAT based on the following specifications:
Create a variable record length download report. Include the following information:
Data ElementFormat
Namefree
Admit Datemm/dd/yy
Fillerfree
Account Numberfree
Unit Numberfree
Agefree
Sexfree
Admitting doctorfree
Languagefree
Since this report is for downloading, we need to suppress page headers and form feeds as we did in the fixed length report. We will still use 50 as our CHARS/LINE. The report picture would look as follows:
Example: Variable Record Length Download (Cont.)
In order to provide the variable length records we required, we need to define the following footnotes:
The footnotes are the same as in the fixed length report except the FD footnote was added. 59 is the ASCII value for the semi-colon, so each field will be delimited by a semicolon. The maximum record length will be 150. The starting and ending form feeds will be suppressed.
The FD footnote will suppress all trailing spaces within the field length as well as spaces between the fields. Each field which has a non-numeric data type will be enclosed in quotes and all fields will be delimited by the semi-colon. If you do not want a field to be contained within quotes, change its data type to be numeric. You can also create blank fill fields using computed fields with a value of " ".
The sample output of this report is listed below:
"BAKER,ELVIS";"";"";"";"0000001947";"00002735";"34";"M";"MEDITECH";""
"OTTAVIANI,BENEDETTO";"";"";"";"0000005010";"00004858";"22";"M";"AMY";""
"BLAKE,RONALD";"";"";"";"0000005036";"00004879";"34";"M";"ALK";""
Data Types used for zero fill
Many specifications request that you zero fill numeric data types. There are three data types that are available to the Report Writer that will aid in zero filling data for a report.
Data TypeOutput Format
ZMONEYRound the value to 2 decimal places, remove the decimal point and zero fill to the length of the field.
ZINTRound to zero decimal places, remove the decimal point and zero fill to the length of the field.
ZDECRound to the specified number of decimal places and remove the decimal point. This data type is used in conjunction with the DEC field attribute.
Examples:
ValueData TypeLengthDecimalResult
123.56ZMONEY70012356
123.00ZMONEY70012300
123.56ZINT70000124
123ZINT70000123
123.56ZDEC730123560
ASCII Values that can be used as Field Delimiters
ASCII table:
MEDITECH
Level One - NPR Report Writer Workshop