[Migrated content. Thread originally posted on 11 June 2009]
We are getting a weird situation with a file access every now and then and have been tearing our hair out trying to find it. Essentially we have copy libraries which we use to access files so that this is done in a consitent manner. The relevant code is as follows:-select detd08 assign disk-d08
organization indexed
access dynamic
lock mode manual
record key d08-key
file status is d08-status.
03 disk-d08 pic x(20) value "detd08".
03 d08-status value "00".
05 d08-status-1 pic x.
05 d08-status-2 pic x.
01 access-status pic 9.
88 access-ok value zero.
88 eof value 1.
88 invalid-key value 2.
88 rectyp-error value 3.
88 record-locked value 4.
88 unknown-error value 5.
read-detd08.
move zero to access-status.
read detd08 invalid
move 2 to access-status
end-read.
if access-ok
and d08-status = 99
move 4 to access-status
if lock-retry
move d08-key to s10-key
move "detd08" to s01-error-file
perform lock-wait
go to read-detd08
end-if
end-if.
if access-ok
and d08-status-1 not = 0
move 5 to access-status
end-if.
if not access-ok
move 1 to access-type
perform d08-err
end-if.
*
d08-err.
move "detd08" to s41-file s01-error-file.
move d08-key to s41-record s10-key.
move 5 to s01-no-bytes.
move d08-status to common-status.
The result of this is that sometimes (don't know when) the code that checks for the first status byte being non-zero is triggered, this performs d08-err and results in our system trying to log the error. The logging routine tells us that we have an access-status of 5, but a common-status of "00". How can this be? As an extra piece of information, the logging routine attempts to write this information to a file, which also suffers the same problem, i.e. access-status = 5 but file-status = "00". It smells like some sort of "out of resource" problem but we are completely at a loss. Has anyone any ideas PLEASE?? We have use statements in the declaratives section which should make this check on status byte 1 irrelevant, but the use code is not being triggered.:confused:



