Hi all,
i am getting a strange error while using OPENSEQ Command in one routine.
OPENSEQ '\home\dsa\a.txt' TO FILE ELSE ABORT.
Even thought the file is existing it is going to Else part of it and aborting it.
Did anyone got this error before? The above abort is intern raising the
following error "Attempting to Cleanup after ABORT raised in stage SEQ_LAAM_ARGENTINA..JobControl"
Thanks & Regards
Koti
error while executing OPENSEQ
Moderators: chulett, rschirm, roy
An OPENSEQ will take the ELSE clause if the file doesn't exist (this is normal behaviour and the file is opened) or if there is no ON ERROR clause and an error occurs. You should add error handling and also display the value of STATUS() to find out what is going wrong. Perhaps you don't have read permission for this file?
You should also never use ABORT in DataStage programs. If you need to fail a job then use a call to DSLogFatal(). The ABORT mechanism will bypass much of the DataStage handling routines.
You should also never use ABORT in DataStage programs. If you need to fail a job then use a call to DSLogFatal(). The ABORT mechanism will bypass much of the DataStage handling routines.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
hi,ArndW wrote:An OPENSEQ will take the ELSE clause if the file doesn't exist (this is normal behaviour and the file is opened) or if there is no ON ERROR clause and an error occurs. You should add error handling and also display the value of STATUS() to find out what is going wrong. Perhaps you don't have read permission for this file?
You should also never use ABORT in DataStage programs. If you need to fail a job then use a call to DSLogFatal(). The ABORT mechanism will bypass much of the DataStage handling routines.
It is bit confusing, i saw one more message from Ray, that even though the file exists, it will goto the else part and run the abort. But till now, this routine was working fine. And i saw the file permissions, the permissions were there...please let me know why this error suddenly propping up..
Thanks & Regards
Koti
Koti,
in my previous post I suggested you use an ON ERROR clause and output the value of STATUS() in order to find out what your error is.
I doubt that Ray posted a message stating that the OPENSEQ will take the else clause if a file exists. This is not how the OPENSEQ command is documented and not how it works. Use a DSLogInfo() message to output the value of STATUS() and look up the STATUS() function in the DS/Basic handbook to see what the possible error values are.
in my previous post I suggested you use an ON ERROR clause and output the value of STATUS() in order to find out what your error is.
I doubt that Ray posted a message stating that the OPENSEQ will take the else clause if a file exists. This is not how the OPENSEQ command is documented and not how it works. Use a DSLogInfo() message to output the value of STATUS() and look up the STATUS() function in the DS/Basic handbook to see what the possible error values are.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Re: error while executing OPENSEQ
Hi Arnold,dwblore wrote:Hi all,
i am getting a strange error while using OPENSEQ Command in one routine.
OPENSEQ '\home\dsa\a.txt' TO FILE ELSE ABORT.
Even thought the file is existing it is going to Else part of it and aborting it.
Did anyone got this error before? The above abort is intern raising the
following error "Attempting to Cleanup after ABORT raised in stage SEQ_LAAM_ARGENTINA..JobControl"
Thanks & Regards
Koti
Here is what ray posted.
ray.wurlod
Participant
Group memberships:
Premium Members, Inner Circle
Joined: 23 Oct 2002
Posts: 11013
Location: Australia, Asia-Pacific
Points: 70368
Posted: Tue Sep 20, 2005 11:57 pm Reply with quote Back to top
--------------------------------------------------------------------------------
The Abort statement in your routine is getting executed because you are taking the Else clause of OpenSeq.
You can take the Else clause of OpenSeq even though you open the file successfully. Search for the OpenSequentialFile routine for documentation. You have not coded for this possibility.
Avoid using the Abort statement or DSLogFatal. You lose control and, as a result, potentially lose valuable diagnostic information. In a before/after subroutine it is sufficient to set ErrorCode to a non-zero value and return. Maybe call DSLogWarn first, if there's anything you want to put into the log (which, in this case, I'm sure there is).
_________________
Ray Wurlod
ABN 57 092 448 518
Education and Consulting Services
Thanks & Regards
Koti
Koti,
Ray's post stated the same thing that I did. If the file does not exist, the ELSE clause is taken; even though the file pointer is created and you can write to the file. Normally an OPENSEQ should be called with following syntax if you wish to write to a file and also to create the file if it does not exist:
I'll handling a LOCKED condition to you.
Ray's post stated the same thing that I did. If the file does not exist, the ELSE clause is taken; even though the file pointer is created and you can write to the file. Normally an OPENSEQ should be called with following syntax if you wish to write to a file and also to create the file if it does not exist:
Code: Select all
FileToOpen = '/tmp/abc/def/myfile.txt'
OPEN FileToOpen TO InFilePtr
ON ERROR
CALL DSLogFatal('Unable to open "':FileToOpen:'" with error ':STATUS(),'')
END
THEN
WEOFSEQ InFilePtr ;* clear the file's contents
END
ELSE
CREATE InFilePtr ELSE CALL DSLogFatal('Unable to create file "':FileToOpen:'".','')
END
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: