The shared variable must be displaying the value from the previous subreport, since you have the shared variable positioned before the subreport which is creating the shared variable.
The shared variable must be displayed in a section below the one in which the subreport is executing, e.g., GH#2f. You should also have a formula in the main report in GF#2 that resets the shared variable, as in:
whileprintingrecords;
shared numbervar x := 0;
Note that to suppress the same section that you have placed the subreport in, you would have to add the subreport again in a section above GH#2e, e.g., Gh#2d, so that the shared variable could be used for suppression.
-LB