APIs by Example: Locking Parts of a User Space

User spaces are a powerful tool in every System i programmer’s toolbox. One interesting way to use them is as a means of communicating between different jobs in the system. Because a pointer can address user spaces, you can use them the same way that you use variables, making passing a large amount of data between jobs easy.

When you program in this manner, you have to be careful that two different jobs aren’t changing the user space at the same time. The Lock Space Location (LOCKSL) MI built-in function provides a means of locking sections of a user space in much the same way that you’d lock records in a database file.

In today’s APIs by Example, I show you how to combine the use of the Space Location MI built-ins and user space APIs to address the problem of concurrent update conflicts.

Download the save file containing the source code.

Read the entire article

One thought on “APIs by Example: Locking Parts of a User Space

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s