sams_teach_yourself_cobol_in_24_hours_-_hour_19_reporting

Sams Teach Yourself COBOL in 24 Hours - Hour 19 Reporting

Return to Teach Yourself COBOL in 24 Hours, COBOL bibliography, COBOL, COBOL DevOps, Awesome COBOL, Awesome IBM Mainframe, IBM Mainframe development, IBM Mainframe bibliography, Fortran

“ (TYCb24H 1998)

Hour 19 Reporting

Business today relies on computers. More specifically, business today relies on the reports generated by computers. Computers are fantastic for gathering, storing, sorting, analyzing, and generally processing information. Ultimately the results of this activity must be made available to the end user. This hour covers the basics of creating a report, including topics such as

• The importance of reports

• Report layout design

• Defining report records in Working-Storage

• Writing Before and After Advancing

• Page breaks

Historically, programs presented output to the user in the form of printed reports. Even today, the printed report is the primary means of data presentation in business. Nevertheless, reports are not always printed on paper. They can be saved to files, sent via email, faxed, or displayed on the screen via a Web browser. Today users receive reports via a nearly infinite variety of methods.

Reports range from large inventory listings that show each and every item to month-end and year-end summary reports that give a snapshot of a company’s financial status. When you go shopping and the computer prints your receipts, you are receiving a report. When you open your bank statement, you are looking at a computer-generated report. Reporting is extremely fundamental to the business process.

Regardless of the delivery method, the basics of reporting have remained the same. The result of the data processing must be delivered to the user in a clear, concise, and easy-to-understand format.

Creating Reports An important part of any business-programming task is creating reports. COBOL has some simple features built into the language to aid in report creation. You are already aware of the different data-editing capabilities of the language. These play a big part in the reporting process. To make reports readable and easy to understand, the various data fields are edited. Instead of representing 12 dollars and 99 cents as 00001299, a good report will show $12.99. Dates should be displayed in the format that users expect. In the United States, this format is MM/DD/YYYY or MM/DD/YY. Showing a report-creation date of 990317 is cryptic and hard to understand; 03/17/99 more readily identifies the information as a date to the user. Try to keep your reporting as plain, simple, and clear as possible.

Designing Your Report Layout The most important step in developing a useful report is planning. Before you can write a program that creates a report, you must decide how the final report should look. This planning tool is called the report layout. The report layout can be anything from a loose sketch on a piece of paper to a tightly controlled formalized report description. Reports are frequently designed on report layout forms. A report layout form is simply a paper form with horizontal and vertical lines, corresponding to lines and columns on the page. A typical page printed on a modern laser printer is 80 columns wide and 60 lines long. The examples in this book adhere to the 80-by-60 standard. Reports usually have heading lines that describe the contents of the report and give information about its creation. Page numbers are usually included. It is a good idea to include information such as the name of the program that created the report with the date and time the report was produced.

The first reporting example creates a report from the dealer file. This report shows the dealer name, last rent paid date, next rent due date, and rent amount. One line is printed per entry. The report has a title, page number, and headings. The layout is as follows:

Created by: CHAPT19A Dealer File Rent Report Page XXXX Created on: MM/DD/YY At: HH:MM:SS

                                        Last Rent  Next Rent       Rent
Name Paid Due Amount

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MM/DD/YYYY MM/DD/YYYY $$$,$$$.99 When creating a report, each horizontal print line is represented by a print record. The records are created in Working-Storage. A typical report has one or more heading lines followed by detail lines. The detail line contains the report details, hence the name. The following Working-Storage entries describe the report lines used for this first report.

