Category:Commands

From MidrangeWiki
Jump to: navigation, search

Commands available in OS/400 both come with the 400 and can be added by programmers. Commands can also be placed inside of CLP programs. Anytime we find ourselves doing the same command day in day out, that is a candidate to nest what we are doing into a CLP program and place it on some convenient Menu.

Command Prompting

When keying in a command, instead of pressing the ENTER key, we can do F4. This displays a screen showing the various parameters available ... we can put cursor on one of them and F4 to see list of what can be keyed there, or F1 for help about those options.

This works for commands on Command Line and also for commands within a program. Also see CLP Coding Rules.

Command Structure

IBM supplies over 1,500 commands native to OS/400 that are composed of 3 letter abbreviations (usually 3 letters) of a compound combination of Verb-Object-Modifier as shown by examples below.

  • DSPSFWRSC for example
    • DSP Display (verb)
    • SFW Software (object)
    • RSC Resources (modifier)
    • This generally refers to software from IBM that comes with OS/400; it can refer to 3rd-party software that was created and installed using the Software Product APIs or System Manager.

If you know part of the name of some command, you can use GO CMDxxx to get a menu of all commands which include xxx as part of the name.

  • GO CMDSCDE for Scheduler

Verb

This is not a complete list.

If you know part of a command name, but forget the whole thing, key first few letters then * asterisk wild card to get list of all commands with that prefix.

  • ADD to an object's contents
  • CHG Change
  • CLR Clear the contents of an object
  • CRT Create an object
  • DLT Delete an object
  • DSP Display
  • END
  • HLD Hold
  • RLS Release from Hold
  • RST Restore from external media
  • SAV Save to external media (tape, optical, save file)
  • STR Start
  • WRK Work with
    • Most WRK includes access to many other commands vs. same kind of objecrt, such as ADD CHG DEL

Object

After the verb comes what object type we going to do that verb to.

This is not a complete list.

Modifier

Some of the Object examples above are actually two parts

  • DSPMSG* shows that we have many commands with that prefix
    • DSPMSGF vs. Message Files (error messages and informational messages
    • DSPMSGQ vs. Message Queus
  • DSPSYSSTS is a non-input-capable version of WRKSYSSTS data,
    • where SYS (System) is the object and STS (Status)is the modifier
    • we also find STS in DSKSTS (Disk Status) and CFGSTS (Configuration Status)

Command Syntax

Commands can be supplied by IBM as part of OS/400 and i5/OS or additional licensed program products (LPPs), by 3rd-party software suppliers or by in-house programmers. The syntax of commands is the same regardless of their source.

Learning command language (CL) command syntax gives the ability to understand how to use any command from any source. It also provides a solid foundation for creating your own commands.

File Commands

Useful commands for navigating the layout of files, and the contents of files.

  • WRKOBJ Work with Objects
    • Use this with part of file or other object name, and wild card v.s. library list or *ALL libraries, to see where the file exists
  • RUNQRY *N File-Name
    • F4 with this and explore options like may select records, send output to screen or to report
    • Here we use Query using the External Definitions to display the contents of the file.
    • With the selection or records *YES we can explore some criteria then F12 back to the selection screen to alter our selection criteria.
    • See Query for more navigation tips.
  • DSPPFM then file name and member name
    • Like RUNQRY *N File-Name, this is a dump of the contents of the file.
    • Unlike RUNQRY *N File-Name, this is a way to decipher the innards of packed fields.
    • If you do not specify member, it defaults to MBR(*FIRST) which is the first member created for this file, as opposed to *LAST the most recent, or use a specific member name.
  • DSPLIB
    • Use this to check on the existence of library contents
  • DSPFD then file name - physical or logical
    • Use this to check on statistics about the file - # records, # members and their names, # accesses of various kinds, amount of disk space, room for file growth, and so forth ... put "B" for Bottom on the control line if you want to go straight to the bottom line info
      • Suppose the file is about to fill up ... use CHGPF to change definition to accommodate more growth.
      • Suppose we are out of members but need more. Use CHGPF to increase MAXMBRS then ADDPFM to name the new member.
      • After adding physical file member, we need to check on logical file member(s).
  • DSPFFD then file name
    • Use this to check on file layout
  • DSPDBR then physical file name
    • Use this to identify all logicals that point at this physical file.
  • GO CMDF to check on other commands that have something to do with files
    • GO CMDPF physical files
    • GO CMDLF logical files such as CHGLFM = change logical file member
      • GO CMDPFM physical file members commands
        • RGZPFM can reorganize a physical file member to purge out deleted records, and use logical view to re-order phusically in sequence of that logical
  • GO CMDM to check on commands to do things with members