How to pop up login when using STRPCCMD

35 pts.
Tags:
AS/400
Login
STRPCCMD
How do you pop up loginwindow when using STRPCCMD?
ASKED: October 8, 2009  9:58 PM
UPDATED: October 20, 2009  11:44 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here is a subprocedure that I wrote that will allow you to map a drive through green screen. You send it the drive letter, ifspath, profile and password and it will map the drive.

Let me know if you have any questions.

<pre>
100 **********************************************************************
200 * SET COMPILER OPTIONS
300 **********************************************************************
400 HNOMAIN 07/30/08
500 HOPTION(*NODEBUGIO:*SRCSTMT)
600 **********************************************************************
700 * PROGRAM NAME: MAPIFSDRIV 07/30/08
900 * CREATION DATE: 07/30/08 07/30/08
1000 * PURPOSE OF PROGRAM: MAP A DRIVE TO THE IFS. 07/30/08
1100 **********************************************************************
1200 * FILES USED BY PROGRAM.
1300 **********************************************************************
1400 ********************************************************************** 07/30/08
1500 * PROTOTYPE FOR PROCEDURE 07/30/08
1600 ********************************************************************** 07/30/08
1700 D MAPIFSDRIV PR 07/30/08
1800 D DRIVE_LETTER… 07/30/08
1900 D 1 07/30/08
2000 D IFS_PATH… 07/30/08
2100 D 256 07/30/08
2200 D USER_PROFILE… 07/30/08
2300 D 10 07/30/08
2400 D PASSWORD… 07/30/08
2500 D 10 07/30/08
2600 ********************************************************************* 07/30/08
2700 * START PROCEDURE DEFINITION 07/30/08
2800 ********************************************************************* 07/30/08
2900 P MAPIFSDRIV B EXPORT 07/30/08
3000 D MAPIFSDRIV PI 07/30/08
3100 D DRIVE_LETTER… 07/30/08
3200 D 1 07/30/08
3300 D IFS_PATH… 07/30/08
3400 D 256 07/30/08
3500 D USER_PROFILE… 07/30/08
3600 D 10 07/30/08
3700 D PASSWORD… 07/30/08
3800 D 10 07/30/08
3900 ********************************************************************** 07/30/08
4000 * PROTOTYPE FOR PROCEDURE TO GET DEFAULT OUTQ 07/30/08
4100 ********************************************************************** 07/30/08
4200 /COPY QMODLECPY,APIPROTSRC 07/30/08
4300 **********************************************************************
4400 * FIELD DEFINITIONS.
4500 **********************************************************************
4600 D CMD S 32702A VARYING 07/30/08
4700 D QUOTATIONS C CONST(X’7D’) 07/30/08
4800 07/29/08
4900
5000
5100 // ******************************************************************
5200 // * START FREE FORM CALCS.
5300 // ******************************************************************
5500 /FREE
5600 07/28/08
5700 // ****************************************************************** 07/30/08
5800 // * VALIDATE SIGN ON INFORMATION. 07/30/08
5900 // ****************************************************************** 07/30/08
6000 07/30/08
6100 MONITOR; 07/30/08
6200 CMD = ‘STRPCO’; 07/30/08
6300 CALLP QCMDEXC(CMD : %LEN(CMD)); 07/30/08
6400 07/30/08
6500 ON-ERROR; 07/30/08
6600 07/30/08
6700 ENDMON; 07/30/08
6800 07/30/08
6900 // ****************************************************************** 07/30/08
7000 // * CREATE THE NET USE COMMAND AND MAP THE DRIVE. IF THIS IS THE 07/31/08
7100 // * FIRST DRIVE TO BE MAPPED, SEND USER SIGN ON INFORMATION. 07/31/08
7200 // ****************************************************************** 07/30/08
7300 07/30/08
7400 CMD = ‘STRPCCMD PCCMD(‘ + QUOTATIONS + ‘net use ‘ + 07/30/08
7500 %TRIM(DRIVE_LETTER) + ‘: ‘ + 07/31/08
7600 %trim(IFS_PATH) + ‘ ‘ + 07/30/08
7700 ‘/USER:’ + 07/30/08
7800 %TRIM(USER_PROFILE) + ‘ ‘ + 07/30/08
7900 %TRIM(PASSWORD) + QUOTATIONS + 07/30/08
8000 ‘) PAUSE(*NO)’; 07/30/08
8100 07/30/08
8200 CALLP QCMDEXC(CMD : %LEN(CMD)); 07/30/08
8300 07/30/08
8400 // ****************************************************************** 07/31/08
8500 // * CREATE THE NET USE COMMAND AND MAP THE DRIVE. IF THIS IS A 07/31/08
8600 // * SUBSEQUENT DRIVE MAPPING, USER SIGN ON IFORMATION CAN NOT BE 07/31/08
8700 // * SENT. 07/31/08
8800 // ****************************************************************** 07/31/08
8900 07/31/08
9000 CMD = ‘STRPCCMD PCCMD(‘ + QUOTATIONS + ‘net use ‘ + 07/31/08
9100 %TRIM(DRIVE_LETTER) + ‘: ‘ + 07/31/08
9200 %trim(IFS_PATH) + QUOTATIONS + 07/31/08
9300 ‘) PAUSE(*NO)’; 07/31/08
9400 07/31/08
9500 CALLP QCMDEXC(CMD : %LEN(CMD)); 07/31/08
9600 07/31/08
9700 07/30/08
9800 *INLR = *ON; 07/30/08
9900 RETURN; 07/30/08
10000 07/30/08
10100 07/29/08
10200 /END-FREE 07/30/08
10300 07/30/08
10400 P MAPIFSDRIV E 07/30/08
* * * * E N D O F S O U R C E * * * *

