Hi
Have been sweating it out wothout much success over checking for the presence of a file and if present reading a record through the Job control.
If CurrentStatus ='R' Then
OPENSEQ '/home/adarsh/':SequenceName:'.txt' TO FILE THEN
READSEQ LoadIdTimeStamp FROM FILE THEN TimeStampVal=Field(LoadIdTimeStamp,",",2) ELSE STOP
CLOSESEQ FILE
END
ELSE
Ans=0
END
End
I dont think I'm handling all error conditions - and this leads to a job control error while executing it from the sequence.
What I'm trying to do is
> Open file
If succesfull Read file and assign to a variable
else (file not present) carry on processing the rest of the code
..............................................
After this code we're calling a job which writes to the same file and sometime this hangs too
prbly bcoz we're not handliing locks
any ideas or code snippets ? I skimmed through the OpenSeqFile func Andrw had posted but If I'm not wrong thats for a file that's present for sure.
Handling Errors while reading file in Job Control
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 68
- Joined: Sat Feb 05, 2005 4:59 am
- Location: India
The OPENSEQ will take the ELSE branch if the file does not exist, and you shouldn't be using the STOP statement in a subroutine; this is designed for use in normal BASIC programs, you could replace it with "ELSE TimeStampVal = ''". This is most likely the cause for your job control error.
Sequential files are not locked the same way that tables/records are, so it is unlikely that you will get a job hanging because it is waiting to open a sequential file.
Sequential files are not locked the same way that tables/records are, so it is unlikely that you will get a job hanging because it is waiting to open a sequential file.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Premium Member
- Posts: 68
- Joined: Sat Feb 05, 2005 4:59 am
- Location: India
Hi - Thanks for the guidance - replaced STOP ... it seems the job that was being called was not in a runnable state too ... anyway have rectified things and they are now on trackArndW wrote:[The OPENSEQ will take the ELSE branch if the file does not exist, and you shouldn't be using the STOP statement in a subroutine; this is designed for use in normal BASIC programs, you could replace it with "ELSE TimeStampVal = ''". This is most likely the cause for your job control error.
Sequential files are not locked the same way that tables/records are, so it is unlikely that you will get a job hanging because it is waiting to open a sequential file.