[comp.databases] Variables in 4gl

mspayer@PacBell.COM (Mike Payer) (03/28/91)

I am looking for a little bit of help with the small 4gl report below.
This report as written works very well an did exactly what we wanted
it to so at the time. OK so now the problem is that our database has
gotten so large that we want to be able to limit the output by npa. What I
am asking is how do you go about get a prompt in this report that will set
a variable for npa..

Any help would be appreciated.

Thank You.
==========================================================================
DATABASE cee

MAIN

        DEFINE p_sap RECORD LIKE sap.*

        DECLARE q_curs CURSOR FOR
                SELECT npa,nnx,inhour,outhour,misci
                FROM sap
                WHERE npa = SOMETHING
                ORDER BY npa,nnx

        START REPORT sap_list

        FOREACH q_curs INTO p_sap.npa,
                            p_sap.nnx,
                            p_sap.inhour,
                            p_sap.outhour,
                            p_sap.misci


        OUTPUT TO REPORT sap_list (p_sap.npa,
                                   p_sap.nnx,
                                   p_sap.inhour,
                                   p_sap.outhour,
                                   p_sap.misci)

        END FOREACH
        FINISH REPORT sap_list

END MAIN

REPORT sap_list  (npa, nnx, inhour, outhour, misci)


        DEFINE  npa     char(3),
                nnx     char(3),
                inhour  char(12),
                outhour char(120),
                misci   char(50)


OUTPUT
LEFT MARGIN 0
FORMAT
        PAGE HEADER

print "NPA/NNX",column 12, "IN HOURS", column 24,"OUT OF HOURS",column 45,"MISCELLANEOUS INFORMATION"
print "================================================================================"
ON EVERY ROW
print npa,"-",nnx, column 10,outhour clipped, 2 spaces, inhour clipped,2spaces,misci
page trailer
skip 1 line
print column 30,pageno using "Page ##"
END REPORT


      ____________________________________________________________
     /\                  Michael S Payer Jr                       \
     \_|     Administrator              FAX 415-867-0344          |
       |     Emergency Control Center   pacbell!pbecc!msp         |
       |                   pacbell!pbhya!mspayer                  |
       |                                                          |
       |   ____________SOMETIMES THE DRAGON WINS__________________|__
        \_/_________________________________________________________/

tdoyle@cim-vax.honeywell.com (04/02/91)

In article <13799@pbhya.PacBell.COM>, mspayer@PacBell.COM (Mike Payer) writes:
> I am looking for a little bit of help with the small 4gl report below.
> This report as written works very well an did exactly what we wanted
> it to so at the time. OK so now the problem is that our database has
> gotten so large that we want to be able to limit the output by npa. What I
> am asking is how do you go about get a prompt in this report that will set
> a variable for npa..
> 

This is obviously Informix-4GL.

There are two ways to do this (I prefer the first one).

1. Use the argument supplied to this report (after testing arg_cnt) as the
   NPA. Set variable value. Use the variable name in the DEFINE CURSOR
   command. Get the nps value in a shell script that call the 4GL with 
   the arguments.

2. Use PROMPT command to obtain the value of the variable var_npa. This
   should be done BEFORE the cursor is opened.

Bipin Prasad (bprasad@honcim1.honeywell.com)