Hi..
I have a simple program which returns next sequence number & calling from java program.
test with 6 concurrent calling & it returns same sequence number to the 2 users. the rest are getting next incremented number...
do I need to call CL program to lock the file ?
any alternative idea to do this please....
Thanks
I have a simple program which returns next sequence number & calling from java program.
test with 6 concurrent calling & it returns same sequence number to the 2 users. the rest are getting next incremented number...
do I need to call CL program to lock the file ?
any alternative idea to do this please....
Code:
H DEBUG
H OPTION(*SRCSTMT : *NODEBUGIO)
H DFTACTGRP(*NO)
H THREAD(*SERIALIZE)
* Program entry point..
d ULQT000R PR
d ULQUTNUM 10
*
d ULQT000R PI
d ULQUTNUM 10
*
* Data Structure for SQL Cursor
d c_ULQUTNUM S 10 Inz
*
* Local Variables
*
d t_CODE s 2 Inz
d t_SEQU s 8 0 Inz
*
*
/free
*Inlr = *On;
Exec SQL SET OPTION
Naming = *Sys,
Commit = *None,
UsrPrf = *User,
DynUsrPrf = *User,
Datfmt = *iso,
CloSqlCsr = *EndMod;
Exec SQL SELECT F00001 into : c_ULQUTNUM
FROM ULPARA WHERE K00001 ='QUTNUM';
t_code = %subst(c_ULQUTNUM:1:2);
t_sequ = %int(%subst(c_ULQUTNUM:3:8));
t_sequ += 1;
ULQUTNUM = t_code + %EDITC( t_sequ : 'X' );
Exec SQL UPDATE ULPARA SET F00001 =: ULQUTNUM
WHERE K00001 = 'QUTNUM';
// sequence number to requester
ULQUTNUM = c_ULQUTNUM;
Return;
/end-free






Comment