BASIC Compilation Error
Moderators: chulett, rschirm, roy
BASIC Compilation Error
I modified the hashLookUp program and its giving compile error. This is my 1st BASIC program ever tried to compile.
it gives 'End of file unexpected, Was expecting : Array Name, Variable Name'
can somebody tell me what the problem is.. thanks
*************************************************************************
* Author: David Thompson
* Date: 16th December 2003
* This function adapted from Ascential's UtilityHashLookup (see notice below)
*************************************************************************
*************************************************************************
* Copyright (c) 1997-2001 Ascential Software Inc. - All Rights Reserved.*
* This code may be copied on condition that this copyright *
* notice is included as is in any code derived from this source. *
*************************************************************************
*************************************************************************
*
* Executes a lookup against a hashed file using a key, composited from two arguments
*
* Input Parameters : Arg1 = Hash Table Path & Name
* Arg2 = Hash Key Value 1
* Arg3 = Hash Key Value 2
* Arg4 = Column Position to return
* If empty, return entire row in a dynamic array.
*
* Return Values: If no record found, return value is: @NULL
* If hash file not found, return value is: "**TABLE NOT FOUND**"
*
*
**************************************************************************
RoutineName = 'HashLookUp'
Common /HashLookup/ FileHandles(100), FilesOpened
ErrorCode = 0
FileName = Field(InputArg,';',1)
Key1 = Field(InputArg,';',2)
Key2 = Field(InputArg,';',3)
HashTable = FileName
HashKey = Key1:@TM:Key2
PositionReturn = 0
* Attempt to find the table name in our cache.
Locate HashTable in FilesOpened Setting POS Then
Read Rec From FileHandles(POS), HashKey Then
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
End Else
* Table is not in cache of opened tables, so open it.
OpenPath HashTable To FileHandles(POS) Then
FilesOpened<-1> = HashTable
Read Rec From FileHandles(POS), HashKey Else
Rec = @NULL
End
Ans = Rec
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
End Else
Rec = "**TABLE NOT FOUND**"
Ans = Rec
End
END
it gives 'End of file unexpected, Was expecting : Array Name, Variable Name'
can somebody tell me what the problem is.. thanks
*************************************************************************
* Author: David Thompson
* Date: 16th December 2003
* This function adapted from Ascential's UtilityHashLookup (see notice below)
*************************************************************************
*************************************************************************
* Copyright (c) 1997-2001 Ascential Software Inc. - All Rights Reserved.*
* This code may be copied on condition that this copyright *
* notice is included as is in any code derived from this source. *
*************************************************************************
*************************************************************************
*
* Executes a lookup against a hashed file using a key, composited from two arguments
*
* Input Parameters : Arg1 = Hash Table Path & Name
* Arg2 = Hash Key Value 1
* Arg3 = Hash Key Value 2
* Arg4 = Column Position to return
* If empty, return entire row in a dynamic array.
*
* Return Values: If no record found, return value is: @NULL
* If hash file not found, return value is: "**TABLE NOT FOUND**"
*
*
**************************************************************************
RoutineName = 'HashLookUp'
Common /HashLookup/ FileHandles(100), FilesOpened
ErrorCode = 0
FileName = Field(InputArg,';',1)
Key1 = Field(InputArg,';',2)
Key2 = Field(InputArg,';',3)
HashTable = FileName
HashKey = Key1:@TM:Key2
PositionReturn = 0
* Attempt to find the table name in our cache.
Locate HashTable in FilesOpened Setting POS Then
Read Rec From FileHandles(POS), HashKey Then
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
End Else
* Table is not in cache of opened tables, so open it.
OpenPath HashTable To FileHandles(POS) Then
FilesOpened<-1> = HashTable
Read Rec From FileHandles(POS), HashKey Else
Rec = @NULL
End
Ans = Rec
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
End Else
Rec = "**TABLE NOT FOUND**"
Ans = Rec
End
END
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: BASIC Compilation Error
now the code is working .. it even displays the last message 'ended else'
but it throwing a warning ' Attempting to Cleanup after ABORT raised in stage HashSeq.JobControl'.
but it throwing a warning ' Attempting to Cleanup after ABORT raised in stage HashSeq.JobControl'.
Code: Select all
Call DSLogWarn("Processing", "MyRecord")
RoutineName = 'HashLookUp'
Common /HashLookup/ FileHandles(100), FilesOpened
ErrorCode = 0
FileName = Field(InputArg,';',1)
Key1 = Field(InputArg,';',2)
Key2 = Field(InputArg,';',3)
HashTable = FileName
HashKey = Key1
PositionReturn = 0
* Attempt to find the table name in our cache.
Locate HashTable in FilesOpened Setting POS Then
Read Rec From FileHandles(POS), HashKey Then
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
end else
Ans = @NULL
end
End Else
* Table is not in cache of opened tables, so open it.
OpenPath HashTable To FileHandles(POS) Then
FilesOpened<-1> = HashTable
Read Rec From FileHandles(POS), HashKey then
Ans = Rec
Call DSLogInfo("Record: ":Rec<3>, "MyRecord")
end else
Call DSLogInfo("else ", "MyRecord")
Rec = @NULL
End
End Else
Call DSLogInfo("end else ", "MyRecord")
Rec = "**TABLE NOT FOUND**"
Ans = Rec
End
END
Call DSLogInfo("ended else ", "MyRecord")
Last edited by muascdev on Thu Oct 12, 2006 4:08 am, edited 1 time in total.
Wasn't the only change you made to the sdk routine one from 'Open' to 'OpenPath'? Something else going on here that I'm missing?
Your problem looks to be the fact that you specifically log a warning on the first line of the routine. Why would you want to do that? Change it to a DSLogInfo call - or better yet remove it as it doesn't really serve any purpose.
And you do realize there's no reason to quote the entire message you reply to each time, yes?
Your problem looks to be the fact that you specifically log a warning on the first line of the routine. Why would you want to do that? Change it to a DSLogInfo call - or better yet remove it as it doesn't really serve any purpose.
And you do realize there's no reason to quote the entire message you reply to each time, yes?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Ah... you need to mention little details like this, as the 'rules' are different between the two types. And I should have noted you parsing the InputArg - that's a big clue.muascdev wrote:I want to write it as a Subroutine.. any help!!
A 'Before/After' routine takes only one input argument and can only return a status, so you'll need to take that into account when writing one. You've handled the former, and Arnd noted the latter, so anything else would require a health dose of debugging.
Have you tried 'Resetting' the aborted job from the Director to see if a message labelled 'From previous run...' is pulled into the job? As Arnd notes (these messages come from &PH&) they can provide more clues as to the nature of the problem.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers