Return to the RPG Tips
Retrieving the Keylock Position
Q. I have been working on an audit application for a customer. One of his requirements is to determine, programmatically, the position of the AS/400 keylock. How do I do this?
A. You can use the following RPG IV program to retrieve the keylock position:
DMatMAtr PR EXTPROC('_MATMATR1') D * VALUE D 2 CONST D* D* Working variables for Materialize D* DAttribPtr s * inz(%addr(Attributes)) DMatOption s 2 inz(x'0168') D* D* Receiver variable for Materialize D* DAttributes DS 512 D BytPrv 10i 0 D BytAvl 10i 0 D CurIPLType 1 D Panel0 1 D Panel1 1 D Reserved 5 D LastIPL 1 C* C* Set Bytes Provided to size of Receiver Variable (Attributes) C* C eval BytPrv = %size(Attributes) C* C* Use MATMATR MI instruction C* C callp MatMAtr(AttribPtr: MatOption) C* C* Determine if information returned C* C if BytAvl >= 10 C* C* Display keylock position C* C testb '4' Panel0 04 C testb '5' Panel0 05 C testb '6' Panel0 06 C testb '7' Panel0 07 C 04'Auto' dsply C 05'Normal' dsply C 06'Manual' dsply C 07'Secure' dsply C endif C eval *inlr = '1' C return Compile the program with: CRTBNDRPG KEYLOCK DFTACTGRP(*NO)The above source code was posted by Bruce Vining in the AS400 Network System Management forum at http://www.as400network.com/Forums/Index.cfm?cfapp=60.
[report a broken link by clicking here]