This is what i have used for an LB15 with an OSP5020L control
V1 is the number of parts to machine or number of parts on the bar
V2 is the counter
If you don't need a parts counter leave them off and this will keep repeating until you stop it
$O5416.MIN%
(OKUMA LB15)
V2=0(PARTS COUNT START)
N100(STOP)
MACHINING
end of program
V2=V2+1
IF[V2 EQ V1]GOTO N101(when v2 equals v1 jump to the end of the program)
GOTO N100
N101
M5
M30
%