Page 1 of 1

pl1 mutli threading

PostPosted: Fri Jun 30, 2017 3:20 am
by rama_krishna
Hi,

Does any one used multi threading in pl1 along with embedded SQL. I am able to run plain pl1 program with POSIX on option in multi threading mode. however when I embed some sql statements
the program abend with protection exception. Does any one have idea how to run pl1 db2 program using multi threading?

Thanks

Re: pl1 mutli threading

PostPosted: Fri Jun 30, 2017 11:05 am
by enrico-sorichetti
what do You expect to gain by using multithreading ?

Re: pl1 mutli threading

PostPosted: Fri Jun 30, 2017 1:55 pm
by NicC
As you have not provided any detail we do not know that the cause of the error is anything to do with the addition of SQL to the program. It could e a long-existing error which has now come to light or it could be bad coding or bad design (using data from one thread in another thread before the first has completed) or a multitude of other things.

How about temporarily removing the multi-threading and see if you still get the error or not.

Re: pl1 mutli threading

PostPosted: Fri Jun 30, 2017 6:46 pm
by rama_krishna
Yes, I tried to execute the program without multi threading and the program ran fine.
but when i call the subprogram TSTTH1 using attach , it fails with protection exception at db statements. I used POSIX ON while running the program.
ATTACH TSTTH1 () tHREAD(T1);

Exception details:
IBM0534S ONCODE=8094 Protection exception
From entry point TSTTH1 at statement 2 at compile unit offset -0002C3
2CD2FD22.

Re: pl1 mutli threading

PostPosted: Fri Jun 30, 2017 7:06 pm
by Robert Sample
Have you tried the ATTACH with only a PL/I statement (like PUT) in the subprogram? If you try it and it works, then the issue is with the db (sic) statements in your subprogram. If you try it and it doesn't work, then you have problems with your ATTACH.

Re: pl1 mutli threading

PostPosted: Fri Jun 30, 2017 7:30 pm
by rama_krishna
I tried without DB statements and it works perfectly in multi threading. But it fails at first exec sql when i run through ATTACH.
I dont see any issue with db2 statements as the db2 statements run fine when I run the program without ATTACH as a normal subprogram call.

Not sure if anything i need to specify in BIND when I run the db2 program using threading or some other parameter or which configuration is missing.