Sequential File Clearing
Moderators: chulett, rschirm, roy
Sequential File Clearing
Hi !
I need to clear file befor job . I wonder if there is any way to do it via BASIC code before the job starting
I need to clear file befor job . I wonder if there is any way to do it via BASIC code before the job starting
Yes, you can do it via BASIC, an OPENSEQ then WEOFSEQ will do it for you. But the job has the option to clear the file, plus you might also put in a "rm <filename>" as an external call before a job.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Are you trying to clear a sequential file or a HASHed file? the OPENSEQ and WEOFSEQ are, as might be guessed from the names, functions for sequential files.
There is no BASIC language statement to clear a hashed file. The TCL command is "CLEAR.FILE <filename>"; you can execute that from a before-job subroutine or from within a BASIC program via the EXECUTE command.
There is no BASIC language statement to clear a hashed file. The TCL command is "CLEAR.FILE <filename>"; you can execute that from a before-job subroutine or from within a BASIC program via the EXECUTE command.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
snassimr,
please tell us your EXECUTE command. It normally does not hang.
Also, please tell us if you are trying to clear the contents of a sequential or a hash file.
please tell us your EXECUTE command. It normally does not hang.
Also, please tell us if you are trying to clear the contents of a sequential or a hash file.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I try to clear seq file.
in Administrator when I run the command CLEAR.FILE filename I get enable to clear file + file name
When I run the Routine Activity of JOB SEQUENCE and befor/after routine with code:
EXECUTE "CLEAR.FILE 'DW_FACT_DIAGNOSIS_TMP'";
I get in sequence :
Attempting to Cleanup after ABORT raised in stage TestClearRoutine..JobControl
in Administrator when I run the command CLEAR.FILE filename I get enable to clear file + file name
When I run the Routine Activity of JOB SEQUENCE and befor/after routine with code:
EXECUTE "CLEAR.FILE 'DW_FACT_DIAGNOSIS_TMP'";
I get in sequence :
Attempting to Cleanup after ABORT raised in stage TestClearRoutine..JobControl
snassimr,
you cannot use the CLEAR.FILE command on a sequential file.
you cannot use the CLEAR.FILE command on a sequential file.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
CLEAR.FILE is for hash files, not sequential files. People have mentioned that more than once here.
You can either open it in a BASIC routine and then WEOFSEQ - Write an End-Of-File mark - to it which will 'clear' it - or simply delete the file.
I almost hate to ask - why do you feel you need to 'clear' it? Why not handle it inside the job?
You can either open it in a BASIC routine and then WEOFSEQ - Write an End-Of-File mark - to it which will 'clear' it - or simply delete the file.
I almost hate to ask - why do you feel you need to 'clear' it? Why not handle it inside the job?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig,
I've been trying to get that answer since the first reply. I thought it was a HASH file, and if you do 2 or more writes to the same file from a transform you might get contention, so I like to do an external CLEAR.FILE; but since a sequential file can only be opened once for writing that cannot be the case.
I've been trying to get that answer since the first reply. I thought it was a HASH file, and if you do 2 or more writes to the same file from a transform you might get contention, so I like to do an external CLEAR.FILE; but since a sequential file can only be opened once for writing that cannot be the case.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
In the Job Control or wherever ou wish to trigger the clearing of the file, you can specify:
Code: Select all
OPENSEQ 'myseqfile' TO SeqFilePtr THEN WEOFSEQ SeqFilePtr ELSE NULL
CLOSESEQ SeqFilePtr
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>