× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ive got my procedure working as Id hoped so thanks for the help.

Id appreciate any comments on my code.  Im wondering should I be
checking for errors more then I am, currently only on SETPRFHND.

It is not clear to me why I can use

GETPRFHNDNP(HANDLE1:USERID:'*NOPWD

to get the handle for the user and can't do the same for my
generic/admin user profile, I got an error when I tried it, so it must
require the password passed in, but Im not sure why.

GETPRFHND(HANDLE2:'ADMIN':ADMINPWD:

Thanks

Backgound:
Ive been using Scott's IFS ebook stuff for years.  We've got SSO
working but we never have been able to sort out the connection so
users wouldnt need to have the same profile/password as the network. This will finally get us around that little hickup that generates so
many calls when the passwords change.


     //
     // DEFINE GLOBAL VARIABLES
     //
    D ADMINPWD        S            512A   DTAARA
     //
    D/copy LEDES/QRPGLESRC,EINPROTO
     //  BEGIN SUBPROCEDURE
    P SWAPHANDLE      B                   EXPORT

     // SWAPHANDLE IS INTENDED TO ALLOW THE CURRENT USER OF THE JOB
     //   TO BE SWITCHED TO ADMIN USER PROFILE SO AS TO BY PASS
     //   ANY CONNECTION ERRORS WHEN CONNECTING TO THE IFS.
     // TO BE PASSED IN
     //    *ON = MAKE THE SWAP TO ADMIN BEFORE PROCESSING
     //    *OFF = RETURN TO CURRENT AND CLEAN UP
     // TO BE PASSED OUT
     //    *ON = SUCCESS ACTION COMPLETED
     //    *OFF = SOME FAILURE IN PROCESSING


     //  PROCEDURE INTERFACE
    D SWAPHANDLE      PI              N
    D   FLAG                          N   CONST
    D   USERID                      10A   CONST OPTIONS(*NOPASS)

     // API ERROR CODE DATA STRUCTURE
    D ERRORCODE       DS                  QUALIFIED
    D  BytesP                       10I 0 INZ(%size(ERRORCODE))
    D  BytesA                       10I 0 INZ(0)
    D  MsgID                         7A
    D  Reserv                        1A
    D  MsgDta                      256A
     //
     // DEFINE LOCAL VARIABLES
     //
    D CLCOMMAND       S           3000A   VARYING
    D HANDLE1         S             12A
    D HANDLE2         S             12A
    D PASSSIZE        S             10I 0 INZ(11)
    D PASSCCSID       S             10I 0 INZ(-1)
    D RTNVAL          S               N

     // SWAP TO ADMIN
     /FREE
      RTNVAL = *ON;
      IF FLAG = *ON;
        IN ADMINPWD;

      // generate profile handles
        GETPRFHND(HANDLE2:'ADMIN':ADMINPWD:PASSSIZE:PASSCCSID:ERRORCODE);
        SETPRFHND(HANDLE2:ERRORCODE);
        IF ERRORCODE.BytesA > 0;
        RTNVAL=*OFF;
        ENDIF;
        RLSPRFHND(HANDLE2:ERRORCODE);
      ENDIF;
      //// IF THERE IS A FAILURE THEN RESTORE ORIG HANDLE
      //// OR ON CLEANUP RESTORE THE ORIG HANDLE
      IF %PARMS > 1 AND RTNVAL = *OFF OR
            %PARMS > 1 AND FLAG = *OFF;
      // return to JOB handle
        GETPRFHNDNP(HANDLE1:USERID:'*NOPWD    ':ERRORCODE);
        SETPRFHND(HANDLE1:ERRORCODE);
        IF ERRORCODE.BytesA > 0;
        RTNVAL=*OFF;
        ENDIF;
        RLSPRFHND(HANDLE1:ERRORCODE);

      ENDIF;

      RETURN RTNVAL;

     /END-FREE
    P SWAPHANDLE      E


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.