SYSTEM-COMMAND

File 46
Op-Sys z/OS, BS2000
Statement FIND
  Task BS2000: Any batch mode command can be executed.

Startup parameter SYSTEM-COMMAND-USER defines the list of users who are permitted to use this view.

User exit USERSSEC is called if the parameter SYSTEM-COMMAND-USER was not defined.

If the user exit is not found in the Entire System Server Load Library, any system command will be rejected in multi-user mode.
  z/OS: Execute TSO commands online or in batch.

TSO commands can be issued in Natural environments from TP monitors other than TSO.

Up to 50 commands and sub-commands are allowed.


Common Fields for all Operating Systems

Dictionary Field Name F/L Mu DE Remarks
ERROR-CODE N3      
ERROR-TEXT A58      
SYSTEM-MESSAGE-CODE A10      
NODE N5   D  
NODE-NAME A16   D  
LINE A132      
COMMAND A80 M20 D  

Additional Fields Supported for z/OS

Dictionary Field Name F/L Mu DE Remarks
SUB-COMMAND A80 M50 D Command line for an FTP server. Up to 50 Sub-Commands are allowed. z/OS only.

Field Descriptions

Field Name Type/Length Operating System
LINE (A132)  z/OS, BS2000

Output line. If more than one output line is expected, a FIND loop is required to retrieve all of them.

Field Name Type/Length Operating System
COMMAND (A80)  (M20) z/OS, BS2000
z/OS Commands to be executed by TSO.
BS2000 The values specified with the field occurrences are taken without any changes and concatenated to a single command which is passed to the system.

Remember that the command is executed under the BS2000 user ID where the Entire System Server is running.

Field Name Type/Length Operating System
SUB-COMMAND (A80) (M50)  z/OS

For COMMAND FTP, commands specific to FTP are set up in field SUB-COMMAND. Up to 50 SUB-COMMANDS are allowed. SUB-COMMANDS are only allowed for ONE COMMAND in a FIND or PROCESS statement.

As an example see section How to run an FTP from Mainframe Natural Using Entire System Server. Using the new sub-command key PASSWORD will prevent the password to appear unencrypted, e.g. in traces or outputs.

Relevant Error Codes

Code Text z/OS BS2000
530 Access denied by security.   X
699 Not enough main storage.   X
750 Invalid operand.   X
772 BS2000 command returned error.   X
799 Internal error.   X

Example:

z/OS: The following program issues the TSO command LIST and requests a list of all datasets that start with the string WKK:

FIND     COMMAND WITH  COMMAND = 'LISTC LVL (''WKK'')'
  DISPLAY LINE (AL=79)
  END

Output from the program:

IKJ56644I NO VALID TSO USERID, DEFAULT USER ATTRIBUTES USED
  READY
  PROFILE PREF(WKK     )
  READY
  LISTC LVL ('WKK')
  NONVSAM ------- WKK.BROKER.API.C
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.BROKER.API.LIST
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.BROKER.API.LOAD
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.BROKER.API.OBJ
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.CLOG
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.COMN.IV123.SYSTEM
       IN-CAT --- UCAT.COM811
  NONVSAM ------- WKK.DUMP

How to run an FTP from Mainframe Natural Using Entire System Server

Using the view SYSTEM-COMMAND, you may execute an FTP from Natural to anywhere, as shown in the example below. First, ask your TCP/IP administrator for the configuration information required by the TCP/IP client programs. This dataset/member is allocated dynamically with a special DDNAME SYSTCPD. The dataset/member name will of course be different at your installation.

Then, code the command FTP, and the subsequent FTP commands are coded here as SUB-COMMANDS.

In the following example, you logon as an anonymous user to the Software AG FTP server and read a list of directories or files available at this moment.

DEFINE DATA LOCAL
01 SYSTEM-COMMAND  VIEW OF SYSTEM-COMMAND
  02 LINE
