understanding how define affects field initialized from temporary

Lorry Litman LLitman@exchange.hsc.mb.ca
Tue, 14 Dec 2004 10:44:25 -0600


This is a multi-part message in MIME format.

--=_Part_a8b5cfa7$9a01$4681$9f38$29961fe6de7f
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

your replies have been helpful in making me explore/check some things tha=
t I
took for granted before, however, I'm not doing a good job of explaining =
the
problem and which part I'm trying to understand.

The issue is with the DEFINE statement and its behaviour/affect on the it=
em
emp_no of empfile which is getting set by the passed temporary t_emp_no,
with the initial statement.
How the initial statement is coded also affects the outcome, but, I would
like to focus on understanding what the define is doing.
If the initial statement is coded as
item emp_no of empfile initial t_emp_no if entrymode, the define does cau=
se
a problem.
however,
item emp_no of empfile initial t_emp_no, the define does not cause a
problem.
I'll assume, although I haven't tested it that item final would probably
work also.
To complicate matters further this problem only happens when entering A i=
n
the action field, if I enter E in the action field, emp_no is set.

I'm entering A in the Action field, checking ENTRYMODE or NEWRECORD are
true.
The record always gets written to the database table.
There is no issue with the temporary being passed.
I think it's also important to note that the first time you go into the
screen (screen is called in findmode) with no records in the table (find =
is
unsuccessful) it works fine (ie emp_no value is set), it's going into the
screen after that where find is successful and records are retrieved and
displayed and then I enter A in the action field that emp_no does not get
set.

The define statement is simply to make the 'Y' appear as 'YES', 'N' as 'N=
O'
and 'U' as 'UNKNOWN'.
emp_rpt_flag of empfile is a one character field, values Y,N,U.
align and field statement
align .... (,,20) (,,21)
field emp_rpt_flag of empfile
field d_rpt_flag


I'll use Chris's reply/example to better illustrate the problem.
assume I enter 'Y' for the field emp_rpt_flag of empfile

If I coded the define statement as
define d_rpt_flag char * 6 =3D "newrec" if newrecord of empfile &
else "o" if emp_rpt_flag of empfile =3D "n" &
else "es"  if emp_rpt_flag of empfile =3D "y" &
else "nknown"  if emp_rpt_flag of empfile =3D "u" &
else ""

d_rpt_flag =3D "newrec" and is displayed as such, and emp_no of empfile i=
s set
to t_emp_no and written to the database. I could have the define simply s=
et
d_rpt_flag =3D"*" and emp_no is set.
=20
If I coded the define statement as
def d_rpt_flag char * 6 =3D "o" if emp_rpt_flag of empfile =3D "n" &
else "es"  if emp_rpt_flag of empfile =3D "y" &
else "nknown"  if emp_rpt_flag of empfile =3D "u" &
else ""

d_rpt_flag =3D "es" and is displayed as such, however, emp_no of empfile =
is
not set to t_emp_no and the record written to the database has emp_no =3D=
 0.

Something is happening here when the define statement has to check the va=
lue
of emp_rpt_flag of empfile.

I guess it's always possible that there is a bug at work here.

Thanx
    Lorry



-----Original Message-----

This e-mail and/or any documents in this transmission is intended for the=
 address(s) only and may contain legally privileged or confidential infor=
mation. Any unauthorized use, disclosure, distribution, copying or dissem=
ination is strictly prohibited. If you receive this transmission in error=
, please notify the sender immediately and return the original.
--=_Part_a8b5cfa7$9a01$4681$9f38$29961fe6de7f
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit

From: Chris Sharman [mailto:chris.sharman@ccagroup.co.uk]
Sent: Tuesday, December 14, 2004 3:49 AM
To: PowerH List
Subject: Re: understanding how define affects field initialized from
MIME-Version: 1.0



Lorry Litman wrote:
> If I change the item initial statement
> from 
>  item emp_no of empfile initial t_emp_no if entrymode
> to
>  item emp_no of empfile initial t_emp_no
> the record gets written to the table with the correct emp_no value.

'initial' implies entrymode, iirc, so the 'if entrymode' is redundant.

As far as the define goes, what's the initial/default value of 
emp_rpt_flag ?
Might

def d_rpt_flag char * 6 = "" if newrecord of empfile else ...

be better ?

Chris


-----------------------------------------------------------------------

Any views expressed in this message are those of the sender and not
necessarily those of CCA Group.  The unauthorized use, disclosure,
copying or alteration of this message is forbidden.  The contents of
this message may be confidential and/or privileged, copyright CCA Group
and are intended solely for the use of the individual or entity to whom
they are addressed.  Whilst this message has been scanned, CCA Group
cannot guarantee that it is virus free or compatible with your systems
and accepts no responsibility for any loss or damage arising from its
use. The recipient is advised to run their own anti-virus software. If
you receive this message in error please contact
postmaster@ccagroup.co.uk immediately, destroy any copies and delete it
from your computer systems.
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.sowder.com
Subscribe: "subscribe" in message body to powerh-l-request@lists.sowder.com
Unsubscribe: "unsubscribe <password>" in message body to
powerh-l-request@lists.sowder.com
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
--=_Part_a8b5cfa7$9a01$4681$9f38$29961fe6de7f--