Home page  
Help >
DDL VERIFY UNIQUE
Version 7.11
VERIFY UNIQUE

The purpose of VERIFY UNIQUE is to hand you back a guaranteed unique and registered value for the specified field. Registered means that it is posted in the structure and it will not be given to any other simultaneous user who may be requesting a value for the same field. This is the only sure-fire way to get a unique value from the system in a multi-user environment.


Syntax:
VERIFY/options UNIQUE fieldname [value]

Notation standards Options Answers
Options:
D -Deregister an unused value
P -Deregister all unused values (must be the only user)

Answers:
Ctl.Ans1 =OK or NO
Ctl.Ans2 =The unique and registered value (if %answer=OK, else zero)

Notes:
Fields submitted to VERIFY UNIQUE can be numeric or alphanumeric, but it is required that the low-order characters be numeric in order for VERIFY UNIQUE to do its job. For example, the value AB12345 fits this description.

The value returned from VERIFY UNIQUE is generally one greater than the current high-value for the field. If you supply a "seed" value then the value returned will be the first unique value we find that is equal to or greater than the seed value. This is not necessarily a new high-value.

Values obtained via VERIFY UNIQUE can be used to initialize fields on data entry screens so that their content already exists by the time the user sees the screen. When you are creating such a screen you do not want to turn on the "MUST BE UNIQUE" validation check for these fields. Since the value is registered, it already exists by the time the validation check occurs, and it would not pass. You know it is unique anyway, that is guaranteed.

What about the case where the user exits APPEND without writing the record? Note the following: verify unique cust#
set %cust=%answer2
append/c1 a customers custscreen cust#={%cust} ...
verify/d unique cust# {%cust}

A unique value is obtained and then used to initialize the Customer Number field when the screen CUSTSCREEN is presented to the user. When the user exits the append without writing the record the VERIFY/D shown above deregisters the value. If the record was written the VERIFY/D is a NOP (No OPeration), nothing happens, it will not deregister a value that was used.

You do not want to clutter up the structure with unused values so it is a good idea to always include the VERIFY/D in your code so that it will catch and deregister unused values when they occur.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.