No Duplicate in Quick

Joe Boyle joeboyle_adt@hotmail.com
Mon, 25 Oct 2004 14:37:30 +0100


I'm suspect that in this case the fields are non-index segments.  Having
said that, if you are accessing a RDB and your PH version allows cursor
syntax, the code below should work ok. I seem to recall that the code in the
input proc is required when the field is a non index column.


*_________________________________________*

screen test_lookup_noton_nonidx   


file myfile primary occurs 18 
access via key_no using key_no request key_no 
access sequen


declare c_myfile cursor for &
select key_no from myfile   &
where no_dups_txt = :fieldtext  and key_no <> :key_no

cursor c_myfile reference

temporary tocc reset at startup 


cluster  occurs with myfile 
  
field key_no of myfile required nochange lookup noton myfile 

field no_dups_txt of myfile lookup noton c_myfile autocommit &
message "value already exists in file, recno = " + key_no of c_myfile 

cluster


procedure input no_dups_txt
begin

let tocc = occurrence

for  myfile
begin

if fieldtext = no_dups_txt of myfile and occurrence ne tocc
then error "value already exists in occ'ce " + ascii(occurrence)


end

end

build

*_________________________________________*

if it's a 'btree' type file, you could code something like that below, but
its likely to drag on for large files ( although I here there is a new
fastread option for RMS files on VMS )

*_________________________________________*

screen test_lookup_noton_nonidx_btree   


file myfile primary occurs 18 
access via key_no using key_no request key_no 
access sequen


file myfile alias c_myfile designer open read share

temporary tocc reset at startup 


cluster  occurs with myfile 
  
field key_no of myfile required nochange &
lookup noton myfile 

field no_dups_txt of myfile  

cluster


procedure input no_dups_txt
begin

let tocc = occurrence

for  myfile
begin

if fieldtext = no_dups_txt of myfile and occurrence ne tocc
then error "value already exists in occ'nce " + ascii(occurrence)


end

while retr c_myfile sequent
begin
if no_dups_txt of c_myfile = fieldtext &
 and key_no of myfile <> key_no of c_myfile 
then error "value already exists in file, recno = " + key_no of c_myfile 
end


end

build

*_________________________________________*

Regards, Joe.

This e-mail and all information contained in it is confidential and may be
legally privileged. If you are not the intended recipient, your access to
this e-mail is unauthorized. Any use, dissemination, distribution,
publication or copying by you of this e-mail or any of the information
contained within it is prohibited and may be unlawful. Do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so. The content of this 
e-mail and any attachments sent with it may have been altered without the
consent or knowledge of the author.

-----Original Message-----
From: powerh-l-admin@lists.sowder.com
[mailto:powerh-l-admin@lists.sowder.com] On Behalf Of Lloyd, Gavin
Sent: 22 October 2004 13:10
To: Peter Bateman; powerh-l@lists.sowder.com
Subject: RE: No Duplicate in Quick

This has been going on for a while but I can't resist asking why 'Lookup
Noton' has not been used (unless data structure permits it and this is
just a warning).  Then you would get the 'Same as occurrence (..)'
error.

Regards,
Gavin.


-----Original Message-----
From: powerh-l-admin@lists.sowder.com
[mailto:powerh-l-admin@lists.sowder.com] On Behalf Of Peter Bateman
Sent: 21 October 2004 18:22
To: powerh-l@lists.sowder.com
Subject: RE: No Duplicate in Quick


Brian:

I take your comments as compliments. Thank you.

As to how I got to the solution which Georgia has implemented.


There are a few things that we want to achieve when we are doing
software maintenance.

1) Address the underlying issue. In Georgia's case, users were
   duplicating previous values with the duplication shortcut key
   instead of entering correct data. However, in some cases duplicates
   of previous values were correct. Users don't intentionally mess up,
but
   if the can go wrong without warning they will.

2) Minimise the impact of the changes on the rest of the system.
   We could for example 'hide' the duplicate key in the QKGO
   and then program for '_' in the input procedure for every field
   on every screen that we want to allow the shortcut on. Needless,
   to say nobody would want to do this just so that the users would
   be force to enter something ( which could be the previous values )
   into two fields on one screen.

3) Minimise the impact of the changes on the users.
   We could for example 'hide' the duplicate key in the QKGO
   and then put the DUPLICATE option on every field on every screen
   that we want duplicate allowed on. Now not only is this a lot of
   work but the users would have to learn a new way of entering data.
   It would also invalidate any QKIN files that use '_'.

So with these 3 objectives in mind I came up the solution of warning the
users if a critical field has been duplicated either by using the
shortcut or by entering the same value over again.

Regards,
Peter Bateman

_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet
has 
to offer.  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU
=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get
the 
first two months FREE*.



= = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.