×
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.
The ultimate goal of this process (for us) is to imbed a call to the
program to swap users to a common user that exists on the Windows Network
and create an .XLS or .XLSX file from a spool file and write it out to a
Network Folder.
Scott - Below is the relevant code that I referred to in the email that I
sent to you.
Brief history:
All the code CLP & RPGLE was downloaded from Midrange Programmer OS/400
Edition Vol 2, Number 14 - July 17, 2003.
Author is Shannon O'Donnell.
The code below is original from the site - unmodified.
I understand, from researching QSYGETPH that IBM has made changes to the
parms for this API since the time that Shannon initially created the
source.
I have tried several different suggestions from the web as modifications
to the source to no avail.
What is happening when calling the CLP: SWAPTESTU:
a. Retrieves the calling User Profile ID - and stores it as &ORGUSER.
b. Calls the Swap User Profile program (SWAPUSRPRF) using parms for
&USERID & &PASSWORD.
c. Then issues the command WRKSPLF.
d. Then calls the Swap User Profile program again - using the &ORIGUSER
as the &USERID and *NoPwdChk as the &PASSWORD.
e. Then again issues the command WRKSPLF.
The results are:
a. If SWAPTESTU is called specifying a valid USERID as the &USERID and
`*NoPwdChk' as the &PASSWORD - then the process works - the first
issuance of WRKSPLF will display spool entries for the &USERID and the
second issuance of WRKSPLF will display spool entries for the
&ORIGUSER.
b. If SWAPTESTU is called specifying both a valid USERID and its
associated PASSWORD as the &USERID and &PASSWORD - then, on both
issuances of WRKSPLF only the spool entries for the &ORIGUSER will be
displayed.
Attached is the source for both the CLP and RPGLE code.
All help and assistance from you or anyone else will be most appreciated.
Charles Pascoe
Programming Supervisor
LASCO Fittings, Inc.
414 Morgan Street
P.O. Box 116
Brownsville, TN 38012
(731) 779-1882 Fax (731) 772-7116
[1]cpascoe@xxxxxxxxxxxxxxxxx
Think Green! Please consider before printing.
/* GET THE CURRENT USER PROFILE */
RTVJOBA USER(&ORGUSER)
/* SWAP JOB'S CURRENT USER PROFILE TO THE PUBLIC USER PROFLE */
CALL PGM(SWAPUSRPRF) PARM(&USERID &PASSWORD)
/* NOW DISPLAY THE SPOOLED FILES FOR THE NEW USER PROFILE TO VERIFY SWAP */
WRKSPLF ASTLVL(*BASIC)
/* NOW SWAP BACK TO THE ORIGINAL USER PROFILE */
CALL PGM(SWAPUSRPRF) PARM(&ORGUSER '*NOPWDCHK')
/* NOW DISPLAY THE SPOOLED FILES FOR THE OLD USER PROFILE TO VERIFY SWAP */
WRKSPLF ASTLVL(*BASIC)
ENDPGM
**************************************************************************
* Swaps a user profile from the current job from one user to another
*
* You MUST pass the user profile and password for that user to this
* program in order to change the job to that user
*
**************************************************************************
*
* To Create: CrtBndRPG(*LIBL/SWAPUSRPRF)
*
***************************************************************************
H DFTACTGRP(*NO) BNDDIR('QC2LE')
D RtvProfile PR 10I 0
D userid 10A value
D password 10A value
*
D SetUProf PR 10I 0
D handle 12A value
*
D Handle S 12A
*
D RC S 10I 0
D LC C 'abcdefghijklmnopqrstuvwxyz'
D UC C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
*
**----------------------------------------------------------------
** Get Profile Handle API
**
** Parameters:
** UserID = userid to retrieve a profile handle for
** Password = password of the user-id above
** Handle = the profile handle that's returned.
** ErrorCode = API error code, used to return any errors.
**
**----------------------------------------------------------------
D GetProfile PR ExtPgm('QSYGETPH')
D UserID 10A const
D Password 10A const
D Handle 12A
D ErrorCode 32766A options(*varsize: *nopass)
**----------------------------------------------------------------
** Set User Profile API:
**
** Parms:
** Handle = User Profile handle (returned by QSYGETPH API)
** ErrorCode = standard API error code structure
**
**----------------------------------------------------------------
D SetProfile PR ExtPgm('QWTSETP')
D Handle 12A const
D ErrorCode 32766A options(*varsize: *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
DToUser S 10a
DToPassWord S 10a
*
C *Entry Plist
C Parm ToUser
C Parm ToPassWord
*
* Retrieve the User Profile Handle
c eval RC = RtvProfile(ToUser:ToPassWord)
c If RC <> 0
* Now Set the Job Profile to a NEW User Profile
c eval RC = SetUProf(handle)
C Endif
C Eval *Inlr = *On
*===============================================================
* Get User Profile Handle SubProcedure
*===============================================================
P RtvProfile B
D RtvProfile PI 10I 0
D userid 10A Value
D password 10A Value
c Eval UserID = %Xlate(LC:UC:UserID)
c Eval Password = %Xlate(LC:UC:Password)
c callp GetProfile(UserID: Password: handle: ErrDS)
c if BytesAvl > 0
c return 0
C Else
c return 1
c endif
P E
*===============================================================
* Set User Profile To New User Profile SubProcedure
*===============================================================
P SetUProf B
D SetUProf PI 10I 0
D HandleIn 12A Value
c callp SetProfile(handleIn: ErrDs)
c if BytesAvl > 0
c return 0
C Else
c return 1
c endif
P E
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.