understanding how define affects field initialized from tempo rary

Pickering, John (NORBORD) John.Pickering@norbord.com
Mon, 13 Dec 2004 13:54:40 -0500


Lorry

Take the "if entrymode" off the item statement for emp_no of empfile.

When you're in find mode (even if using append) entrymode will not be true.

Regards,
JWP

-----Original Message-----
From: Lorry Litman [mailto:LLitman@exchange.hsc.mb.ca]
Sent: Monday, December 13, 2004 1:13 PM
To: PowerHouse listserver (E-mail)
Subject: understanding how define affects field initialized from
temporary



I'm trying to figure some weird screen behaviour which I'm trying to
understand what is going on.
vms 7.2-2, ph 7.10.g1, rdb 7.0-1

here is the jist of the screen and what it is doing or not
 
run screen empscrn passing t_emp_no mode f

screen empscrn receiving t_emp_no

temp t_emp_no zu size 9 reset at startup

file empfile primary occ 12
item emp_no of empfile initial t_emp_no if entrymode
access via emp_no using t_emp_no orderby emp_dt desc,emp_cd

def d_rpt_flag char * 6 = "o" if emp_rpt_flag of empfile = "n" &
else "es"  if emp_rpt_flag of empfile = "y" &
else "nknown"  if emp_rpt_flag of empfile = "u" &
else ""

cluster occurs with empfile
field emp_cd
field emp_rpt_flag
field d_rpt_flag
cluster


explanation:
as you can see there is no field statement for emp_no
first time entering the screen (no records exist) entering a record or group
of records emp_no is written to the table.
entering the screen after that, it displays the existing emp_no records, we
then
action append, enter field info, save & return.
record is written to the table, however, when going back into the screen the
record just saved is not found because the emp_no is recorded as 0 instead
of the t_emp_no.
the strange part is, if I remove the define statement or just make the
define statement = anything as opposed to checking the value of the field
everything works fine.

question:
is it possible that the define does some sort of file or record retrieval
and thus causes emp_no of empfile to lose its original initialization from
t_emp_no? I'm trying to understand what is happening in the background.

Thanx
       Lorry