000050 01 Heading-Line-1. 000051 03 Filler Pic X(12) Value “Created by:”. 000052 03 Filler Pic X(8) Value “CHAPT19A”. 000053 03 Filler Pic X(11) Value Spaces. 000054 03 Filler Pic X(23) Value “Dealer File Rent Report”. 000055 03 Filler Pic X(10) Value Spaces. 000056 03 Filler Pic X(5) Value “Page”. 000057 03 Page-No Pic Z(4)9 Value Zeros. 000058 01 Heading-Line-2. 000059 03 Filler Pic X(12) Value “Created on:”. 000060 03 Date-MM Pic 99. 000061 03 Filler Pic X Value “/”. 000062 03 Date-DD Pic 99. 000063 03 Filler Pic X Value “/”. 000064 03 Date-YY Pic 99. 000065 01 Heading-Line-3. 000066 03 Filler Pic X(12) Value “At:”. 000067 03 Time-HH Pic 99. 000068 03 Filler Pic X Value “:”. 000069 03 Time-MM Pic 99. 000070 03 Filler Pic X Value “:”. 000071 03 Time-SS Pic 99. 000072 01 Heading-Line-4. 000073 03 Filler Pic X(41) Value Spaces. 000074 03 Filler Pic X(27) Value “Last Rent Next Rent”. 000075 03 Filler Pic X(4) Value “Rent”. 000076 01 Heading-Line-5. 000077 03 Filler Pic X(44) Value “Name”. 000078 03 Filler Pic X(29) Value “Paid Due Amount”. 000079 01 Detail-Line. 000080 03 Detail-Name Pic X(40) Value Spaces. 000081 03 Filler Pic X Value Spaces. 000082 03 Last-Rent-Paid-Date Pic 99/99/9999. 000083 03 Filler Pic X Value Spaces. 000084 03 Next-Rent-Due-Date Pic 99/99/9999. 000085 03 Filler Pic X Value Spaces. 000086 03 Rent-Amount Pic $$$,$$$.99. Notice the use of literals and Filler areas in the different print line descriptions. You can see the print lines as they are described in Working-Storage and how they relate to the visual representation of the report layout. Edit patterns are used for many of the fields.

Creating a report is accomplished by writing the different heading and detail lines to the printer. The printer is merely another Sequential file as far as the COBOL program is concerned. Many compilers use a special name to Assign in the Select statement when defining a printer to the program. This name is Printer. The Select statement for Chapt19a follows.

000011 Select Report-File Assign To Printer. The newly defined Report-File must have a corresponding FD in the program.

000020 FD Report-File. 000021 01 Report-Record Pic X(80). Notice that the report record does not have a special record layout. All records are written to the Report-File using Write with From.

When creating a report, the file assigned to the Printer is opened for Output in the program.

The Write Statement and Reports The COBOL Write statement has several options that make creating printed reports easy. These clauses—Before and After—position the print on the page.

The Before and After clauses allow you to Write print records Before and After Advancing the specified number of print lines. In addition, these clauses allow you to Write your print records Before or After a Page break.

For example, the normal print logic is to print a line After Advancing a single line. This clause causes the printer to scroll down a single line and then print the print line. The corresponding code follows.

000138 Write Report-Record from Detail-Line After Advancing 1 The word Advancing is optional and may be omitted. When it is time to print the next print line, the process is repeated. If you want a double-spaced report, you can Write all of your print lines After Advancing 2. If you want to Write a print line exactly where the printer is positioned, without skipping down a line, you can either Write After Advancing 0, or Write Before Advancing 1.

Creating a report requires you to control the line spacing of the printer. It’s not the same as choosing single or double spacing. The programmer is required to control every action that the printer takes when printing a report. When you Write to the Printer, you send the print line that you want to have printed, along with the action you want the printer to take in reference to that line. If you send every line to the Printer with After Advancing 0, then all the print lines print on top of one another because the printer does not advance the paper.

After Advancing causes the printer to advance to the next print line before writing the record. After the record is written, the printer remains positioned on that same print line. This clause allows you to print over that line again. You may intend to do so, or it may happen to you by accident! If you print a line After Advancing 1 and then print another line After Advancing 0, the second line prints over the first.

Before Advancing does just the opposite. When Before is used, the print line is written to the Printer, and then the specified printer control is performed. When Before Advancing is used, unless a value of zero is specified, the printer is always positioned on a blank line.

The number of lines to advance does not need to be a numeric literal. You can also use a numeric data item. The value must not be a negative number.

