/* --------------------------------------------------------------- */ /* Developed for: Demonstration Purpose */ /* Author : Adarsh */ /* Date : 08/28/2023 */ /* Description : CL program to initialize profile handler of */ /* production profile for production data change. */ /* Program accepts 3 parameters: */ /* USERID - of production profile for swaping */ /* PWD - password of production profile */ /* PWDLEN - password length in binary 8-bits */ /* --------------------------------------------------------------- */ PGM PARM(&USERID &PWD &PWDLEN) DCL VAR(&USERID) TYPE(*CHAR) LEN(10) DCL VAR(&PWD) TYPE(*CHAR) LEN(10) DCL VAR(&PWDLEN) TYPE(*INT) LEN(4) /* ccsid level of -1 for password to be passed as parameter */ DCL VAR(&PWDCCSID) TYPE(*CHAR) LEN(4) + VALUE( X'FFFFFFFF') /* Error code to be returned by API */ DCL VAR(&ERRCODE) TYPE(*CHAR) LEN(8) + VALUE( X'0000000000000000') /* Current password to be passed as blank for current session user */ DCL VAR(&CURPWD) TYPE(*CHAR) LEN(10) + VALUE(' ') /* Profile handler storing variable for current session user */ DCL VAR(&PRFHNDL1) TYPE(*CHAR) LEN(12) /* Profile handler storing variable for production user */ DCL VAR(&PRFHNDL2) TYPE(*CHAR) LEN(12) /* Get profile handler for the current session user */ CALL PGM(QSYGETPH) PARM('*CURRENT ' + &CURPWD + &PRFHNDL1) /* Get profile handler of the production user */ CALL PGM(QSYGETPH) PARM(&USERID + &PWD + &PRFHNDL2 + &ERRCODE + &PWDLEN + &PWDCCSID) /* Set profile for the passed production userid */ CALL PGM(QWTSETP) PARM(&PRFHNDL2) /* Call program to take user input in screen for reason of DB change. */ /* Log the reason with audit fields in a log file and invoke STRSQL. */ /* CALL PGM(LOGPGM) PARM(&RTNCODE) */ /* IF COND(&RTNCODE *EQ ' ') THEN(EXEC(DO)) */ STRSQL /* ENDDO */ /* Set profile for the current userid */ CALL PGM(QWTSETP) PARM(&PRFHNDL1) /* Release the profile handlers */ CALL PGM(QSYRLSPH) PARM(&PRFHNDL1) CALL PGM(QSYRLSPH) PARM(&PRFHNDL2) ENDPGM