Posts by grandpaPaulie

    Thank you all for your responses.


    The script you have is exactly how I have been keeping this process moving fwd.

    But I know there is a more standard way to write this routine. I just kept hitting syntax errors.


    I had tried your idea and still received syntax errors.


    Your idea worked great! Below is the working program.


    Mvs posPostScan

    If M_In(10) = 1 Then

    GoSub *Box6


    ElseIf M_In(11) = 1 Then

    GoSub *Box1


    ElseIf M_In(12) = 1 Then

    GoSub *Box2


    ElseIf M_In(13) = 1 Then

    GoSub *Box3


    ElseIf M_In(14) = 1 Then

    GoSub *Box4


    ElseIf M_In(15) = 1 Then

    GoSub *Box5



    GoSub *BoxEval


    Roland - "Goto is suboptimal. Make a local subroutine and use GoSub.

    When the subroutine is finished, the program pointer jumps back to the place where it was called."

    I'm a rookie with Melfa Basic and have always used "Go To" instead of "GoSub".

    What are the practical differences between GoTo and GoSub?

    I have a simple syntax question concerning Melfa Basic VI If...Then...Elsif...Endif statements.

    What I want this routine to do is this - Based on the exteranl inputs run specific subroutine and if none are true goto a holding Position (posXXX).

    The way I currently have it programmed is working except for when none of the Inputs are true, The program goes to the next subroutine.

    *Box1, *Box2, *Box3 are subroutines. posXXX is the default/ holding position.

    If M_In(11) = 1 Then *Box1

    If M_In(12) = 1 Then *Box2

    If M_In(13) = 1 Then *Box3

    I have read all the Mitsubishi documentation on thes If/Then/Elseif statements and every time I try to include the last "Else" condition I get syntax errors.

    Any help is appreciated, program examples welcome.

    Thanks in advance.