Midrange News for the IBM i Community


Posted by: gio cot
Analist
Problem with rmtcmd
has no ratings.
Published: 18 May 2012
Revised: 23 Jan 2013 - 1611 days ago
Last viewed on: 22 Jun 2017 (5217 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Problem with rmtcmd Published by: gio cot on 18 May 2012 view comments(4)

Hi all

i find this example to retrive windows user name but i have two problems:

1- The rmtcmd ask user and password iSeries
2- Came displayed the dos window

is it possible to avoid these problems  ??


PGM                                                                                       
DCL &JOB *CHAR 10                                                                         
DCL &PCCMD *CHAR 100                                                                      
DCL &PCUSER *CHAR 10                                                                      
DCL &CURLIB *CHAR 10                                                                      
                                                                                          
/* Get current job name and current library */                                            
/* then delete any existing temporary data area with the same name */                     
RTVJOBA JOB(&JOB) CURLIB(&CURLIB)                                                         
DLTDTAARA  DTAARA(&CURLIB/&JOB)                                                           
   MONMSG CPF0000                                                                         
                                                                                          
/* Build Windows command to execute. Using START causes %USERNAME% to be resolved.      */
/* /B prevents extra windows from opening.                                              */
CHGVAR VAR(&PCCMD) VALUE('START /B RMTCMD CRTDTAARA +                                    
                          DTAARA(' || &CURLIB |< '/' || &JOB |< ') +                     
                          TYPE(*CHAR) LEN(10) VALUE(%USERNAME%) /Z')                     
STRPCO                                                                                   
   MONMSG IWS4010                                                                        
STRPCCMD  PCCMD(&PCCMD) PAUSE(*NO)                /* Send command to attached PC */      
RTVDTAARA  DTAARA(&CURLIB/&JOB) RTNVAR(&PCUSER)   /* Retrieve the data area */           
DLTDTAARA  DTAARA(&CURLIB/&JOB)                   /* Clean up */                         
SNDPGMMSG  MSG('PC user name is: ' || &PCUSER) MSGTYPE(*COMP)                            
ENDPGM                                                                                   

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS