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 three different reports using the same procedure
The following example shows how to prepare THREE different reports using THE SAME procedure.
User is prompted to choose between three options:
1- Standard report
2- Detailed report
3- Labels report (two labels per record)

What we want to show here is how you can prepare different reports making a unique "PERFORM".

Code generated by this program when selecting "1"
TEMPLATE=C:\COBOLRPV\TEMP_CU2.RPV
|MYDETAIL|      520|Alan                |Bernard             |85 Wilson Avenue.                                 |+44 (0)870-444-4563 |London              |United Kingdom      |12411               |+44 (0)870-444-4563 |alan_bernard@ukonline.co.uk        |
|MYDETAIL|      877|Robert              |Bollini             |2607 S Milwaukee Ave                              |(773) 489-9954      |Chicago             |USA                 |60647               |                    |bollini@wsatts.com                 |
|MYDETAIL|      899|Ian Edward          |Forbes              |8319 N Saint Lauwrence Ave                        |(773) 783-5197      |Chicago             |USA                 |60618               |                    |forbes@wsatts.com                  |
|MYDETAIL|     1015|Ian                 |Forbes              |655 Masselin Ave.                                 |(323)933-32477      |Los Angeles         |USA                 |90036-5775          |                    |pilot82@california.net             |
|MYDETAIL|     1100|Ralph               |Wilson              |25 Windermere lane. Siparia.                      |+61-3-3341000       |Sydney              |Australia           |5419                |+61-3-3341010       |rwilson128@australian.au           |
|MYDETAIL|     1244|Robert              |Gancar              |778 W 42th Street                                 |(212) 12474645      |New York            |USA                 |10011-6014          |(212) 12474645      |rg@nynyny.com                      |
|MYDETAIL|     2541|Jose                |Pernia              |Benarabe 128                                      |+34-964-2457479     |Castellon           |Spain               |1050                |+34-964-2457480     |pernia@yahoo.es                    |
|MYDETAIL|     2555|Barry               |Gasshi              |5 Wilson Avenue                                   |+44-020-24579       |Mitcham             |United Kingdom      |CR4 3JR             |                    |barry@dosdos.com                   |
|MYDETAIL|     3241|Michael             |Jefferson           |17 Wickfield House Wilson Grove                   |+44-5646427         |London              |United Kingdom      |56454               |+44-5646430         |mj@co.uk                           |
|MYDETAIL|     3652|Jaques              |Piaget              |1, av. de L'Imperatrice                           |05 59416455         |Biarritz            |France              |64200               |05 59416788         |piaget@pssfska.fr                  |
|MYDETAIL|     9125|Edmondo             |Spadaveccia         |Via F. Caracciolo 14-80154                        |+81-5980511         |Napoli              |Italy               |80154               |                    |edmondospada@italusers.it          |
|MYDETAIL|    85541|Xavier              |Parcero             |Av. Cutitiba 3212                                 |+52-74-4653121      |Acapulco            |Mexico              |1114                |+52-74-4652211      |xpp231@mexmail.com                 |
|MYDETAIL|    87777|Adrian              |Arjones             |Libertador 8621                                   |+54-1-45641787      |Buenos Aires        |Argentina           |1454                |+54-1-45641790      |adrian99@argentina.com.ar          |
|MYDETAIL|   124632|Carlos              |Chavez              |Av. Los Leones 1125                               |+562-524412         |Santiago            |Chile               |51124               |+562-524420         |cchavez@ench.com.cl                |
|MYDETAIL|  2245145|Andrew              |Adler               |Av. Los Samanes 1111                              |+582-7829451        |Caracas             |Venezuela           |1050                |                    |adler@cantv.com.ve                 |


Screenshot


Code generated by this program when selecting "2"
Difference between this code and "option 1" is only the ">{\np}" (new page command) inserted every 6 records and the selected template.

