RUNRMTCMD problems.

65 pts.
Tags:
AS/400
AS/400 commands
RUNRMTCMD
VBS
I am trying to use the RUNRMTCMD I have successfully used this command in the past with no problems. I have allowed the services to interact with the desktop. My problem is when I run the command I am running a VBS passing in to parms from my CL. The command runs but my spool file comes back and says "The remote command has produced no output." If I run this command from my CMD prompt it works. The VBS converts an existing CSV to an XLSX so there is no real output. I have also tried to use STRPCCMD. I can get this to work fine, the problem with it is that my command far exceeds the 123 char limit. I have written a temporary batch file and executed it but not all users have to correct permissions on their pcs to run this. Any suggestions on what is going on with my RUNRMTCMD?

Software/Hardware used:
V7R1 client access - windows 7 64bit

Answer Wiki

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

Discuss This Question: 12  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 output are you expecting? Is there a reason that you need to allow "interact with the desktop"? Do you see the interaction when the command runs? -- Tom
    125,585 pointsBadges:
    report
  • 400CodeMonkey
    With my previous RUNRMTCMD I had to allow services to interact with the desktop. It opens up the cmd prompt and executes the command. So I would assume that to run the new command i would need to also allow interaction with the desktop. The output I am expecting is not going to show up on the command prompt once to command is executed. The output I expect, and get when executing the command manually, is to have a csv and an xlsx file in the folder i specify. I do not see the the interaction when I execute the command however. When i run my working command i do see the command prompt pop up on my desktop in the background.
    65 pointsBadges:
    report
  • TomLiotta

    Generally, interaction with the desktop is to allow a current user to interact with any programming. For many processes, it shouldn't be needed. For a .CSV-to-.XLSX conversion, it shouldn't be needed.

    However, it can certainly be useful simply as an indication that communication is working. In this case, you apparently don't even see the command window open.

    Do you have a test version available? Can you copy/paste the RUNRMTCMD command string for us to look at?

    Tom

    125,585 pointsBadges:
    report
  • 400CodeMonkey

    RUNRMTCMD CMD('c:\testcopy\csvtoexcel.vbs c:\testcopy\test.csv c:\testcopy\test.xlsx') RMTLOCNAME('XX.XX.XXX.XX' *IP) RMTUSER(TCOPPLE) RMTPWD(XXXXXXX)  

    I have seen the program run in the background of my pc now, so i know that it is executing as it should.

    The allowing services to interact with the desktop is not an option. It is the cwbrxd.exe service that has to run on the machine to allow the 400 to send commands to that particular machine. If it is not active, the command will fail everytime. I know this one from my first attempt.

     

    65 pointsBadges:
    report
  • 400CodeMonkey
    '======================================
    ' Convert CSV to XLS
    '
    ' arg1: source - CSV path\file
    ' arg2: target - Excel path\file
    '======================================
    
    srccsvfile = Wscript.Arguments(0)  
    tgtxlsfile = Wscript.Arguments(1)  
    
    'Create Spreadsheet
    'Look for an existing Excel instance.
    On Error Resume Next ' Turn on the error handling flag
    Set objExcel = GetObject(,"Excel.Application")
    'If not found, create a new instance.
    If Err.Number = 429 Then  '> 0
      Set objExcel = CreateObject("Excel.Application")
    End If
    
    objExcel.Visible = false
    objExcel.displayalerts=false
    
    'Import CSV into Spreadsheet
    Set objWorkbook = objExcel.Workbooks.open(srccsvfile)
    Set objWorksheet1 = objWorkbook.Worksheets(1)
    
    'Adjust width of columns
    Set objRange = objWorksheet1.UsedRange
    objRange.EntireColumn.Autofit()
    'This code could be used to AutoFit a select number of  columns
    'For intColumns = 1 To 17
    '    objExcel.Columns(intColumns).AutoFit()
    'Next
    
    'Make Headings Bold
    objExcel.Rows(1).Font.Bold = TRUE
    
    'Freeze header row
    With objExcel.ActiveWindow
         .SplitColumn = 0
         .SplitRow = 1
    End With
    objExcel.ActiveWindow.FreezePanes = True
    
    'Add Data Filters to Heading Row
    objExcel.Rows(1).AutoFilter
    
    'set header row gray
    objExcel.Rows(1).Interior.ColorIndex = 15
    '-0.249977111117893
    
    
    'Save Spreadsheet, 51 = Excel 2007-2010 
    objWorksheet1.SaveAs tgtxlsfile, 51
    
    'Release Lock on Spreadsheet
    objExcel.Quit()
    Set objWorksheet1 = Nothing
    Set objWorkbook = Nothing
    Set ObjExcel = Nothing
    65 pointsBadges:
    report
  • TomLiotta
    The .VBS extension (VBScript) helps explain the desktop interaction, but doesn't explain the problem. Can you put a MSGBOX or two at a couple early points in the script? You might also leave the .DisplayAlerts as True until the script is fully proven to work from the RUNRMTCMD batch environment that you need. I don't use MS Office nor Excel, so I can't run tests. Another member can almost certainly try it to see if results change. -- Tom
    125,585 pointsBadges:
    report
  • 400CodeMonkey
    '======================================
    ' Convert CSV to XLS
    '
    ' arg1: source - CSV path\file
    ' arg2: target - Excel path\file
    '======================================
    
    srccsvfile = Wscript.Arguments(0)  
    tgtxlsfile = Wscript.Arguments(1)  
    
    Set fso = CreateObject ("Scripting.FileSystemObject")
    Set stdout = fso.GetStandardStream (1)
    Set stderr = fso.GetStandardStream (2)
    
    stdout.WriteLine "The conversion process has started."
    'Create Spreadsheet
    'Look for an existing Excel instance.
    On Error Resume Next ' Turn on the error handling flag
    Set objExcel = GetObject(,"Excel.Application")
    'If not found, create a new instance.
    If Err.Number = 429 Then  '> 0
      Set objExcel = CreateObject("Excel.Application")
    End If
    
    objExcel.Visible = false
    objExcel.displayalerts=false
    
    'Import CSV into Spreadsheet
    Set objWorkbook = objExcel.Workbooks.open(srccsvfile)
    Set objWorksheet1 = objWorkbook.Worksheets(1)
    
    'Adjust width of columns
    Set objRange = objWorksheet1.UsedRange
    objRange.EntireColumn.Autofit()
    'This code could be used to AutoFit a select number of  columns
    'For intColumns = 1 To 17
    '    objExcel.Columns(intColumns).AutoFit()
    'Next
    
    'Make Headings Bold
    objExcel.Rows(1).Font.Bold = TRUE
    
    'Freeze header row
    With objExcel.ActiveWindow
         .SplitColumn = 0
         .SplitRow = 1
    End With
    objExcel.ActiveWindow.FreezePanes = True
    
    'Add Data Filters to Heading Row
    objExcel.Rows(1).AutoFilter
    
    'set header row gray
    objExcel.Rows(1).Interior.ColorIndex = 15
    '-0.249977111117893
    
    
    'Save Spreadsheet, 51 = Excel 2007-2010 
    objWorksheet1.SaveAs tgtxlsfile, 51
    
    'Release Lock on Spreadsheet
    objExcel.Quit()
    Set objWorksheet1 = Nothing
    Set objWorkbook = Nothing
    Set ObjExcel = Nothing
    
    
    stderr.WriteLine "Conversion Complete."
    65 pointsBadges:
    report
  • 400CodeMonkey

    With this .vbs and and changing my runrmtcmd to

    RUNRMTCMD CMD(‘cscript c:\testcopy\csvtoexcel.vbs c:\testcopy\test.csv c:\testcopy\test.xlsx’) RMTLOCNAME(‘XX.XX.XXX.XX’ *IP) RMTUSER(TCOPPLE) RMTPWD(XXXXXXX)

    I no longer get the output has produced no results.

    Instead i get;

    Microsoft (R) Windows Script Host Version 5.8            
    Copyright (C) Microsoft Corporation. All rights reserved.
    The conversion process has started.                      
    Conversion Complete.                 

    So the process is running but the conversion is not taking place.                     

    65 pointsBadges:
    report
  • TomLiotta

    The basic process works for me with i 6.1. I don't have your objects on the Windows side, so I can't use your exact VBscript. I suggest you try a minimal script and add pieces to it until you hit a point that doesn't work.

    Start like this perhaps:

    '======================================
    ' Convert CSV to XLS
    '
    ' arg1: source - CSV path\file
    ' arg2: target - Excel path\file
    '======================================
     
    srccsvfile = Wscript.Arguments(0) 
    tgtxlsfile = Wscript.Arguments(1) 
     
    Set fso = CreateObject ("Scripting.FileSystemObject")
    Set stdout = fso.GetStandardStream (1)
    Set stderr = fso.GetStandardStream (2)
     
    stdout.WriteLine "The conversion process has started."
     
    stderr.WriteLine srccsvfile
    stderr.WriteLine tgtxlsfile
     
    stderr.WriteLine "Conversion Complete."

    If it succeeds, add more code from your full script and test again. But if that small piece fails, we know it is not the RUNRMTCMD nor the VBscript since both work here. It'd most likely be the configuration of the PC.

    Tom

    125,585 pointsBadges:
    report
  • ToddN2000
    Is the profile you are trying to run the remote job under valid and enabled? It's been a long time but if I remember the connection profiles must be the same on both systems.
    11,820 pointsBadges:
    report
  • TomLiotta
    For RUNRMTCMD user and password are supplied on the command. No need for "same profile". -- Tom
    125,585 pointsBadges:
    report
  • 400CodeMonkey

    To update you guys who are helping me with this problem.... I figued out what my problem is. The problem is when executing the VBS from the RUNRMTCMD. When executing the RUNRMTCMD everything works as it should, its the VBS that is a problem because I am not passing the domain credentials to allow access to the paths specified. I can only provide the credentials that are associated with the RUNRMTCMD. So rather than try to use a VBS to convert the CSV to an XLS I have created a program to generate a .DTF from the 400 and execute it on the fly.

    65 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