RE: 4GL Query problem !
Posted in 1999
I would have to agree to the use of local (l_) and modular (m_) variables. I cannot see any use for global variables, carefull programming of arrays will allow
you to store modular arrays (ma_) only.
I also submit to splitting the input and validation into separate modules. You
can pass one line of the array the validation module, removing the need for any
global variables. Splitting the input and validation also future proofs your
application allowing a separate front end to be used (i.e. a GUI front end).
Regards,
Stephen C Manga
Email: Stephen.Manga@dbgroup.co.nz
Stephen@quanta.co.nz
On Thu, 22 Jul 1999, Carpenter, Matthew wrote:
> Programming like that (no globals or modular variables only paramerters
> being passed) remindes
> me of programming in COBOL. I hate to think about passing 100 +
> variables all over the program
> in and out of 50 different function just to get to the one I need them
> in. When I could have stored
> them in a nice neet global, or module variable.
> I do agree with you that they can be OVERUSED, but I do believe that
> they have an important
> part in programming and should not be avoided.
>
> Also naming pratices that were mentions are the best way..
>
> m_test Modular variable
> g_test Global variable
> l_test Local variable
> gr_test Global Record
> ga_test global array
>
>
> and so on... This naming style keeps you from having to remember every
> detail of every variable.
> You see the naming style and know in a second that its just a local
> variable and wont mess up some
> global variable. Just and example.
>
> Matt C.
> POS Programmer
>
>
>
> > -----Original Message-----
> > From: Robert Taylor [SMTP:robertt@scotlegal.com]
> > Sent: Thursday, July 22, 1999 8:43 AM
> > To: informix-list@iiug.org
> > Subject: Re: 4GL Query problem !
> >
> > You might think its good but personally I find it just a bit dumb. If
> > you
> > can't read it then its probably over complicated. Also , I think
> > global /
> > modular variables are a no no unless there is no other way ,
> > everything
> > should be parameters. Arrays are the obvious exception.
> >
> > Tony Flaherty <aef@mfs.misys.co.uk> wrote in message
> > news:932635496.21678.0.nnrp-01.c1ed1f69@news.demon.co.uk...
> > > A good naming convention within 4GL is to prefix everything with a
> > letter
> > > indicating the scope of the variable, e.g. l_myvar for local,
> > m_myvar for
> > > modular etc. It makes the code easier to read and as an after
> > effect
> > > prevents you ever having to consider this type of ambiguity in SQL
> > > statements, well at least so long as you don't name your columns
> > l_colname
> > > ;o).
> > >
> > >
> > > --
> > > ---------------------------------------
> > > Tony Flaherty aef@mfs.misys.co.uk
> > > Analyst Programmer
> > > Misys Financial Systems
> > > All statements and opinions are my own,
> > > Misys don't pay me enough to have opinions
> > > on their behalf
> > >
> > > .
> > > Art S. Kagel wrote in message <3795FCA9.E7D2CE90@bloomberg.net>...
> > > >Ramdas Gopinath wrote:
> > > >>
> > > >> Hi Nayan,
> > > >> Just check to see whether you have a variable defined with the
> > same
> > name.
> > > It
> > > >> is always better to prefix a column name with the table name or
> > the @.
> > > >
> > > >Correct. Just a note, using the tablename will not save you from
> > the
> > > >confusion that the @ is there to resolve if, as is common practice,
> > > >you have structures with the same names as the table declared 'LIKE
> > > ><tablename>' so it is alwasy good practive in 4GL to prefix column
> > > >names in where clauses with the at sign (@) or to religiously avoid
> > > >naming program objects after the database objects they map.
> > > >
> > > >Art S. Kagel
> > > >
> > > >> Gopi
> > > >>
> > > >> NayAn JaiN <nayan.jain@tatainfotech.com> wrote in message
> > > >> news:7n3l0u$7e7$1@news.xmission.com...
> > > >> >
> > > >> > Hi all,
> > > >> >
> > > >> > I have a silly question, but wasnt able to figure out what is
> > happening
> > > >> > and how is it happening.
> > > >> >
> > > >> > Here is a query statement that is written in a 4gl program.
> > > >> >
> > > >> > SELECT insp_periodicity
> > > >> > INTO g_insp_periodicity
> > > >> > FROM smm_insp_period
> > > >> > WHERE @insp_autho = gr_smrpm01.sti_iii_cd> > > >> >
> > > >> > Please notice there is a "@" sign before field "insp_autho"
> > > >> >
> > > >> > now if this "@" sign is there then this query gives status = 0
> > > >> > and if i remove this then it gives status = 100.
> > > >> >
> > > >> > What does this "@" sign means and how does this affect the
> > query.
> > > >> >
> > > >> > BTW, I wrote a dummy program with the same query. There it
> > works in
> > > both
> > > >> > the cases...means...with or without "@" sign, i get status = 0.
> > > >> >
> > > >> > But when i run the same query in dbaccess, i get a syntax error
> > at
> > "@"
> > > >> > sign.
> > > >> >
> > > >> > Cant figure out.
> > > >> >
> > > >> > TIA,
> > > >> >
> > > >> > With Regards
> > > >> > Nayan Jain !
> > > >> >
> > > >> >
> > > >> >
> > > >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > - - -
> > > >> > Ye Lamhe, Ye pal ham baraso yaad karenge ...
> > > >> >
> > >
> >
>
>