You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IBM i Series命令行执行查询及文件下载前置需求问询

Solution: Refresh File via QM Query + Batch Download with rxferpcb.exe

Got it, let's walk through how to tie these two tasks together—running your Query Manager (QM) query to refresh the target file, then executing batch downloads with rxferpcb.exe via cmd. Here's a practical, step-by-step approach:

1. Automate the QM Query Execution

First, you need to trigger your library-based QM query programmatically (no manual clicks required). You can use IBM's cwbcmd.exe tool (part of iSeries Access for Windows) to submit AS/400 commands directly from Windows cmd.

Example Command to Run the Query:

cwbcmd.exe /c "STRQMQRY QMQRY(YOUR_LIBRARY/YOUR_QUERY_NAME) OUTPUT(*NONE)"
  • cwbcmd.exe: The core tool for running IBM i commands from Windows. If it's not in your system PATH, use the full path (usually C:\Program Files (x86)\IBM\Client Access\cwbcmd.exe).
  • STRQMQRY: The IBM i command to start a QM query. Replace YOUR_LIBRARY and YOUR_QUERY_NAME with your actual library and query details.
  • OUTPUT(*NONE): Tells the system we only need to execute the query (to refresh the file) and don't need to generate output.

Test this command first to make sure it runs without errors and properly refreshes your target file.

2. Batch File Downloads with rxferpcb.exe

You already know rxferpcb.exe handles .dtf file downloads—scaling this to batch is as simple as listing multiple commands in a script.

Single Download Command:

rxferpcb.exe /F "C:\Path\To\Your\download.dtf" /N "YOUR_SAVED_CONNECTION_NAME"
  • /F: Path to your .dtf transfer definition file.
  • /N: The name of your saved iSeries Access connection (the one you use to log into the IBM i system).

Batch Multiple Downloads:

Just add more lines for each .dtf file you need to download:

rxferpcb.exe /F "C:\DTFs\First_File.dtf" /N "MyIBMiConn"
rxferpcb.exe /F "C:\DTFs\Second_File.dtf" /N "MyIBMiConn"
rxferpcb.exe /F "C:\DTFs\Third_File.dtf" /N "MyIBMiConn"

3. Combine Both Steps into a Single Batch Script

To streamline everything (run query → wait for success → run downloads), create a .bat file with the following logic:

@echo off
setlocal enabledelayedexpansion

:: Configuration - update these values to match your environment
set QM_LIBRARY=YOUR_LIBRARY
set QM_QUERY=YOUR_QUERY_NAME
set IBMi_CONN_NAME=YOUR_SAVED_CONNECTION_NAME
set CWB_CMD_PATH="C:\Program Files (x86)\IBM\Client Access\cwbcmd.exe"

echo Starting file refresh via QM query...
%CWB_CMD_PATH% /c "STRQMQRY QMQRY(!QM_LIBRARY!/!QM_QUERY!) OUTPUT(*NONE)"

:: Check if the query ran successfully
if !errorlevel! equ 0 (
    echo Query executed successfully. Starting batch downloads...
    
    :: List all your download commands here
    rxferpcb.exe /F "C:\DTFs\First_File.dtf" /N "!IBMi_CONN_NAME!"
    rxferpcb.exe /F "C:\DTFs\Second_File.dtf" /N "!IBMi_CONN_NAME!"
    
    echo All downloads completed successfully!
) else (
    echo ERROR: Failed to run QM query. Aborting downloads.
    exit /b 1
)

Key Notes:

  • Update the configuration variables at the top to match your system details.
  • Test the script step-by-step first: run the query command alone, then a single download, then the full script.
  • If you need to schedule this to run automatically, use Windows Task Scheduler to trigger the .bat file at your desired times.

内容的提问来源于stack exchange,提问作者gemmo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 02:23:23