I am not sure I would look to lock the table. I would prefer to use a unique constraint.
For example if I have a table called sessions with a primary key of sessionid then I would do this...
SELECT MAX(sessionid) FROM sessions
get the value returned and add one to it
INSERT INTO sessions(sessionid) VALUES(MAXVALUE+1);
If the sessionid for some reason is not unique (and mostly it should be) then that would throw an exception based on the constraint... in that case try again.
I guess I would prefer that methodology because I am nto a big fan of locking tables. I find that getting explict locks can cause more serious problems (ie if your application crashes or deadlocks). I think that you should just let the database use it's own implict locking schemes as neccessary in general.
But I don't know much about DB2 locking so I could be wrong... I still prefer my method though.