END-DEFINE
FIND    SYSTEM-COMMAND  WITH NODE = 148
 AND COMMAND = 'alloc f(systcpd) da(''sysm.daef.parmlib(tcpdata)'') shr'
    AND COMMAND = 'FTP                   '
    AND SUB-COMMAND = 'ftp.softwareag.com'
    AND SUB-COMMAND = 'anonymous'
    AND SUB-COMMAND = 'PASSWORD=abc@softwareag.de'
    AND SUB-COMMAND = 'dir        '
    AND SUB-COMMAND = 'help       '
    AND SUB-COMMAND = 'quit    '
  PRINT  LINE(AL=132)
END-FIND
END  

The output looks like this:

PROFILE PREF(WKK     )

READY
ALLOC F(SYSTCPD) DA('SYSM.DAEF.PARMLIB(TCPDATA)') SHR
READY
FTP
>EZA1736I FTP
>EZY2640I Using /etc/ftp.data for local site configuration parameters.
>EZA1450I IBM FTP CS V1R8
>EZA1456I Connect to ?
>EZA1736I ftp.softwareag.com
>EZA1554I Connecting to: server21.softwareag.com 193.26.193.60 port: 21.
>220 Software AG FTP Server ready
>EZA1459I NAME (ftp.softwareag.com:WKK):
>EZA1701I >>> USER anonymous
>331 Anonymous login ok, send your complete email address as your password.
>EZA1789I PASSWORD:
>EZA1701I >>> PASS
>230-
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >> S O F T W A R E   A G
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >> Hello 10.20.91.61, there are 5 (max 10) users logged in
> >> at the moment.
> >> Local time is: Tue Sep 18 16:56:02 2007
> >>
> >> Please use your email address as password and NOT silly words
> >> like "mozilla@" or "WWWuser@", as some Web browsers do!
> >>
> >> If you have any questions concerning this ftp archive, please
> >> send a mail to firewall-admins@softwareag.com
> >>
> >> All transfers are logged! If you don't like this, disconnect now.
> >> ------------------------
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>230 Anonymous access granted, restrictions apply.
>EZA1460I Command:
>EZA1736I dir
>EZA1701I >>> PORT 10,20,91,61,7,78
>200 PORT command successful.
 >EZA1701I >>> LIST
 >150 Opening ASCII mode data connection for file list.
 >EZA2284I drwxrwxr-x   2 40       150         12288 Sep 18 11:50 incoming
 >EZA2284I drwxrwxr-x  30 40       150          4096 Sep 18 14:25 outgoing
 >226 Transfer complete.
 >EZA1460I Command:
 >EZA1736I help
 >EZA1576I User-FTP understands these commands:
 >EZA1577I !         ?          acct      append   ascii     big5       binary
 >EZA1577I block     ccc        cd        cdup     clear     close      compress
 >EZA1577I cprotect  debug      delete    delimit  dir       dump       ebcdic
 >EZA1577I euckanji  feature    file      get      glob      hangeul    help
 >EZA1577I ibmkanji  jis78kj    jis83kj   ksc5601  language  lcd        lmkdir
 >EZA1577I locsite   locstat    lpwd      ls       mdelete   mget       mkdir
 >EZA1577I mode      mput       noop      open     pass      private    prompt
 >EZA1577I protect   proxy      put       pwd      quit      quote      record
 >EZA1577I rename    restart    rmdir     safe     schinese  sendport   sendsite
 >EZA1577I site      sjiskanji  srestart  status   stream    structure  sunique
 >EZA1577I system    tchinese   tso       type     ucs2      user       verbose
 >EZA1578I Specify a command by any unambiguous prefix
 >EZA1579I Specify a local data set by qualifier.qualifier... with optional
 >EZA1580I member as (member).  Enclose fully qualified names in quotes
 >EZA1581I For information about a particular command, say 'HELP command'
 >EZA1460I Command:
 >EZA1736I quit
 >EZA1701I >>> QUIT
 >221 Goodbye.
 READY
 END

Default Order of Data Returned

Each line of the output listing is presented in order.