Implementation of wait statement inside a fork join block

In reply to dave_59:
Hi Dave,
I have gone through your link but still my problem is not resolved. I am getting output only for i =0. for i =5,2,7 pointer is stuck at wait statement and I am not getting any output.