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 RPV 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.
Download example files (Kb)
Code
*********************************************************
* RM/COBOL + RPV EXAMPLE
*
* THIS PROGRAM GENERATES A REPORT EXTRACTING DATA
* FROM 'CUSTOMER.DAT' FILE.
*
*********************************************************
 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_1.RPV"
            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(8)  VALUE '{a=r;$2}'.
    03 CUS-ID-PRN       PIC X(9)  VALUE SPACES.
    03 FILLER           PIC X(8)  VALUE '{a=l;$3}'.
    03 CUS-NAME-PRN     PIC X(20) VALUE SPACES.
    03 FILLER           PIC X(8)  VALUE '{tab=50}'.
    03 CUS-LASTNAME-PRN PIC X(20) VALUE SPACES.
    03 FILLER           PIC X(4)  VALUE '{$4}'.
    03 CUS-ADDRESS-PRN  PIC X(50) VALUE SPACES.
    03 FILLER           PIC X(4)  VALUE '{$5}'.
    03 CUS-PHONE-PRN    PIC X(20) VALUE SPACES.
    03 FILLER           PIC X(30) VALUE '{n}'.

 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 'ORIENTATION=2'.
      WRITE LINE-TO-PRINT FROM '$1=400'.
      WRITE LINE-TO-PRINT FROM '$2=1700'.
      WRITE LINE-TO-PRINT FROM '$3=2000'.
      WRITE LINE-TO-PRINT FROM '$4=4500'.
      WRITE LINE-TO-PRINT FROM '$5=7500'.
      WRITE LINE-TO-PRINT FROM
                        'REPORT_TITLE=Customers report #1'.

      WRITE LINE-TO-PRINT FROM '[HEADER]'.

      WRITE LINE-TO-PRINT FROM '{n;F=Arial;s=18;b=y;c=2}'.

      WRITE LINE-TO-PRINT FROM
          '{$1} Rm/Cobol + Rpv Customers report. {n;n}'.

      WRITE LINE-TO-PRINT FROM '{s=12;c=0}'.

      WRITE LINE-TO-PRINT FROM
          '{$1} Example number one {n;n}'.
      WRITE LINE-TO-PRINT FROM
          '{line=400,10000;n;s=9;b=n}'.

      WRITE LINE-TO-PRINT FROM
              '{b=y;A=R;$2} Customer Id {A=L;$3} Name'.

      WRITE LINE-TO-PRINT FROM
              '{$4} Address {$5} Phone {n;n;b=n}'.

      WRITE LINE-TO-PRINT FROM '[DATA]'.

      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 
      'C:PROGRA~1RPVRPV.EXE C:COBOLRPVOUTPUTREPCUS_1.RPV'.
*
 END-PROCESS.   EXIT.
*----------------------------------------------------------------
RPV Report
ORIENTATION=2
$1=400
$2=1700
$3=2000
$4=4500
$5=7500
REPORT_TITLE=Customers report #1
[HEADER]
{\n;F=Arial;s=18;b=y;c=2}
{$1} Rm/Cobol + Rpv Customers report. {\n;\n}
{s=12;c=0}
{$1} Example number one {\n;\n}
{line=400,10000;\n;s=9;b=n}
{b=y;A=R;$2} Customer Id {A=L;$3} Name
{$4} Address {$5} Phone {\n;\n;b=n}
[DATA]
{a=r;$2}000000520{a=l;$3}Alan {tab=50}Bernard {$4}85 Wilson Avenue. {$5}+44 (0)870-444-4563 {\n}
{a=r;$2}000000877{a=l;$3}Robert {tab=50}Bollini {$4}2607 S Milwaukee Ave {$5}(773) 489-9954 {\n}
{a=r;$2}000000899{a=l;$3}Ian Edward {tab=50}Forbes {$4}8319 N Saint Lauwrence Ave {$5}(773) 783-5197 {\n}
{a=r;$2}000001015{a=l;$3}Ian {tab=50}Forbes {$4}655 Masselin Ave. {$5}(323)933-32477 {\n}
{a=r;$2}000001100{a=l;$3}Ralph {tab=50}Wilson {$4}25 Windermere lane. Siparia. {$5}+61-3-3341000 {\n}
{a=r;$2}000001244{a=l;$3}Robert {tab=50}Gancar {$4}778 W 42th Street {$5}(212) 12474645 {\n}
{a=r;$2}000002541{a=l;$3}Jose {tab=50}Pernia {$4}Benarabe 128 {$5}+34-964-2457479 {\n}
{a=r;$2}000002555{a=l;$3}Barry {tab=50}Gasshi {$4}5 Wilson Avenue {$5}+44-020-24579 {\n}
{a=r;$2}000003241{a=l;$3}Michael {tab=50}Jefferson {$4}17 Wickfield House Wilson Grove {$5}+44-5646427 {\n}
{a=r;$2}000003652{a=l;$3}Jaques {tab=50}Piaget {$4}1, av. de L'Imperatrice {$5}05 59416455 {\n}
{a=r;$2}000009125{a=l;$3}Edmondo {tab=50}Spadaveccia {$4}Via F. Caracciolo 14-80154 {$5}+81-5980511 {\n}
{a=r;$2}000085541{a=l;$3}Xavier {tab=50}Parcero {$4}Av. Cutitiba 3212 {$5}+52-74-4653121 {\n}
{a=r;$2}000087777{a=l;$3}Adrian {tab=50}Arjones {$4}Libertador 8621 {$5}+54-1-45641787 {\n}
{a=r;$2}000124632{a=l;$3}Carlos {tab=50}Chavez {$4}Av. Los Leones 1125 {$5}+562-524412 {\n}
{a=r;$2}002245145{a=l;$3}Andrew {tab=50}Adler {$4}Av. Los Samanes 1111 {$5}+582-7829451 {\n}
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.