Page 1 of 1

File allocation and write so many times

PostPosted: Sun Jan 11, 2009 7:26 am
by atodpquery
I have a few query about file allocation :!:

when do you DDNAME or FILE when you allocate a dataset?
Is here any different between DA and DSN?
When you FREE a file does it same as you do an IEFB14 to delete the file?
When do you use OLD SHR and REUSE?

I have a REXX program that I created an output file and the next time I execute it then I am unable to write to the file again.

Error informing file is not allocating as duplicate file name found.

When it comes to the step to write and it will said file is not found.

In this situation, should I allocate the file with OLD REUSE or SHR REUSE

My code:

if sysdsn(REPORT) is ok then ....
else
physical allocate the file


"free FI(REPORT)"
"allocate FI(REPORT) DA('myid.XXX.report') SHR REUSE"
"execio * diskw REPORT(STEM line."
if rc = 0 then
"execio 0 diskw REPORT(FINIS'

Re: File allocation and write so many times

PostPosted: Mon Jan 12, 2009 10:16 am
by atodpquery
I have been able to do it now after delete the file every time before I write. Any other suggestions or better solutions :!:

userfile= "'"|| userid() || "." || "textscan.out'"
"FREE FILE(OUTREPT)"
Address TSO "DELETE" userfile
if rc \= 0 then
call handle_error_msg "Unable to delete to out report file"

"ALLOCATE FILE(OUTREPT) Da("userfile")",
"SPACE(1 3) CYL LRECL(80) BLOCK(25600) RECFM(F B)"

"execio * diskw OUTREPT (STEM vlt. FINIS"
if rc \= 0 then
call handle_error_msg "Unable to write to OUT REPORT"

Re: File allocation and write so many times

PostPosted: Wed Jan 14, 2009 5:24 pm
by expat
DISP=OLD ?

"ALLOC FI(abc) DA('whatever') OLD"