Help >
System Variable %USN - User Number
Version
7.11
System Variable %USN - User Number
The System Variable %USN
There is a system variable named %USN. This variable already exists, you do not define it. Its value is always the User Number assigned to you in this session when you OPENed the data base.
An important use for this variable follows: Suppose that you do not have a local printer attached to your PC. Instead, you are routing reports to files and subsequently sending the files to system spooled printers.
The techniques to send a report to a file is either to use the "filename" argument on the REPORT command, or to use the "filename" argument on the PON command. In either case, what we are discussing here is the "filename" argument itself.
The problem in a multi-user environment is: What if several users who are all operating from the same directory are all executing the same procedure (which produces a given report) at the same time?
You want to make sure that each user's output filename is different. The thing to do is to append the %USN to the filename so that it can act to make the filenames unique. For example, the filename argument in the procedure would look like:
filename{%usn}
So if the output file were named JACK, and you were user number 3, your output file would be named JACK3. And the output file name for user number 70 who is getting this report at the same time would be JACK70.
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.