To be sure that integration step is fixed you need to set "FixedStep" method as well as MaxStepFraction:
ClassicalRungeKuttaCoefficients[4,prec_] := With[
{
amat={{1/2},{0,1/2},{0,0,1}},
bvec={1/6,1/3,1/3,1/6},
cvec={1/2,1/2,1}
},
N[{amat,bvec,cvec},prec]
] ;
f = ParametricNDSolveValue[
{
Derivative[1][y][x] ==
Piecewise[
{
{(y[x] + x^3 + 3 z), 0 <= x < 1},
{(y[x] + x^2 + 2 z), 1 <= x < 2},
{(y[x] + x + z), 2 <= x <= 3}
}
],
y[0] == 0
},
y,
{x,0.,3.},
z,
Method -> {
"FixedStep",
Method -> {
"ExplicitRungeKutta",
"DifferenceOrder" -> 4,
"Coefficients" -> ClassicalRungeKuttaCoefficients
}
},
StartingStepSize -> #,
MaxStepFraction -> #
] & ;
With this definition f is a function of step, z and x:
(* f[step][z][x] *)
f[0.5][1.][3.]
f[0.1][1.][3.]
You can then check that the step size is indeed fixed by requesting the grid in x used for integration:
f[0.5][1.]["Grid"]
f[0.1][1.]["Grid"]
(* commented output
{{0.}, {0.5}, {1.}, {1.}, {1.5}, {2.}, {2.}, {2.5}, {3.}, {3.}}
{{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, {1.}, {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, {2.}, {2.}, {2.1}, {2.2}, {2.3}, {2.4}, {2.5}, {2.6}, {2.7}, {2.8}, {2.9}, {3.}, {3.}} *)
Also note that due to Piecewise[] there are almost identical points (auto discontinuity handling) on x-grid, like {1.}, {1.} (in fact {0.9999999999999716},{1.
}).
I.M.