RPV Reports / Usage Examples
 
Search in RpvSoftware.com
Go!                                         English    Español

What Rpv is

Rpv Reports 2024

Downloads

Training/Consultancy

Support

Purchase

Contact

 
Home > Usage Examples > Cobol Examples
Generating an RPX report with Rm/COBOL
The following example shows us how to prepare a report and preview it using RM/COBOL + RPV.
Program takes data from CUSTOMER.DAT file and transforms it into a file readable/printable by Rpv.
Although this program generates virtually the same result than the example #1, its format is RPX instead of RPV.

The most four important advantages of RPX formats are:
1- Format RPX lets you send ONLY THE DATA and it is not necessary that you FORMAT the report inside your program.
2- It is not necessary to recompile your CBL program to make a change in your report.
3- The CBL code is smaller and is more readable by others.
4- The RPX code generated is quite smaller.
Download example files (Kb)
Code
*********************************************************
* RM/COBOL + RPV EXAMPLE  (RPX FORMAT)
*
* THIS PROGRAM GENERATES A REPORT EXTRACTING DATA
* FROM 'CUSTOMER.DAT' FILE.
*
* THE RESULTS OF THIS FILE IS THE SAME REPCUS_1.CBL
*
*********************************************************
 IDENTIFICATION DIVISION.
 PROGRAM-ID. REPCUS-1.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SPECIAL-NAMES.
        DECIMAL-POINT IS COMMA.
 INPUT-OUTPUT SECTION.
 FILE-CONTROL.
     COPY SELCUS.CPY.

     SELECT OUT-PRINTER ASSIGN TO DISK 
                 "C:COBOLRPVOUTPUTREPCUS_2.RPX"
            FILE STATUS IS STATUS-PRN.


 DATA DIVISION.
 FILE SECTION.
     COPY MAPCUS.CPY.

 FD OUT-PRINTER.
 01   LINE-TO-PRINT PIC X(220).

 WORKING-STORAGE SECTION.
 77 STATUS-ISM     PIC XX VALUE SPACES.
 77 STATUS-PRN     PIC XX VALUE SPACES.
 77 STATUS-KEY     PIC 99 VALUE ZEROS.

 77 AXEPT          PIC X  VALUE SPACE.


* HERE WE DECLARE THE LINES TO BE PRINTED.

 01 LINE-DETAIL.
    03 FILLER          PIC X(10)  VALUE '|MYDETAIL|'.
    03 CUS-ID-PRN      PIC Z(9)  VALUE SPACES.
    03 FILLER          PIC X(1)  VALUE '|'.
    03 CUS-NAME-PRN    PIC X(20) VALUE SPACES.
    03 FILLER          PIC X(1)  VALUE '|'.
    03 CUS-LASTNAME-PRN PIC X(20) VALUE SPACES.
    03 FILLER          PIC X(1)  VALUE '|'.
    03 CUS-ADDRESS-PRN PIC X(50) VALUE SPACES.
    03 FILLER          PIC X(1)  VALUE '|'.
    03 CUS-PHONE-PRN   PIC X(20) VALUE SPACES.
    03 FILLER          PIC X(1)  VALUE '|'.

 COPY WIN.CPY.
*------------------------------------------------------------
 SCREEN SECTION. 

 01 SCR.
    03 ARC-CRT.
       05 LINE 3 COLUMN 10 VALUE
                 'Press ENTER to generate the report.'.
       05 COLUMN PLUS 1 PIC X USING AXEPT.


 PROCEDURE DIVISION.
 DECLARATIVES.
 C-E SECTION.
              USE AFTER STANDARD ERROR PROCEDURE ON
                        CUSTOMERS OUT-PRINTER.
 END DECLARATIVES.
 PRIMA SECTION.
 MAIN-PROGRAM.
*
       DISPLAY SPACE ERASE.
       MOVE ZEROS TO STATUS-KEY.
       DISPLAY ARC-CRT.
       ACCEPT  ARC-CRT.
       ACCEPT STATUS-KEY FROM ESCAPE KEY.
       IF STATUS-KEY = 13 
          OPEN INPUT CUSTOMERS
          OPEN OUTPUT OUT-PRINTER
          PERFORM PROCESS THRU END-PROCESS
       END-IF.
       DISPLAY SPACE ERASE.
       STOP RUN.
*
*--------------------------------------------------------------
 PROCESS.
*
      WRITE LINE-TO-PRINT FROM 'TEMPLATE=C:COBOLRPVTEMP_CUS.RPV'.
      PERFORM UNTIL STATUS-ISM = '10'
         READ CUSTOMERS NEXT
         IF STATUS-ISM = '00'
            MOVE CUS-ID       TO CUS-ID-PRN
            MOVE CUS-NAME     TO CUS-NAME-PRN
            MOVE CUS-LASTNAME TO CUS-LASTNAME-PRN
            MOVE CUS-ADDRESS  TO CUS-ADDRESS-PRN
            MOVE CUS-PHONE    TO CUS-PHONE-PRN
            WRITE LINE-TO-PRINT FROM LINE-DETAIL
         END-IF
      END-PERFORM.
      CLOSE CUSTOMERS OUT-PRINTER.
      CALL 'SYSTEM' USING 
RPV Report
TEMPLATE=C:\COBOLRPV\TEMP_CUS.RPV
|MYDETAIL| 520|Alan |Bernard |85 Wilson Avenue. |+44 (0)870-444-4563 |
|MYDETAIL| 877|Robert |Bollini |2607 S Milwaukee Ave |(773) 489-9954 |
|MYDETAIL| 899|Ian Edward |Forbes |8319 N Saint Lauwrence Ave |(773) 783-5197 |
|MYDETAIL| 1015|Ian |Forbes |655 Masselin Ave. |(323)933-32477 |
|MYDETAIL| 1100|Ralph |Wilson |25 Windermere lane. Siparia. |+61-3-3341000 |
|MYDETAIL| 1244|Robert |Gancar |778 W 42th Street |(212) 12474645 |
|MYDETAIL| 2541|Jose |Pernia |Benarabe 128 |+34-964-2457479 |
|MYDETAIL| 2555|Barry |Gasshi |5 Wilson Avenue |+44-020-24579 |
|MYDETAIL| 3241|Michael |Jefferson |17 Wickfield House Wilson Grove |+44-5646427 |
|MYDETAIL| 3652|Jaques |Piaget |1, av. de L'Imperatrice |05 59416455 |
|MYDETAIL| 9125|Edmondo |Spadaveccia |Via F. Caracciolo 14-80154 |+81-5980511 |
|MYDETAIL| 85541|Xavier |Parcero |Av. Cutitiba 3212 |+52-74-4653121 |
|MYDETAIL| 87777|Adrian |Arjones |Libertador 8621 |+54-1-45641787 |
|MYDETAIL| 124632|Carlos |Chavez |Av. Los Leones 1125 |+562-524412 |
|MYDETAIL| 2245145|Andrew |Adler |Av. Los Samanes 1111 |+582-7829451 |
Screenshot
Screenshot

Home
What Rpv is
Rpv Reports 2024

Products
Rpv Reports 2024
Personalized edition

More...
Downloads
Support
Rpv Reports Online help
Rpv Visual Editor online help
Examples
/temp section
Videos




Copyright (c) 2001-2024 - Rpv Software. All rights reserved.