» IT tipps and howto's

AS400/iSeries: Useful commands and helpful information

Last Update: February 1st, 2011

The AS400 system, also known as IBM iSeries is not a system todays (younger) technicians would chose to work with. It it not possible to compare it to another OS because it is completely different. You can't even work with a normal keyboard on it - or do you have a key 'F18' ? But these systems still exist and some very stable programs run on them - since many many years. Probably before my time...
Needless to say that nowadays it is rare to work with such systems but you never know when this could happen to you. As it happened to me as well. The following commands are the ones I personally used most of the times. Most of them are basic but important commands to manage the system. I hope this will be of service.

This list of AS400 Commands should be taken a look at, it helped me a lot:
http://martinri.freeshell.org/as400/as400-commands.html
(if someday the above website isn't available anymore, here is the text output of the website)

SYSTEM COMMANDS

View/Change a user beginning with ADM.
With option 12, it is possible to see which objects are owned by this user.:

wrkusrprf ADM*
wrkusrprf ADM* -> Option 12

Show messages for user QSYSOPR. Work with messages for user QSYSOPR (e.g. to reply):

dspmsg qsysopr
wrkmsg qsysopr

Show/Change System Values:

WRKSYSVAL *ALL

Change System Value for Date:

WRKSYSVAL QDATE

Display AS400 Version:

GO LICPGM [Enter]
Option 10 [F11]

Display several network information:

NETSTAT

Display contents of an audit log. Here we search for User Profile Changes (CP) done by ADMUSER in the given journal:

DSPAUDJRNE ENTTYP(CP) USRPRF(ADMUSER) JRNRCV(AUDITSYS/AUDRCV0009) OUTPUT (*)

Show disk utilization by library:

PRTDSKINF


SOURCE CODE COMMANDS

To be able to see/edit source code of programs:

wrkobjpdm $LIBRARY $SRCFILE -> Option 12 to show members -> Option 5 to display source code
wrkobjpdm qgpl qclsrc -> Option 12 -> Option 5 on wanted member

*************** Beginning of data ************************************************************
0001.00 PGM 100101
0002.00 CHGSYSVAL SYSVAL(QTIME) VALUE('000030') 100101
0003.00 CHGJOBSCDE JOB(CHGTIME) 100101
0004.00 CHGJOBSCDE JOB(SAVDAILY) 100118
0005.00 ENDPGM 100101
****************** End of data ***************************************************************


JOB COMMANDS

Work with a Job. In this example, check, when daily saves ran and if saves were correctly finished by checking the output spool files

wrkjob $JOBNAME
wrkjob SAVDAILY

Work with Outqueues (Job Outputs):

wrkoutq [Enter] -> Select Output Queue
wrkoutq [Enter] -> QPRINT (System Output) -> Option 5 (Work with) -> Select Output and Display with Option 5

To see list and work with active jobs:

wrkactjob

Check and create scheduled jobs (like cronjobs):

wrkjobscde

Launch a job in the "background" so terminal isn't blocked:

sbmjob [F4] -> Enter your job/command


FILE/OBJECT/LIBRARY COMMANDS

To copy a file's content to another:

cpyf [F4] -> From file: SRCFILE, Library: MYLIB, To File: DSTFILE, Library: QGPL, Replace: *REPLACE [Enter] -> (back in Submit Job) [ENTER]
CPYF FROMFILE(MYLIB/SRCFILE) TOFILE(QGPL/DSTFILE) MBROPT(*REPLACE) CRTFILE(*YES)

Show number of rows of a physical file (e.g. file has to be copied and the number of rows are compared to verify the copy):

wrkobjpdm lib($libraryname) obj($objectname) -> Option 12 -> Option 8
wrkobjpdm lib(MYLIB) obj(MYOBJ) [Enter] -> Option 12 (to open object) [Enter] -> Select file and Option 8 (display information [Enter]

To work with contents/objects of a library. You will be able to use object actions as copy or rename:

wrkobjpdm lib($libraryname)
wrkobjpdm lib(LIV0392353)
wrkobjpdm LIV0392353

Show if selected object is currently in use (and by which tasks) or not:

wrkobjlck [F4] -> $name of obj -> library: $libraryname -> Type: $objtype
wrkobjlck [F4] -> MYOBJ -> library: MYLIB -> Type: *PGM
WRKOBJLCK OBJ(MYLIB/MYOBJ) OBJTYPE(*FILE)

The same for a library, not an object:

WRKOBJLCK OBJ(QSYS/MYLIB) OBJTYPE(*LIB)

Show permissions of a library and object:

DSPOBJAUT OBJ(QSYS/MYLIB) OBJTYPE(*LIB)
DSPOBJAUT OBJ(QGPL/MYOBJ) OBJTYPE(*FILE)

Change object permissions (grand permissions):

GRTOBJAUT OBJ(QSYS/OLYFEOY) OBJTYPE(*ALL) USER(MYUSER) AUT(*ALL)
GRTOBJAUT OBJ(OLYFEOY/*ALL) OBJTYPE(*ALL) USER(MYUSER) AUT(*ALL)

Create physical file from spoolfile (e.g. for FTP-Transfer). The following info should be read:
http://www-01.ibm.com/support/docview.wss?uid=nas1755a79259940d4b5862565c2007d448d

CRTPF MYLIB/MYPFILE rcdlen(132) maxmbrs(*Nomax) size(*nomax) lvlchk(*no)
CPYSPLF FILE(MYSPLF) JOB(128198/MYUSER/MYJOB) TOFILE(MYLIB/MYPFILE)


BACKUP/RESTORE AND TAPE COMMANDS

Save Object in a Save File (SAVF):

SAVOBJ [F4]
Objects: Name of Obj to save
Library: From which Library
Device: *SAVF [F10]
Save file: Name of the Savefile
Library: Where to save the SAVF

Display contents of a SAVF:

DSPSAVF [F4]
SAVF: Name of your SAVF
Library: Where your SAVF is located

Restore Object from a SAVF:

RSTOBJ [F4]
Objects: Object to restore
Saved library: Name of the saved library in savefile
Device: *SAVF [F10]
Save file: Name of SAVF
Library: Library of Savefile
Restore to Library: Library to temporary restore the object

Save Object on tape device (here the tape device's name is TAP01):

savobj [F4]
Objects: Name of Obj to save
Library: From which Library
Device: TAP01

Show contents of tape in tape device TAP01 and save the info in a file:

DSPTAP [F4]
Device: TAP01
Volume identifier: *MOUNTED
Output: *OUTFILE [F10]
File to receive output: TAPLIST
Library: QGPL

Another way to show contents of tape on screen (one sequence number at a time):

DSPTAP DEV(TAP01)

Restore library (MYLIB) from tape:

RSTLIB SAVLIB(MYLIB) DEV(TAP01) VOL(*MOUNTED) SEQNBR(0000000148) RSTLIB(MYLIB)

Eject Tape:

CHKTAP DEV(TAP01) ENDOPT(*UNLOAD)

Initialize tape (is like a format of the tape), all data on tape will be deleted. Tape will be given a new name (BKP1):

INZTAP DEV(TAP01) NEWVOL(BKP1) CHECK(*NO)


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder