What is PRFKILL?

Document ID : KB000055590
Last Modified Date : 14/02/2018
Show Technical Document Details

PRFKILL is the program that drives the PRFK transaction in CICS for the Advantage Report Facility (PRF) product. This program will monitor the PRF users that are logged onto PRF in CICS. If a user is found to have ended abnormally, there are a number of shared resources that must be freed. PRFKILL can perform this task automatically on a schedule determined by the PRF administrator. Being an automatic process, PRFKILL must be extremely careful about what it cleans up and must be positive that that a user has ended abnormally.


PRF keeps a number of control blocks in CICS "shared storage" so that the administrator can use the Active User Option to monitor the users using PRF in CICS. This gives the administrator some modicum of control over the CICS region(s) in which PRF is running. CICS Shared storage is storage that can be accessed by any task within the CICS region regardless of the Transaction Isolation level for the region. The storage is by definition "Shared" among all tasks requiring access. The price for using shared storage though is that the storage is not freed if the task that allocates it abnormally ends.

PRF keeps the following items in CICS Shared Storage for each user:

  • The PRF internal Common Area (WORM)
  • The SQL that created the user's spill file contents
  • The Subtask control areas
    • PIEFILM subtask controls file I/O for PRF
    • PRFSORT subtask controls any file query ORDER BY requirements

PRF further keeps the PRF User control block in shared storage as well as the Spill File usage control block. These blocks are global to all PRF users and are pointed to by the space we use in the CWA.

PRF must have a way to remove these resources in case the user terminates abnormally for ANY reason. PRFKILL also bring down any subtasks that may still be running after an abnormal termination. This prevents A03 abends when bringing CICS down.

What does PRFKILL do

Via the 14 bytes that we keep in the CICS CWA, PRFKILL will address the PRF USER control block looking for user tasks that no longer exist with the CICS region. The PRF USER control block logs:

  • The user's PRFID
  • If they are in a task, the task number
  • The address of their WORM
  • Their status, where they are within PRF
  • Their terminal id

While PRFKILL is looping through the PRF USER control block, it checks for a task number and checks to see if the task is actually running in CICS. If the task is not found, the task has abended and PRFKILL must clean up this user's storage areas and subtasks.

If the stored task number is 0, then the user was in a pseudo-conversational screen but still within PRF. Here there is no CICS task running so we must check for the terminal and whether it is scheduled for PRF activity. Polling CICS for the terminal id lets us know if the terminal is still attached to CICS. If the terminal is no longer attached to CICS and the user is gone also and PRFKILL must clean up the user's storage and subtasks.

If the terminal is found but the next transaction scheduled for the terminal is NOT a PRF transaction then the user has abnormally terminated and PRFKILL must clean up the user's storage and subtasks.

What does PRFKILL do to a lost user?

Once PRFKILL has determined that the user is no longer a PRF User, it starts the process of removing the shared storage accumulated by PRF for the user. These areas are anchored by the user's WORM. PRFKILL starts by removing the current user as the owner of their spill records. PRFKILL will then start removing shared storage and subtasks. If any file I/O processes are running, PRFKILL frees the file controlled by the process and then stops the subtask with a DETACH command. PRFKILL then frees the control block for the I/O process. If there is a SORT process running, PRFKILL cancels the process, DETACHes the subtask and removes the control block that controls the SORT process. The user's WORM is then removed and the user's process and resources are fully killed. The user is finally removed from the PRF USER control block making a slot available for a new PRF user.

Assumptions dispelled

PRFKILL should never purge a task. PRFKILL will only remove the shared storage areas in use by a user and the subtasks that they may have been processing at the time of an error. PRFKILL is intended only to free resources and open the execution slot to a new PRF user.

PRFKILL is not a task time monitor. PRFKILL will only kill a user that is already dead!! The Active User Option, option 7 on the PRF/CICS Administration Menu, CAN be used to kill an active user but must be done by an administrator manually.