000101 Write Report-Record After Advancing Lines-To-Feed In addition to Advancing a number of lines, you can execute a Write and cause the printer to advance to a new Page. This type of Write is frequently performed when writing a heading line.

000147 Write Report-Record From Heading-Line-1 After Page This statement causes the printer to advance to a new Page and then print your heading line.

Before Advancing works exactly as you would expect. It first prints the line and then advances the specified number of lines or Page. As you can see, you would not want to use Before Advancing when printing a heading line. Consider the following instruction:

000147 Write Report-Record From Heading-Line-1 Before Page If you execute line 147, the printer prints your heading line and then advances to a new Page! This result is not exactly what you had in mind.

If the Before or After is omitted when writing to a Printer, the compiler assumes After 1.

Programming for Page Breaks One of the issues that you face when creating reports is the proper printing of the heading and detail lines. Ideally, the headings should be at the top of each page, with a page number, followed by the detail. When the page is full, you should advance to a new Page, printing a set of headings and then more detail, until the report is complete. Starting a new page is called a page break.

To control this process, you have to count lines and pages. You need to know how many lines can be printed on a page. As print lines are written to the Printer, the counter is incremented. When the maximum number of lines that can be on a page is reached, a new page with headings is printed. One method programmers use is to Write the first heading lines when the Printer is opened. I dislike this approach, as it causes a report to be printed when, in fact, there may be no data to print. Instead, I like the alternative approach.

The second approach involves an initial value in the line counter that is higher than the maximum number of lines on the page. This method allows the normal program logic to examine the line counter before printing the detail line and to print a new page and heading lines before printing the report detail if the maximum line count has been exceeded. The advantage to this approach is that no heading lines will be printed unless there is a detail record to be printed under them. The page counter starts at zero and is incremented before each set of report headings is printed.

The following program fulfills the reporting requirements described earlier in the hour. Notice that the Report-File is assigned to the reserved name Printer. Printer is not a data item declared anywhere in your program. See Listing 19.1.

Listing 19.1 A Simple Report

000001 @OPTIONS MAIN,TEST 000002 Identification Division. 000003 Program-Id. Chapt19a. 000004* Simple Report 000005 Environment Division. 000006 Configuration Section. 000007 Source-Computer. IBM-PC. 000008 Object-Computer. IBM-PC. 000009 Input-Output Section. 000010 File-Control. 000011 Select Report-File Assign To Printer. 000012 Select Dealer-File Assign To “Dealer.Dat” 000013 Organization Indexed 000014 Access Sequential 000015 Record Key Dealer-Number 000016 Alternate Record Key Dealer-Name 000017 File Status Dealer-Status. 000018 Data Division. 000019 File Section. 000020 Fd Report-File. 000021 01 Report-Record Pic X(80). 000022 Fd Dealer-File. 000023 01 Dealer-Record. 000024 03 Dealer-Number Pic X(8). 000025 03 Dealer-Name.

000026 05 Last-Name Pic X(25). 000027 05 First-Name Pic X(15). 000028 05 Middle-Name Pic X(10). 000029 03 Address-Line-1 Pic X(50). 000030 03 Address-Line-2 Pic X(50). 000031 03 City Pic X(40). 000032 03 State-Or-Country Pic X(20). 000033 03 Postal-Code Pic X(15). 000034 03 Home-Phone Pic X(20). 000035 03 Work-Phone Pic X(20). 000036 03 Other-Phone Pic X(20). 000037 03 Start-Date Pic 9(8). 000038 03 Last-Rent-Paid-Date Pic 9(8). 000039 03 Next-Rent-Due-Date Pic 9(8). 000040 03 Rent-Amount Pic 9(4)v99. 000041 03 Consignment-Percent Pic 9(3). 000042 03 Last-Sold-Amount Pic S9(7)v99. 000043 03 Last-Sold-Date Pic 9(8). 000044 03 Sold-To-Date Pic S9(7)v99. 000045 03 Commission-To-Date Pic S9(7)v99. 000046 03 Filler Pic X(15). 000047 Working-Storage Section. 000048 01 Dealer-Status Pic XX Value Zeros. 000049 88 Dealer-Success Value “00” Thru “09”. The heading and detail lines are described here in Working-Storage.

