Looks like a test program to me. The ONS instruction, I believe; will not give you an output, if the input is on when the machine first turns on. That should be the only difference.
In any case, if you are having problems, I would add a timer to turn the output on for longer. 1 scan may not be enough for the output card to change states or the input to register on the counter.