Richard gave you the right answer on how to change the behavior but typically, you would want your app to start automatically. Most programs are designed so that nothing is done until you do something like hit a start button. This could be done with an idle state if using a state machine or a separate while loop. You also might have a problem lith the use of your local variables. You have no data flow between getting Header Byte Number and the while loop that reads it. You may have the problem that the while loop will actually start before File Info gets the information. If you want that to run first, directly wire File Info to where you are initializing the shift register.