error while executing OPENSEQ

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

error while executing OPENSEQ

Post by dwblore »

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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.
dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

Post by dwblore »

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.
hi,

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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.
dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

Re: error while executing OPENSEQ

Post by dwblore »

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
Hi Arnold,

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

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:

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
I'll handling a LOCKED condition to you.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

OpenSeq ought not to work at all in a parallel job or routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply