I was troubleshooting an issue where the FCP call rate was showing as extremely high on a node in the development cluster. The file lookup rate in the same MONITOR FCP window showed a corresponding number, so I knew something was doing a lot of directory access somewhere.
I tracked it down to a piece of code that created a filename that included a timestamp as part of the name, assuming that that would be unique enough to prevent collisions with other concurrently running versions of the program. Well, when that wasn't good enough, the problem occurred with the program going into a loop doing file lookups (via a spawned DIRECTORY command, but that's another story). Here's how to create a guaranteed unique filename in COBOL:
identification division.
program-id. testit.
environment division.
data division.
working-storage section.
01 ret-status pic s9(09) comp.
01 uid-bin.
03 uid-bit pic s9(09) comp occurs 4.
01 filename pic x(33).
procedure division.
0-start.
call "sys$create_uid" using by reference uid-bin
giving ret-status.
if ret-status is failure
call "lib$signal" using by value ret-status.
call "sys$fao" using by descriptor "!8XL!8XL!8XL.!8XL"
omitted
by descriptor filename
uid-bit(1)
uid-bit(2)
uid-bit(3)
uid-bit(4)
giving ret-status.
if ret-status is failure
call "lib$signal" using by value ret-status.
display filename.
0-end.
stop run.
Posted at January 25, 2013 2:43 PM
Comments are closed