000050 01 Heading-Line-1. 000051 03 Filler Pic X(12) Value “Created by:”. 000052 03 Filler Pic X(8) Value “CHAPT19A”. 000053 03 Filler Pic X(11) Value Spaces. 000054 03 Filler Pic X(23) Value “Dealer File Rent Report”. 000055 03 Filler Pic X(10) Value Spaces. 000056 03 Filler Pic X(5) Value “Page”. 000057 03 Page-No Pic Z(4)9 Value Zeros. 000058 01 Heading-Line-2. 000059 03 Filler Pic X(12) Value “Created on:”. 000060 03 Date-MM Pic 99. 000061 03 Filler Pic X Value “/”. 000062 03 Date-DD Pic 99. 000063 03 Filler Pic X Value “/”. 000064 03 Date-YY Pic 99. 000065 01 Heading-Line-3. 000066 03 Filler Pic X(12) Value “At:”. 000067 03 Time-HH Pic 99. 000068 03 Filler Pic X Value “:”. 000069 03 Time-MM Pic 99. 000070 03 Filler Pic X Value “:”. 000071 03 Time-SS Pic 99. 000072 01 Heading-Line-4. 000073 03 Filler Pic X(41) Value Spaces.

000074 03 Filler Pic X(27) Value “Last Rent Next Rent”. 000075 03 Filler Pic X(4) Value “Rent”. 000076 01 Heading-Line-5. 000077 03 Filler Pic X(44) Value “Name”. 000078 03 Filler Pic X(29) Value “Paid Due Amount”. 000079 01 Detail-Line. 000080 03 Detail-Name Pic X(40) Value Spaces. 000081 03 Filler Pic X Value Spaces. 000082 03 Last-Rent-Paid-Date Pic 99/99/9999. 000083 03 Filler Pic X Value Spaces. 000084 03 Next-Rent-Due-Date Pic 99/99/9999. 000085 03 Filler Pic X Value Spaces. 000086 03 Rent-Amount Pic $$$,$$$.99. The necessary counters for tracking the number of lines printed and the page number are coded next. Notice that the initial value of Line-Count is 99. The Max-Lines data item contains the maximum number of lines that is desired per page. Because 99 is greater than this value, a page break is triggered for the first detail record encountered.

000087 01 Line-Count Pic 99 Value 99. 000088 01 Page-Count Pic 9(4) Value Zeros. 000089 01 Max-Lines Pic 99 Value 60. Some working fields are set up here to handle date and time formatting for the report headings.

000090 01 Date-And-Time-Area. 000091 03 Work-Date Pic 9(6). 000092 03 Work-Date-X Redefines Work-Date. 000093 05 Date-YY Pic 99. 000094 05 Date-MM Pic 99. 000095 05 Date-DD Pic 99. 000096 03 Work-Time Pic 9(8). 000097 03 Work-Time-X Redefines Work-Time. 000098 05 Time-HH Pic 99. 000099 05 Time-MM Pic 99. 000100 05 Time-SS Pic 99. 000101 05 Filler Pic XX. 000102 000103 Procedure Division. 000104 Declaratives. 000105 Dealer-File-Error Section. 000106 Use After Standard Error Procedure On Dealer-File 000107 . 000108 Dealer-Error-Paragraph. 000109 Display “Error on Dealer File “ Dealer-Status 000110 . 000111 End Declaratives. The program first opens the files, including the Printer file. If the input file Open is successful, the program retrieves the date and time and places these in the heading lines. No report records are written yet. The Start statement allows the printing of the report in name sequence. The file is then processed one record at a time until there is no longer a successful return code on the dealer file.

000112 Chapt19a-Start. 000113 Display “Begin Process Chapt19a” 000114 Perform Open-Files 000115 If Dealer-Success 000116 Perform Fill-Initial-Headings 000117 Perform Start-Alternate-Key 000118 Perform Process-File Until Not Dealer-Success 000119 Perform Close-Files 000120 End-If 000121 Stop Run. 000122 Start-Alternate-Key. 000123 Move Low-Values To Dealer-Name 000124 Start Dealer-File Key Not < Dealer-Name 000125 . The Process-File paragraph merely reads the input data file. If it is not the end of file, data from the record that was just read is printed. If it is the end of file, nothing happens in this Paragraph, but because the dealer File Status is set to 10 for end of file, the processing loop terminates.

000126 Process-File. 000127 Read Dealer-File 000128 At End Continue 000129 Not At End 000130 Perform Print-This-Record 000131 End-Read 000132 . The first thing that happens before the detail record can be printed is the formatting of the name. In the dealer file, the name is split into its three parts—first, last, and middle. The report requires them to be in a single field. After that, the fields in the dealer record that are also in the detail line are moved with a simple Move with Corresponding. The only fields moved from the dealer file are Last-Rent-Paid-Date, Next-Rent-Due-Date and Rent-Amount. These three fields are the only fields that the two records have in common.

000133 Print-This-Record. 000134 Perform Format-Name 000135 Move Corresponding Dealer-Record To Detail-Line After the detail record is constructed, the line counter is checked to see whether a new page with a set of headings is necessary. If the line count is reached, or exceeded, the heading line is printed.

000136 If Line-Count >= Max-Lines 000137 Perform Heading-Routine 000138 End-If Image

Why not just check for = when comparing the line count? The reason is that not all reporting tasks print a single print line per detail record. In some cases, multiple print lines are created for a single input record. The user does not want the detail for a single item to span multiple pages, so the line counter is checked only before the first detail Write for a particular input record. The number of actual print lines may exceed the maximum the next time it is checked, and the equal condition may never occur, causing the program to print multiple pages of report without the appropriate page breaks.

After checking for a new page, and printing the heading lines if necessary, the detail line may be printed. Notice that the detail line is printed After Advancing a single line. The report is single-spaced. Always add the proper number of lines to the line counter after printing the detail lines.

000139 Write Report-Record From Detail-Line After 1 000140 Add 1 To Line-Count 000141 . The heading routine is interesting. The first thing that happens is that the page counter is incremented and moved to the appropriate field in the heading record for printing. Remember that the initial value specified in Working-Storage was zero. Notice the check for page 1. It is executed because the printer is positioned at a new page when the report starts printing. Sending a page break to the printer on the first page is a waste of paper, and annoys most users. This check allows the first line to either print after a page break, if this is not the first page, or on the first line of the current page if it is. After Zero causes the printer to print only the current line and not change the paper position.

000142 Heading-Routine. 000143 Add 1 To Page-Count 000144 Move Page-Count To Page-No 000145 If Page-Count = 1 000146 Write Report-Record From Heading-Line-1 After Zero 000147 Else 000148 Write Report-Record From Heading-Line-1 After Page 000149 End-If The second and third heading lines print After 1 line and follow the first one. However, an extra space is desired before the fourth heading line. Therefore, it is printed using After 2. This clause causes the printer to skip two lines and then print the detail line.

000150 Write Report-Record From Heading-Line-2 After 1 000151 Write Report-Record From Heading-Line-3 After 1 000152 Write Report-Record From Heading-Line-4 After 2 Notice the apparently strange printing of heading line 5 (see lines 153 and 154). First, it is printed After 1 and then again Before 2. What does this coding accomplish? On older impact printers, before the day of lasers, this common technique was used to over-strike a print line and make the printing appear bold. With Windows-based printing, the line is physically printed only once. Printing Before 2 inserts a blank line between the last heading line and the first detail line on the page the second time the line is printed. An alternative to this approach is to Move spaces to the print record and then print After 1 again.

000153 Write Report-Record From Heading-Line-5 After 1 000154 Write Report-Record From Heading-Line-5 Before 2 When printing your heading lines, you do not have to count lines after every print. Simply move the total number of lines advanced to the line counter to reset the count.

