I have a closet/cabinet that hangs on rails - the outside walls hang on the top rail and the middle section hangs on its own smaller rail. Since the middle rail was not attached to the wood studs, the entire middle section sagged and came out of the wall. There are grooves on the back of the side walls where the rail fits into the grooves. Since parts of the rail were cut out, only part of the rail was inserted and "touching" the grooves. Essentially, the middle walls of the closet were not fully hanging on the rail. I want to secure the rail to the wood studs and move it left/right to fit it fully into the grooves. But I can't move left/right to secure the middle rail to the studs as is because part of the track was cut out as can be seen in the collage image below.
Since I can't secure it properly to the stud (due to the cut off parts), I plan to cut the rail into two or even four pieces and hang each side wall of the middle section on two/four "sub-rails" as shown in the third picture. Each sub-rail will be secured with two screws into the stud. I just have one question: is there any structural advantage to securing the middle section on a whole rail versus two or four separate sub-rails? I don't think so, but wanted to ask here just in case. Please, let me know if it's not clear what I'm trying to ask/do.
Update1
Instead of splitting the rail into sub-rail I can leave the rail continuous and buy a plain flat metal bar from Home Depot and put it in front of the upper part of the rail that goes into the grooves as shown in the picture (rod is red) which will "fill in" the two gaps. Will this work?
UPDATE2