LoginSignup
0
0

More than 1 year has passed since last update.

IBMi Tips スプール・ファイルを1コマンドでコピーする(環境設定原則不要)(How to duplicate SPLF easily on IBMi)

Last updated at Posted at 2023-05-14

(English follows)
IBMi(AS400)でスプールファイルをコピーしたいという要件があったとする。

で、その実行方法の一例についてこちらで紹介されている。
https://www.e-bellnet.com/category/technology/2304/2304-03.html

とくにこれで問題なく実行できるのだが、このためにSNADSのセットアップをするのはダルい。
TCP/IP全盛の今どき、もっと簡単な方法がある。

キーワードは SNDTCPSPLF そして LOCALHOST/LOOPBACK だ。

前提:TCP/IPが開始されていること。ローカル・ループバック・インターフェースが開始されていること。

例えば、WRKACTJOBのスプールを出力待ち行列 QGPL/QDKTにコピーしたい場合は以下を実行する。

WRKACTJOB OUTPUT(*PRINT)
SNDTCPSPLF RMTSYS(LOOPBACK) PRTQ(QGPL/QDKT) FILE(QPDSPAJB) SPLNBR(*LAST) TRANSFORM(*NO) SEPPAGE(*NO)

SNDTCPSPLFコマンドは、TCP/IPネットワーク経由でスプールファイルを送信するものだ。
通常は相手システムを解決可能なホスト名もしくはIPアドレスで指定し、送信先OUTQを指定してそこにスプールファイルを送り込む。

対象範囲としてASCIIベースのプリンターもカバーしているため、多くの引数が用意されているが、IBMi間でやり取りするだけならコード変換無しでよい。

そして、今回のポイントは、自分に送ること。

自分と言っても、いちいち有効なIPアドレスを覚えておく必要はない。
ローカル・ループバックアドレス(127.0.0.1 IPV6なら::1)を使おう。

これはデフォルトで構成され、活動化されている。
さらに対応したLOOPBACK/LOCALHOSTというホスト名もHOSTSに定義されている。

ちなみに、loopback/localhost はUNIX/Windowsなど他プラットフォームでも共通。
参考になりますように。

以上

If you like to duplicate spooledfiles on IBMi, an example is illustrated on follwing URL
https://www.e-bellnet.com/category/technology/2304/2304-03.html

This procedure gives you the right way to perform the request. But most people might think it's a little bit bothersome to configure SNADS environment.

But you have a very simple way to do it on TCP/IP environment.

In this case the Keywords are CPYTCPSPLF and LOCALHOST/LOOPBACK.

Prerequisite: TCP/IP and the local-loopback interface have been started.

For example when you like to duplicate the output from the command WRKACTJOB, do the followings;

WRKACTJOB OUTPUT(*PRINT)
SNDTCPSPLF RMTSYS(LOOPBACK) PRTQ(QGPL/QDKT) FILE(QPDSPAJB) SPLNBR(*LAST) TRANSFORM(*NO) SEPPAGE(*NO)

SNDTCPSPLF provides the function to send spooled-files between TCP/IP network.
Generally, to perform this function, we execute this command specifying the target system onformation in short the host name or IP address, the name of the output queue(OUTQ).

As this command supports the ASCII printers, many parameters with this, but to perform it between IBMis we simply specify TRANSFORM(*NO).

And the point of this article is <>.

Even if I say "myself" you don't have to remember the valid physical/logical IP address.
All you have to do is; to use local loopback address(IPV4->127.0.0.1 IPV6-->::1).

These are configured and activated by default.
And the valid host names(LOOPBACK/LOCALHOST) are also configured.

FYI loopback/localhost are also valid on other common platforms (e.g. UNIX/Windows).
Hope this article helps.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0