TCP/IP for the IBM i platform

The KCM Core IBM i connection includes the IBM i command SBMITPJOB in the library ITPCOM31. You can use this command to submit a request to a remote KCM Core Service.

>>-SBMITPJOB----------------------------------------------------->

>--SERVICE(--Name of the Service called--)----------------------->

>-+------------------------------------+------------------------->
  |        .------------------------.  |
  |        V                   (3)  |  |
  '--PARS(----script-parameter------+-)'

>-HOST(--+-hostname--+--)--PORT(--+-service-name-+--)------------>
         '-ip-number-'            '-port-number--'

>--JOBID(--job-identifier--)-------+--------------------+-------->
                                   |        .-*NO--.    |    (4)
                                   '-SYNC(--+-*YES-+--)-'

>--+----------------------------+-------------------------------->
   | (1)            .-*NO--.    |
   '------CONFIRM(--+-*YES-+--)-'

>--+----------------------------+--+-------------------------+--->
   | (1)            .-*NO--.    |  | (1)         .-*NO--.    |
   '------RECEIVE(--+-*YES-+--)-'  '------SEND(--+-*YES-+--)-'

>--+--------------------+--+-------------------+----------------->
   |        .-*YES-.    |  |       .-*NO--.    |
   '-MSG-(--+-*NO--+--)-'  '-LOG(--+-*YES-+--)-'

>--+----------------------------------------------+-------------->
   | (1)           .-*LIBL/-------.               |
   '------XCHFIL(--+--------------+--file-name--)-'
                   '-library-name/'

>--+-------------------------------------------------+----------->
   | (1)           .-*LIBL/-------.                  |
   '------XCHPGM(--+--------------+--program-name--)-'
                   '-library-name/'

>--+-----------------------+--+--------------------------+------->
   |           .-*DNS-.    |  |            .-*MAP---.    |
   '-RESOLVE(--+-*IP--+--)-'  '-CODEPAGE(--+-*HEX---+--)-'
                                           +-*JOB---+
                                           '-number-'

When using this functionality, consider the following:

  • This functionality is only supported by the client if SYNC(*YES) is specified.
  • This functionality is only supported by the client if either RECEIVE(*YES) or SEND(*YES) is specified.
  • You can specify up to 32 parameters of up to 4095 characters can be specified.
  • Parameters past this point are not prompted by default.

The SBMITPJOB has the following parameters:

  • SERVICE

    Required. Specifies the name of the Service that the job is submitted to.

  • PARS

    Optional. Specifies up to 32 parameters for the job. Every parameter can contain up to 4095 characters.

  • HOST

    Required. Specifies the host name of the remote host running the KCM Core.

  • PORT

    Required. Specifies the KCM Core port number or port name.

  • JOBID

    Required. The Job ID used to identify the job in the KCM Core queue. This parameter cannot be blank.

  • SYNC

    Optional. Specifies whether the command waits until KCM Core has processed the job. *YES: Wait until the job is completed. *NO: Terminate after the server has acknowledged receipt of the job.

  • CONFIRM

    Optional. Specifies whether the client must confirm termination of the job back to KCM Core before the job is considered to be completed successful. *YES: Require confirmation. *NO: Do not require confirmation.

    This option is only used if SYNC(*YES) is specified.

  • RECEIVE

    Optional. Specifies whether the client is allowed to receive files from KCM Core. *YES: The client is allowed to receive files. *NO: The client is not allowed to receive files. Any attempts to use the SendFile command in a KCM Core script will fail.

    This option is only used if SYNC(*YES) is specified.

  • SEND

    Optional. Specifies whether the client is allowed to send files to KCM Core. *YES: The client is allowed to send files. *NO: The client is not allowed to send files. Any attempts to use the ReceiveFile command in a KCM Core script will fail.

    This option is only used if SYNC(*YES) is specified.

  • MSG

    Optional. Specifies if the command sends progress messages to its caller. *YES: Send messages to the caller. *NO: No messages are sent.

    If the MSG(*YES) parameter is specified, the SBMITPJOB command can send the following messages to the calling program:

  1. A single completion message if the command terminated successfully.
  2. A single escape message if the command failed.
  3. Informational messages if KCM Core sent progress messages to the AS/400 client.
  • LOG

    Optional. Specifies if the command logs messages in the REQHST file. *YES: All messages are logged. *NO: No messages are logged.

  • XCHGFIL

    Optional. Specifies to which file the client writes the data sent with the exchange_data function. If this parameter is not specified data is not written to a file.

    SBMITPJOB sends an empty response back to the KCM Core unless the XCHGPGM parameter is also specified. In that case the response of the XCHGPGM exit program is sent back.

  • XCHGPGM

    Optional. Specifies which exit program the client should call if data is sent with the exchange_data function. If this parameter is not specified, no exit programs are called.

    SBMITPJOB sends an empty response back to KCM Core unless the XCHGPGM parameter is specified. In that case the response of the XCHGPGM exit program is sent back.

  • RESOLVE

    Optional. Specifies in which order the host name specified with the HOST(...) parameter is resolved.

    *DNS: First attempt to resolve the host name through any configured DNS server, and then attempt to translate the address as a numerical IP address.

    *IP: First attempt to translate the address as a numerical IP address and then attempt to resolve the host name through any configured DNS server.

  • CODEPAGE

    Optional. Specifies how the client should send its code page back to the KCM Core if the script requires a client code page.

*MAP: Attempt to map all characters to Unicode and send this mapping to the KCM Core.

*HEX: Do not perform a code page translation.

*JOB: Send the code page of the job. If the job uses CCSID *HEX, the system code page is sent. If the system also uses CCSID *HEX, no code page translation is performed.

number: Send a specific code page number to the server. This option requires that the code page translation table must be available to KCM Core.

The exchange_data function call in a KCM Core script fails unless the SBMITPJOB command specified either a XCHGPGM or XCHGFIL parameter.

The SBMITPJOB program accesses and creates files through the Integrated File System (IFS).

  • To access /folder1/folder2/document.ext in QDLS, use /QDLS/folder1/folder2/document.ext
  • To access /folder1/folder2/file.ext in IFS, use /folder1/folder2/file.ext
  • To access member MYMBR in MYLIB/MYFILE, use /QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYMBR.MBR

If no path is specified, files are stored in the root of the IFS file system.

An example is provided here.

SBMITPJOB
	SERVICE ('a service')
	PARS('key info' 34)
	HOST('10.0.0.11')
	PORT(3001)
	JOBID('AS/400 Job')
	SYNC(*YES)

This command sends a request to the Service 'a service' configured in KCM Core that runs on 10.0.0.11 with external port 3001. The job has Job ID 'AS/400 Job' and two parameters ('key info' and 34). The SBMITPJOB command waits until the request has been processed.