TEMPLATE=C:\COBOLRPV\TEMP_CU3.RPV
|MYDETAIL|      520|Alan                |Bernard             |85 Wilson Avenue.                                 |+44 (0)870-444-4563 |London              |United Kingdom      |12411               |+44 (0)870-444-4563 |alan_bernard@ukonline.co.uk        |
|MYDETAIL|      877|Robert              |Bollini             |2607 S Milwaukee Ave                              |(773) 489-9954      |Chicago             |USA                 |60647               |                    |bollini@wsatts.com                 |
|MYDETAIL|      899|Ian Edward          |Forbes              |8319 N Saint Lauwrence Ave                        |(773) 783-5197      |Chicago             |USA                 |60618               |                    |forbes@wsatts.com                  |
|MYDETAIL|     1015|Ian                 |Forbes              |655 Masselin Ave.                                 |(323)933-32477      |Los Angeles         |USA                 |90036-5775          |                    |pilot82@california.net             |
|MYDETAIL|     1100|Ralph               |Wilson              |25 Windermere lane. Siparia.                      |+61-3-3341000       |Sydney              |Australia           |5419                |+61-3-3341010       |rwilson128@australian.au           |
|MYDETAIL|     1244|Robert              |Gancar              |778 W 42th Street                                 |(212) 12474645      |New York            |USA                 |10011-6014          |(212) 12474645      |rg@nynyny.com                      |
>{\NP}
|MYDETAIL|     2541|Jose                |Pernia              |Benarabe 128                                      |+34-964-2457479     |Castellon           |Spain               |1050                |+34-964-2457480     |pernia@yahoo.es                    |
|MYDETAIL|     2555|Barry               |Gasshi              |5 Wilson Avenue                                   |+44-020-24579       |Mitcham             |United Kingdom      |CR4 3JR             |                    |barry@dosdos.com                   |
|MYDETAIL|     3241|Michael             |Jefferson           |17 Wickfield House Wilson Grove                   |+44-5646427         |London              |United Kingdom      |56454               |+44-5646430         |mj@co.uk                           |
|MYDETAIL|     3652|Jaques              |Piaget              |1, av. de L'Imperatrice                           |05 59416455         |Biarritz            |France              |64200               |05 59416788         |piaget@pssfska.fr                  |
|MYDETAIL|     9125|Edmondo             |Spadaveccia         |Via F. Caracciolo 14-80154                        |+81-5980511         |Napoli              |Italy               |80154               |                    |edmondospada@italusers.it          |
|MYDETAIL|    85541|Xavier              |Parcero             |Av. Cutitiba 3212                                 |+52-74-4653121      |Acapulco            |Mexico              |1114                |+52-74-4652211      |xpp231@mexmail.com                 |
>{\NP}
|MYDETAIL|    87777|Adrian              |Arjones             |Libertador 8621                                   |+54-1-45641787      |Buenos Aires        |Argentina           |1454                |+54-1-45641790      |adrian99@argentina.com.ar          |
|MYDETAIL|   124632|Carlos              |Chavez              |Av. Los Leones 1125                               |+562-524412         |Santiago            |Chile               |51124               |+562-524420         |cchavez@ench.com.cl                |
|MYDETAIL|  2245145|Andrew              |Adler               |Av. Los Samanes 1111                              |+582-7829451        |Caracas             |Venezuela           |1050                |                    |adler@cantv.com.ve                 |


Screenshot


Code generated by this program when selecting "3"
Difference between this code and "option 1" is only the ">{\np}" (new page command) inserted every 9 records and the selected template.

TEMPLATE=C:\COBOLRPV\TEMP_CU4.RPV
|MYDETAIL|      520|Alan                |Bernard             |85 Wilson Avenue.                                 |+44 (0)870-444-4563 |London              |United Kingdom      |12411               |+44 (0)870-444-4563 |alan_bernard@ukonline.co.uk        |
|MYDETAIL|      877|Robert              |Bollini             |2607 S Milwaukee Ave                              |(773) 489-9954      |Chicago             |USA                 |60647               |                    |bollini@wsatts.com                 |
|MYDETAIL|      899|Ian Edward          |Forbes              |8319 N Saint Lauwrence Ave                        |(773) 783-5197      |Chicago             |USA                 |60618               |                    |forbes@wsatts.com                  |
|MYDETAIL|     1015|Ian                 |Forbes              |655 Masselin Ave.                                 |(323)933-32477      |Los Angeles         |USA                 |90036-5775          |                    |pilot82@california.net             |
|MYDETAIL|     1100|Ralph               |Wilson              |25 Windermere lane. Siparia.                      |+61-3-3341000       |Sydney              |Australia           |5419                |+61-3-3341010       |rwilson128@australian.au           |
|MYDETAIL|     1244|Robert              |Gancar              |778 W 42th Street                                 |(212) 12474645      |New York            |USA                 |10011-6014          |(212) 12474645      |rg@nynyny.com                      |
|MYDETAIL|     2541|Jose                |Pernia              |Benarabe 128                                      |+34-964-2457479     |Castellon           |Spain               |1050                |+34-964-2457480     |pernia@yahoo.es                    |
|MYDETAIL|     2555|Barry               |Gasshi              |5 Wilson Avenue                                   |+44-020-24579       |Mitcham             |United Kingdom      |CR4 3JR             |                    |barry@dosdos.com                   |
|MYDETAIL|     3241|Michael             |Jefferson           |17 Wickfield House Wilson Grove                   |+44-5646427         |London              |United Kingdom      |56454               |+44-5646430         |mj@co.uk                           |
>{\NP}
|MYDETAIL|     3652|Jaques              |Piaget              |1, av. de L'Imperatrice                           |05 59416455         |Biarritz            |France              |64200               |05 59416788         |piaget@pssfska.fr                  |
|MYDETAIL|     9125|Edmondo             |Spadaveccia         |Via F. Caracciolo 14-80154                        |+81-5980511         |Napoli              |Italy               |80154               |                    |edmondospada@italusers.it          |
|MYDETAIL|    85541|Xavier              |Parcero             |Av. Cutitiba 3212                                 |+52-74-4653121      |Acapulco            |Mexico              |1114                |+52-74-4652211      |xpp231@mexmail.com                 |
|MYDETAIL|    87777|Adrian              |Arjones             |Libertador 8621                                   |+54-1-45641787      |Buenos Aires        |Argentina           |1454                |+54-1-45641790      |adrian99@argentina.com.ar          |
|MYDETAIL|   124632|Carlos              |Chavez              |Av. Los Leones 1125                               |+562-524412         |Santiago            |Chile               |51124               |+562-524420         |cchavez@ench.com.cl                |
|MYDETAIL|  2245145|Andrew              |Adler               |Av. Los Samanes 1111                              |+582-7829451        |Caracas             |Venezuela           |1050                |                    |adler@cantv.com.ve                 |


