isCOBOL Evolve : Appendices : Library Routines : REG : REG_CLOSE_KEY, DISPLAY_REG_CLOSE_KEY
REG_CLOSE_KEY, DISPLAY_REG_CLOSE_KEY
The REG_CLOSE_KEY library routine closes a registry key.
To perform this action on the Windows client machine in an Application Server architecture, use DISPLAY_REG_CLOSE_KEY instead of REG_CLOSE_KEY.
Syntax:
 CALL "REG_CLOSE_KEY" USING openKey
                     GIVING returnCode
Parameters:
openKey
USAGE UNSIGNED-LONG
Specifies the handle to the open key to be closed. The handle must have been opened by the REG_CREATE_KEY, REG_CREATE_KEY_EX, REG_OPEN_KEY or REG_OPEN_KEY_EX library routine.
Return code:
returnCode can be any signed numeric data item and provides additional information:
-1
Invalid or missing parameters, or not running on Windows
0
Operation successful.
Non zero
Operation failed. Click here for a list of error codes.
Examples:
Example - Close an opened key
working-storage section.
copy "isreg.def".
01  open-key-handle         usage unsigned-long.
01  subkey-handle           usage unsigned-long.
77  status-code             pic 9(3).
...
procedure division.
...
open-key.
   move hkey_local_machine to open-key-handle
   call "reg_open_key"  using open-key-handle
                              "SOFTWARE"
                              subkey-handle
                       giving status-code.
 
close-key.
   call "reg_close_key" using open-key-handle 
                              giving status-code.