</pre>

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    What would you expect the login to login to? If you expect an iSeries Access login to your AS/400, won't the login already have been done in order to have the session active that will receive the STRPCCMD? Are you simply wanting a confirmation? Or do you want to send it to a simple telnet session? or something else...? Tom
    125,585 pointsBadges:
    report
  • Bpulido
    I apologize if the question was too vague. When I was doing a search, I thought the website needed it in a question format. When I go to the Windows' Start Run and enter \iseries, the windows credential is passed to the iseries. If access is denied, due to userid in windows and iseries being different, it opens a login window. When I'm using STRPCCMD in the iseries to tell windows to go to a IFS shared directory, I was only getting access denied. I'm trying to make the login window from windows to pop up.
    35 pointsBadges:
    report
  • RVP400
    Hi, If I understood correctly, you'd like the user to receive the logon window when STRPCCDM starts to run, right? The login setting can be changed on the ISeries Navigator. Just right-click your server name on the left-hand side of the main window, then choose "properties". Go to the connection tab. From there you'll be able to choose how the login is handled: Using the windows user and password (I think this is the default and from what you describe, it looks that is what you have defined at the moment); Use a certain username and ask for password as needed - usually only 1 time, because it is then stored somehere and the login is automatic; Prompt every time - this is a bit anoying but is the most secure; Use Kerberos - only applicable is you have a Kerberos server. Now, if you don't what the user to be shown the login window everytime, go for option "Use default ID, prompt as needed". If you prefer to ask for user and password on every connection request, choose "Prompt every time". I hope this helps!
    270 pointsBadges:
    report
  • TomLiotta
    @Bpulido: When I’m using STRPCCMD in the iseries... The implication in that is that you already have a session active. I.e., a session logon has already been done. But that's not necessarily true, depending on how you connect the session through which the STRPCCMD is sent. Rather than attempting to send a command that directly accesses a share, review the Windows NET USE command. At a Windows command line:
    C:> net use T: \QAS400SERVERAS400share * /user:Bpulido
    
    Check the Windows help from a command window -- NET HELP USE You might want to set the window to a full 80-line size before displaying the help. See if NET USE can be incorporated into whatever your STRPCCMD will be sending down. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Typo correction --
    C:> net use T: QAS400SERVERAS400share * /user:Bpulido
    
    Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Alright, what's the deal in this editor? It's dropping back-slashes in code segments. I'll try without "CODE"... C:> net use T: \QAS400SERVERAS400share * /user:Bpulido There should be a double backslash before [QAS400SERVER] and a single backslash before
    125,585 pointsBadges:
    report
  • TomLiotta
    Apparently a backslash is an escape character -- it always drops at least one but double backslash leaves one. Fine...
    C:> net use T: \\QAS400SERVER\AS400share * /user:Bpulido
    
    Type six backslashes -- four in the first set and two in the last. If that doesn't come across correctly, you'll have to figure it out. Tom
    125,585 pointsBadges:
    report
  • Bpulido
    It would have worked without mapping if the credential in the iseries and windows are the same. Since it is not the same, I had to map the iseries to my PC just as Tom said. Thank you Teandy as well if you run into this thread. I didn't need to write an RPG, but it did stir me to the direction of net use. CL is just as good. If you are here looking for this same solution, here are the things you need to make this work: Have a folder or directory from the IFS to be shared in netserver (go to server under network and select TCPIP from iseries navs and open iseries netserver and create a new shared file object). Read up how to name your file share. iseries netserver should be started. Send a command STRPCO Send a command using STRPCCMD with PAUSE *YES. The pc command to pass is 'net use DRIVE: \iseriesfileshare /USER:userid. Having a *YES in PAUSE will keep window command open to prompt you for password if the windows and iseries are not the same. Send another STRPCCMD that opens the file located in IFS. Provide the window the path of the object to open. For example, '\iseriesbpulidoreadme.txt'. The PAUSE at this pouint can be *NO. Make sure the user have authority to the folder.
    35 pointsBadges:
    report
  • Bpulido
    DRIVE from above statement should be an unused drive letter in the PC. Youll get the drift from Tom's example.
    35 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following