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
How to generate a report using PowerCOBOL
The following example shows us how to prepare a report and preview it using PowerCOBOL + RPV.
It is important to observe that to get the graphical quality that Windows produces, is not strictly necessary that you work with graphical environment. It can also be obtained using Ms-DOS.
Download example files (Kb)
Code
WORKING-STORAGE SECTION.
77 columna pic 9(5).
77 idx pic 9(4).
77 ciclo pic 9(4).
77 ptr pic s9(5) comp-5.
77 intp pic 9(4).
77 remp pic 9.
77 nro pic s9(9)v99.

01 lineas.
   02 part1.
      03 pic x(9) value "Linea N° ".
      03 l-01n pic 9(4).
   02 part2.
      03 pic x(38) value "Detalle correspondiente a la linea N° ".
      03 l-02n pic 9(4).
*> ---------------------------------------------------------------
   02 nro-e pic $$$.$$$.$$9,99. *> CHANGE THIS EDIT FIELD ACCORDING
                                   YOUR REGIONAL SETTINGS
*> ---------------------------------------------------------------
PROCEDURE DIVISION.
   move "Text" OF titulo to wtitulo
   move "Text" OF CmCombo1 to ciclo
* Initialization
   open output rpv-file
   move "report_title=From PowerCOBOL - by Jose Holzmann" to rpv-line
   write rpv-rcd
   move "papersize=letter" to rpv-line *> A4, letter, legal, Ejecutive
   write rpv-rcd
   move "spacing=250" to rpv-line
   write rpv-rcd

   move spaces to rpv-line
   move "Caption" OF CmStatic6 to columna
   string "$c1=" delimited by size
   columna delimited by " " into rpv-line
   write rpv-rcd
   move "Caption" OF CmStatic7 to columna
   string "$c2=" delimited by size
   columna delimited by " " into rpv-line
   write rpv-rcd
   move "Caption" OF CmStatic8 to columna
   string "$c3=" delimited by size
   columna delimited by " " into rpv-line
   write rpv-rcd

* Header
   move "[Header]" to rpv-line
   write rpv-rcd
   move "{f=arial;s=8}" to rpv-line
   write rpv-rcd
   move "{pic=bar.bmp,400,400,750,490}" to rpv-line
   write rpv-rcd
   move "{n;a=r;10400} Pagina {a=r;11000;pag}" to rpv-line
   write rpv-rcd
   string "{s=16;n;11000;c=3;b=y;a=r}" delimited by size
   wtitulo delimited by size
   "{spacing=420;c=0;n}" delimited by size into rpv-line
   write rpv-rcd
   move "{LINE=400,11000}{spacing=60;n}" to rpv-line
   write rpv-rcd
   move
   "{s=8;b=y;a=l;$c1}Numero{$c2}Descripcion{a=r;$c3}Importe{a=l;b=n;spacing=250;n}"
   to rpv-line
   write rpv-rcd
   move "{LINE=400,11000;n}" to rpv-line
   write rpv-rcd

* Data
   move "[Data]" to rpv-line
   write rpv-rcd
   move 0 to idx
   perform ciclo times
      add 1 to idx
      divide idx by 2 giving intp remainder remp
      compute nro = idx * 100 / 3
      move nro to nro-e
      move idx to l-01n l-02n
      move spaces to rpv-line
      move 1 to ptr
      string "{a=l;$c1}" delimited by size into rpv-line pointer ptr
      string part1 delimited by size into rpv-line pointer ptr
      string "{$c2}" delimited by size into rpv-line pointer ptr
      string part2 delimited by size into rpv-line pointer ptr
      if remp = 0
         if lp-d
            string "{a=r;c=0;$c3}" delimited by size into rpv-line pointer
            ptr
         end-if
         if lp-r
            string "{a=r;c=12;$c3}" delimited by size into rpv-line
            pointer ptr
         end-if
         if lp-g
            string "{a=r;c=10;$c3}" delimited by size into rpv-line
            pointer ptr
         end-if
         if lp-b
            string "{a=r;c=9;$c3}" delimited by size into rpv-line pointer
            ptr
         end-if
      else
         if li-d
            string "{a=r;c=0;$c3}" delimited by size into rpv-line pointer
            ptr
         end-if
         if li-r
            string "{a=r;c=12;$c3}" delimited by size into rpv-line
            pointer ptr
         end-if
         if li-g
            string "{a=r;c=10;$c3}" delimited by size into rpv-line
            pointer ptr
         end-if
         if li-b
            string "{a=r;c=9;$c3}" delimited by size into rpv-line pointer
            ptr
         end-if
      end-if
      string nro-e delimited by size into rpv-line pointer ptr
      string "{c=0;n}" delimited by size into rpv-line pointer ptr
      write rpv-rcd
   end-perform
   close rpv-file
   INVOKE CmDDE1 "Execute" USING "C:Archivos de programaRpvRPV pwc.rpv"
   POW-SWSHOWMAXIMIZED

Home
What Rpv is
Rpv Reports 10
Rpv Reports 2024

Products
Rpv Reports 10
Rpv Reports 2024
Personalized edition

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




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