Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Refresh my memory, simple question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refresh my memory, simple question

    IF it helps remember this.... There is no "loop" IF and Else each can only cause one statement to execute - that is why there is no ENDIF. When you want to condition multiple lines of code, you use DO and ENDDO to mark the beginning and end of those blocks of code. (Like braces in languages such as java if { } ) Hope this helped! Kevin

  • #2
    Refresh my memory, simple question

    I know there is no loop realy, let me be more specific (see code below): Does the "else do" execute only when &var1 is not equal to 'N'?
    Code

    Comment


    • #3
      Refresh my memory, simple question

      You are correct

      Comment


      • #4
        Refresh my memory, simple question

        It was the first enddo that was confusing me. It seemed like it should have been "IF, do, elsedo, enddo", without the enddo in the middle of it all.

        Comment


        • #5
          Refresh my memory, simple question

          Correct, the "else do" executes only when &var1 is not equal to 'N'. InfoCenter: http://publib.boulder.ibm.com/infoce...opic/cl/if.htm

          Comment


          • #6
            Refresh my memory, simple question

            If I have a CL (If, Do, Enddo) "loop" that is immediately followed by an (Else Do, End Do) am I correct that the Else Do executes only when the condition for the first do clause was not met. I know that seems right, just can't believe the code I'm looking at is written like this because logically it doesn't make sense.

            Comment


            • #7
              Refresh my memory, simple question

              That is what you would expect - especiallyif you are an RPG programmer - CL's format for the IF/ELSE DO/ENDDO is... unique!

              Comment

              Working...
              X