I am trying to write a very simeple bit of code as follows
quote:
Harmitem = Arg1
Ans = ''
If Harmitem = '116' then Found = @True else Found = @False
If Found Then Ans = 'R'
End
when i compile the job i get the following errors
quote:
Compiling: Source = 'DSU_BP/DSU.JOCImportRedefinedReefer', Object = 'DSU_BP.O/DSU.JOCImportRedefinedReefer'
0007 RETURN(Ans)
^
WARNING: Text found after final END statement
Compilation Complete.
There isnt even any blank spaces after the end statment
what is wrong here?
Very simple code...I thought
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
IF, most of the I/O statements and a number of other statements can be in "single-line format" or "multi-line format". The rule that governs it can be stated as follows:
If the clause-introducing keyword (for example ON ERROR, LOCKED, THEN or ELSE) is the final word on the line in which it appears, then a corresponding END statement is mandatory.
If the clause-introducing keyword is not the final word on the line in which it appears, then a corresponding END statement is prohibited.
So your code could have been written as:
Harmitem = Arg1
Ans = ''
If Harmitem = '116' then Found = @True else Found = @False
If Found Then
Ans = 'R'
End
In this example, the first IF statement is in "single-line format" while the second IF statement is in "multi-line format" (even though there is only one statement controlled by the IF condition).
Your code could more efficiently have been written as:
Ans = (If Harmitem = "116" Then "R" Else "")
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
If the clause-introducing keyword (for example ON ERROR, LOCKED, THEN or ELSE) is the final word on the line in which it appears, then a corresponding END statement is mandatory.
If the clause-introducing keyword is not the final word on the line in which it appears, then a corresponding END statement is prohibited.
So your code could have been written as:
Harmitem = Arg1
Ans = ''
If Harmitem = '116' then Found = @True else Found = @False
If Found Then
Ans = 'R'
End
In this example, the first IF statement is in "single-line format" while the second IF statement is in "multi-line format" (even though there is only one statement controlled by the IF condition).
Your code could more efficiently have been written as:
Ans = (If Harmitem = "116" Then "R" Else "")
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518