labels only allowed on header statements. (602) - Forum - OpenEdge General - Progress Community

labels only allowed on header statements. (602)

 Forum

labels only allowed on header statements. (602)

This question is not answered

Hi 

I am getting the below error message l

"Labels only allowed on header statements. (602)".

I am new to progress so i am trying to understand what what is a header statement. 

The second and most important question though is is there a facility that is can type in the error message i get from progress and get some more information about the error?

Alex

All Replies
  • You can get the help text for a message in the Procedure Editor. Select Help/Messages and enter the message number. Or use Help/Recent Messages for a message that was recently displayed.

    The help text for error 602 is "You put a label in the middle of a block.  Labels can be put only on the beginning of a block." If this doesn't help please post a short, compilable example which shows what you're doing and we can help you fix it.

  • show us some code.

    here you can search https://knowledgebase.progress.com/  or download the offline knlowledgebase.

  • Good

    myLabel:

    DO:

    END.

    Bad

    myLabel:

    IF TRUE THEN DO:

    END.

  • The IF statement isn't the start of a block so you can't place a label before it. Blocks start with statements like DO, FOR EACH, REPEAT, etc. Block labels are used for error-handling and undoing transactions and you can't undo back to any arbitrary point. Transactions are undone back to the beginning of a block.

    The documentation has a lot of information about error-handling, transactions, and blocks. The following may be a good place to start:

    https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dverr%2Fabl-block-essentials.html%23

  • So the solution in this case would be:

    IF TRUE THEN

    myLabel:

    DO:

    END.