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.
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}