Screenshot
Download example files (Kb)
Code
IDENTIFICATION DIVISION.
PROGRAM-ID. REPCUS-3.
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_3.RPX"
           FILE STATUS IS STATUS-PRN.


DATA DIVISION.
FILE SECTION.
    COPY MAPCUS.CPY.

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

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.
77 CUR-RECORD     PIC 99 VALUE ZEROS.


***************************************************************
* HERE WE DECLARE THE LINES TO BE PRINTED.
* OBSERVE THAT WE WRITE ALL AVAILABLE FIELDS INTO THE RPX.
* THEY CAN BE UNSORTED BECAUSE THE TEMPLATE WILL SORT THEM.
***************************************************************

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 '|'.
   03 CUS-CITY-PRN    PIC X(20) VALUE SPACES.
   03 FILLER          PIC X(1)  VALUE '|'.
   03 CUS-COUNTRY-PRN PIC X(20) VALUE SPACES.
   03 FILLER          PIC X(1)  VALUE '|'.
   03 CUS-ZIP-PRN     PIC X(20) VALUE SPACES.
   03 FILLER          PIC X(1)  VALUE '|'.
   03 CUS-FAX-PRN     PIC X(20) VALUE SPACES.
   03 FILLER          PIC X(1)  VALUE '|'.
   03 CUS-E-MAIL-PRN  PIC X(35) VALUE SPACES.
   03 FILLER          PIC X(1)  VALUE '|'.

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

01 SCR.
   03 ARC-CRT.
      05 LINE 2 COLUMN 10 VALUE
            'Standard report: 1'.
      05 LINE 3 COLUMN 10 VALUE
            'Detailed report: 2'.
      05 LINE 4 COLUMN 10 VALUE
            'Print labels:    3'.

      05 LINE 6 COLUMN 10 VALUE
                'Your selection: '.
      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.
      DISPLAY ARC-CRT.
      ACCEPT  ARC-CRT.
      DISPLAY 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.
*
     IF AXEPT = 1
        WRITE LINE-TO-PRINT FROM 
                        'TEMPLATE=C:COBOLRPVTEMP_CU2.RPV'
     END-IF.

     IF AXEPT = 2
        WRITE LINE-TO-PRINT FROM 
                        'TEMPLATE=C:COBOLRPVTEMP_CU3.RPV'
     END-IF.

     IF AXEPT = 3
        WRITE LINE-TO-PRINT FROM 
                        'TEMPLATE=C:COBOLRPVTEMP_CU4.RPV'
     END-IF.

     MOVE ZEROS TO CUR-RECORD
     PERFORM UNTIL STATUS-ISM = '10'
        READ CUSTOMERS NEXT
        IF STATUS-ISM = '00'
           ADD 1 TO CUR-RECORD
           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
           MOVE CUS-CITY     TO CUS-CITY-PRN
           MOVE CUS-COUNTRY  TO CUS-COUNTRY-PRN
           MOVE CUS-ZIP      TO CUS-ZIP-PRN
           MOVE CUS-FAX      TO CUS-FAX-PRN
           MOVE CUS-E-MAIL   TO CUS-E-MAIL-PRN
           WRITE LINE-TO-PRINT FROM LINE-DETAIL

          *********************************************
          *WE FORCE FOR A NEW PAGE WHEN THE SELECTION IS "2"
          *TO SHOW ONLY 6 RECORDS PER PAGE.
          *SELECTION "2" IS "DETAILED REPORT"
          *********************************************

           IF CUR-RECORD = 6 AND AXEPT = 2
              WRITE LINE-TO-PRINT FROM '>{NP}'
              MOVE ZERO TO CUR-RECORD
           END-IF

          *********************************************
          *WE FORCE FOR A NEW PAGE WHEN THE SELECTION IS "3"
          *TO SHOW ONLY 9 RECORDS PER PAGE.
          *SELECTION "3" IS "LABELS"
          *********************************************

           IF CUR-RECORD = 9 AND AXEPT = 3
              WRITE LINE-TO-PRINT FROM '>{NP}'
              MOVE ZERO TO CUR-RECORD
           END-IF

        END-IF
     END-PERFORM.
     CLOSE CUSTOMERS OUT-PRINTER.
     CALL 'SYSTEM' USING 
     'C:PROGRA~1RPVRPV.EXE C:COBOLRPVOUTPUTREPCUS_3.RPX'.
*
END-PROCESS.   EXIT.

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.