000155 Move 7 To Line-Count 000156 . The name formatting that occurs here simply strings the three names into one. It is not as good a routine as it might be. If embedded spaces occur in any of the names, this method does not properly assemble the full name. A technique for properly handling this type of situation is discussed in Hour 22, “Other Intrinsic Functions.”

000157 Format-Name. 000158 Move Spaces To Detail-Name 000159 String First-Name Delimited By Space 000160 “ “ Delimited By Size 000161 Middle-Name Delimited By Space 000162 “ “ Delimited By Size 000163 Last-Name Delimited By Space 000164 Into Detail-Name 000165 End-String 000166 . This next paragraph is the one that accepts the system date and time and formats them for the report. Because the formats of the fields are in the reverse order of what people are used to looking at, the Move Corresponding handles moving the appropriate fields to the heading record, where they are formatted in a more normal order. Remember that the date returned has only the last two digits of the year and should not be used in any calculations. However, using the two-digit date for cosmetic purposes on a report is acceptable.

000167 Fill-Initial-Headings. 000168 Accept Work-Date From Date 000169 Accept Work-Time From Time 000170 Move Corresponding Work-Date-X To 000171 Heading-Line-2

000172 Move Corresponding Work-Time-X To 000173 Heading-Line-3 000174 . 000175 Open-Files. 000176 Open Output Report-File 000177 Input Dealer-File 000178 . 000179 Close-Files. 000180 Close Report-File 000181 Dealer-File 000182 . Compile, link, and run the program. If you allow the report to finish printing, it will be nearly 100 pages, so cancel it if you don’t want the whole document to print. As you run the program, you need to adjust the printer font, which defaults to a small seven dots per inch. Fujitsu provides a runtime option that you can change to adjust the print size to a more standard size for the PC. (This option is not available if you installed the 16-bit version of the compiler.) Selecting the TYPE-PC font results in larger, monospaced print.

• Select the program from WINEXEC. The runtime environment setup window appears.

• Choose the Environment Setup menu option.

• Select the Keyword menu item.

• Click @CBR_PrinterANK_Size.

• Click the Selection button.

• Click in the field to the left of the Set button and position the cursor after the = sign.

• Enter TYPE-PC after the =. The entire line should now say

    @CBR_PrinterANK_Size=TYPE-PC.
• Click the Set button.

• Click the Save button.

• Select OK when asked whether you want to add the entry to the INI file. This setting is in effect only for the execution of this particular program name.

When you next run the program, it will print with a more reasonable font size.

Printing reports usually does not involve this simple one-data-record, one-print-record approach. Sometimes multiple data records are read from various files to construct a single print line. At other times, reporting programs limit the data records that are being reported by allowing the user to specify certain selection criteria.

What if you want the program to print only those dealers with numbers that begin with the letter C? When you design and code your programs, remember to keep them clear and easy to follow. Don’t use strange, inappropriate data names. Try to keep things self-explanatory. If your program is properly written, using a structured approach, future modification will be a minor task. What change is necessary to ensure that the program selects only dealer records with numbers that start with the letter C? Because of the structured approach used, the change is very simple:

000285 Read Dealer-File 000286 At End Continue 000287 Not At End 000288 If Dealer-Number (1:1) = “C” 000289 Perform Print-This-Record 000290 End-If 000291 End-read For this single selection, the If statement around the Perform will suffice. If you have more complex selection logic, you can Perform a Paragraph that sets a switch you can check to see whether this particular record was selected.

000285 Read Dealer-File 000286 At End Continue 000287 Not At End 000288 Perform Check-Record 000289 If Use-Record 000290 Perform Print-This-Record 000291 End-If 000292 End-Read Occasionally, you might want to underline a line on a report. To do so, define a new line in Working-Storage.

000020 01 Underline-Line Pic X(80) Value all “_”. Then, when printing the line you wish to underline, make sure not to advance a line afterward. For example, use After Advancing 0. The printer remains at the beginning of the last print line printed. Then print the Underline-Line with the normal After Advancing clause.

