|
I have done this before, but I seem to be missing something and cannot figure out the problem I am hoping someone will spot what I am overlooking I am running V5R1M0 *PUBLIC has *USE authority to QSYGETPH QWTSETP QSYRLSPH USR01 has *USE Authority to Profile USR02 USR02 has *USE authority to Profile USR01 I have a test program where I am doing the following: Signed on as USR01 Get a profile handle for USR01 Get a profile handle for USR02 Switch to profile handle for USR02 Test User Profile by attempting to Display a file Release profile handle for USR01 Release profile handle for USR02 Test User Profile by attempting to display a file This 2nd test fails because I am still running under USR02 When this program finishes, the job us still running under profile USR02 It does not return me back to USR01 Both WRKF command execute so I know there are no errors in the CL I run through debug and the ERRORCD returned with each call was blank The first attempt to display the file fails so I know it has switched me to profile USR02 Here is the code PGM DCL VAR(&USR01HNDL) TYPE(*CHAR) LEN(12) DCL VAR(&USR02HNDL) TYPE(*CHAR) LEN(12) DCL VAR(&LENGDC) TYPE(*DEC) LEN(5 0) VALUE(128) DCL VAR(&LENGBN) TYPE(*CHAR) LEN(4) DCL VAR(&ERRORCD) TYPE(*CHAR) LEN(128) CHGVAR VAR(%BIN(&LENGBN)) VALUE(&LENGDC) /* Get USR01 profile handle */ CHGVAR VAR(&ERRORCD) VALUE(' ') CHGVAR VAR(&ERRORCD) VALUE(&LENGBN) CALL PGM(QSYGETPH) PARM(USR01 *NOPWDCHK + &USR01HNDL &ERRORCD) IF COND(%SST(&ERRORCD 9 7) *NE ' ') THEN(DO) GOTO CMDLBL(BLDMSGDTA) ENDDO /* Get USR02 profile handle */ CHGVAR VAR(&ERRORCD) VALUE(' ') CHGVAR VAR(&ERRORCD) VALUE(&LENGBN) CALL PGM(QSYGETPH) PARM(USR02 *NOPWDCHK + &USR02HNDL &ERRORCD) IF COND(%SST(&ERRORCD 9 7) *NE ' ') THEN(DO) GOTO CMDLBL(BLDMSGDTA) ENDDO /* Switch Profiles */ CHGVAR VAR(&ERRORCD) VALUE(' ') CHGVAR VAR(&ERRORCD) VALUE(&LENGBN) CALL PGM(QWTSETP) PARM(&USR02HNDL &ERRORCD) IF COND(%SST(&ERRORCD 9 7) *NE ' ') THEN(DO) GOTO CMDLBL(BLDMSGDTA) ENDDO /* Test profile (USR02 is not authorized to this file) */ WRKF FILE(USR02NOT) /* Release USR01 Handle */ CHGVAR VAR(&ERRORCD) VALUE(' ') CHGVAR VAR(&ERRORCD) VALUE(&LENGBN) CALL PGM(QSYRLSPH) PARM(&USR01HNDL &ERRORCD) IF COND(%SST(&ERRORCD 9 7) *NE ' ') THEN(DO) GOTO CMDLBL(BLDMSGDTA) ENDDO /* Release USR02 Handle */ CHGVAR VAR(&ERRORCD) VALUE(' ') CHGVAR VAR(&ERRORCD) VALUE(&LENGBN) CALL PGM(QSYRLSPH) PARM(&USR02HNDL &ERRORCD) IF COND(%SST(&ERRORCD 9 7) *NE ' ') THEN(DO) GOTO CMDLBL(BLDMSGDTA) ENDDO /* Test profile USR01 is authorized to this file */ WRKF FILE(USR02NOT) RETURN BLDMSGDTA: ENDPGM: ENDPGM Allen
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.