| 
 | 
Hi Greg
First off, the QSYGETPH API expects the password as a character field, so
you should specify it as:
     D  Password                     10a
And then set the size of variable "PswLength" to 10.
Secondly, the comments in your code say that you're converting the User ID
and Password to upper case, but you only Xlate the User ID.
Hope it helps
Jonathan
-----Original Message-----
From: rpg400-l-bounces+jonathan.mason=astradyne-uk.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+jonathan.mason=astradyne-uk.com@xxxxxxxxxxxx] On
Behalf Of Fleming, Greg (ED)
Sent: 19 June 2006 17:01
To: rpg400-l@xxxxxxxxxxxx
Subject: QSYGETPH API
We are trying to use the QSYGETPH API and keep getting the CPF22E2 error
(Password not correct for user profile) even though we're using a valid
logon and password.  
I've posted our code below.  Does anyone see anything obvious we might be
doing wrong ?
 
     D GetProfile      Pr                    ExtPgm('QSYGETPH')
     D  UserID                       10A
     D  Password                       *
     D  Handle                       12A
     D  ErrorCode                   256A   Options(*Varsize : *NoPass)
     D  PswLength                    10I 0 Options(*NoPass)
     D  CCSIDCode                    10I 0 Options(*NoPass)   
                    
     D ErrDs           Ds
     D  BytesPrv               1      4I 0 Inz(256)
     D  BytesAvl               5      8I 0 Inz(0)
     D  ErrMsgID               9     15
     D  Reserved              16     16
     D  ErrMsgDta             17    256              
 
   P RtvProfile      B
     D RtvProfile      PI            10I 0
     D   userid                      10a   Value
     D   password                    10a   Value
      *
     D   pswlength     S             10I 0
     D   CCSIDCode     S             10I 0
     D   Passwordin    S               *
     D*
      /Free
        //?Translate User ID and Password to Upper Case;
            UserId   = %Xlate(LC:UC:UserID);    // User Id;
            Passwordin = %addr(Password);  // Password;
            pswlength = %len(Password);
            CCSIDCode = 37;
 
        //?Retrieve user Profile;
             CallP  GetProfile (UserID : passwordin: handle : ERRDS:
                                pswlength:CCSIDCode);
                If BytesAvl > 0;
                    Return 0;
                Else;
                    Return 1;
                Endif;
      /End-Free  
                                              
 
Greg Fleming
Programmer/Analyst
Everglades Direct, Inc.
 
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.