000040 Write Report-Record From Underline-Line After Advancing 1 Reports are frequently written as the Output Procedure from a Sort. In this situation, instead of a record Read, you are executing a Return on the Sort record. Functionally, nothing is really different from coding a program for a report. All the report-printing logic is contained within the Output Procedure. The exercise at the end of this hour requires you to write a report in the Output Procedure of a program that uses Sort.

During the development process of a system, you might want to look at a report without actually printing it. Because a report file assigned and written to Printer is just another Sequential file as far as the compiler is concerned, you can change the Select statement and create a file instead. Instead of assigning the Report-File to Printer, change the Assign to something similar to “PRINT.IMG”. The report is written to the file, instead of the printer. You can view the file in your favorite text editor, make necessary adjustments, and then run the program again.

Summary In this hour, you learned the following:

• Reporting is an important programming function.

• Reports consist of heading lines and detail lines.

• A report is simply another Sequential file as far as the compiler is concerned.

• Reports can be written to the Printer or to another Sequential file.

• When printing a report, the programmer is responsible for controlling the printer. This task is accomplished using Write, with the Before and After clauses.

• When creating reports, the programmer must keep track of the number of lines on a page and the number printed to control the occurrence of page breaks.

• Reporting makes extensive use of the data-editing features of COBOL to produce clear, easy-to-understand documents.

Q&A Q If a report file is just a Sequential file, why can’t I just Write Line Sequential records to the Printer?

A You can. However, you lose the advantage of being able to simply single, double, and triple space. You can’t cause a page break, and you can’t do things like overprinting and underlining. The printer control features of COBOL provide this flexibility.

Q When I execute a Write Print-Record After 1 and then follow it up with a Write Print-Record Before 1, what happens?

A The first Write advances the printer to the next line and then prints the record. The next Write prints on top of the last print line and then advances to the next blank line.

Q Can I make the printer advance backward?

A No. All Advancing is in a forward direction. But you can control whether the printer Advancing occurs Before or After your print line is written.

Q When I print to a file and I try to underline something, I still get two records in the file. Why?

A In actuality you really have two records. By controlling the Advancing when you Write to a Printer, the result just looks like one line because the printer does not move after printing the first line.

Workshop To help reinforce your understanding of the material presented in this hour, refer to the section “Quiz and Exercise Questions and Answers” that can be found on the CD. This section contains quiz questions and exercises for you to complete, as well as the corresponding answers.

Fair Use Sources

COBOL: COBOL Fundamentals, COBOL Inventor - COBOL Language Designer: 1959 by Howard Bromberg, Norman Discount, Vernon Reeves, Jean E. Sammet, William Selden, Gertrude Tierney, with indirect influence from Grace Hopper, CODASYL, ANSI COBOL, ISO/IEC COBOL; Modern COBOL - Legacy COBOL, IBM COBOL, COBOL keywords, COBOL data structures - COBOL algorithms, COBOL syntax, Visual COBOL, COBOL on Windows, COBOL on Linux, COBOL on UNIX, COBOL on macOS, Mainframe COBOL, IBM i COBOL, IBM Mainframe DevOps, COBOL Standards, COBOL Paradigms (Imperative COBOL, Procedural COBOL, Object-Oriented COBOL - COBOL OOP, Functional COBOL), COBOL syntax, COBOL installation, COBOL containerization, COBOL configuration, COBOL compilers, COBOL IDEs, COBOL development tools, COBOL DevOps - COBOL SRE, COBOL data science - COBOL DataOps, COBOL machine learning, COBOL deep learning, COBOL concurrency, COBOL history, COBOL bibliography, COBOL glossary, COBOL topics, COBOL courses, COBOL Standard Library, COBOL libraries, COBOL frameworks, COBOL research, Grace Hopper, COBOL GitHub, Written in COBOL, COBOL popularity, COBOL Awesome list, COBOL Versions. (navbar_cobol)


© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


sams_teach_yourself_cobol_in_24_hours_-_hour_19_reporting.txt · Last modified: 2024/04/28 03:37 (external edit)