01/07/08 - How to find more information about a command and its parms

When a command is prompted (F4) and displayed, position the cursor on the command title at the top of the screen and press F1 for Help.

To know more information about a command parameter, when the command is prompted, position the cursor on the parameter and press F1 for Help.

To know the list of values for a command parameter, when the command is prompted, position the cursor on the parameter and press F4 for List.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2009, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

12/22/08 - How to find commands when you know the action/verb

How to find commands when you know the action/verb you want such as ‘Save’ or the subject you want such as ‘Tape Device’

From a command line, press F4 to get the Major Command Groups menu. From this menu select the type of commands you want to see (i.e., option 2 will show Verb Commands, option 3 will show Subject Commands). From this list scroll through until you find the verb or subject you need and select the option. Now choose the option number, or type in the command name itself, which is displayed on the right hand side of the screen. The command is now displayed with parameters that are required to be entered.

Additionally, you can type "GO CMDXXX" at a command line (where XXX is replaced with SAV, WRK, DSP, TAP, LIN, etc.) to see all commands within groups.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

12/10/08 How to create a self-submitting CL program

Have you ever written a program that you did not want someone to be able to run interactively? The following code example can be used to create a CL program that will get submitted to batch even if it is called from a command line.

Note: The following is limited to programs with no parameters, but with some modification specific to the program, it can be made to process a program that has parameters.


PGM
/*********************************************************************/
/* Declare the program's file being used */
/*********************************************************************/
DCLF FILE(QADSPOBJ)

/*********************************************************************/
/* Declare program variables */
/*********************************************************************/
DCL &DEVICE *CHAR LEN(10) /* The job name running this pgm */
DCL &USER *CHAR LEN(10) /* The user running this pgm */
DCL &NBR *CHAR LEN(6) /* This job number */
DCL &TYPE *CHAR LEN(1) /* This job type */
DCL &MSGKEY *CHAR LEN(4) /* Message key for sbmjob routine*/
DCL &SENDER *CHAR LEN(80) /* The sender of a message */
DCL &PROGRAM *CHAR LEN(10) /* Program that sent a message */
DCL &CMD *CHAR LEN(1024) /* Cmd for QCMDEXC */
DCL &CMDLEN *DEC LEN(15 5) /* Length of command */
/*********************************************************************/
/* Declare standard error handling variables */
/*********************************************************************/
DCL &ERRORSW *LGL /* Standard error */
DCL &MSGID *CHAR LEN(7) /* Standard error */
DCL &MSG *CHAR LEN(512) /* Standard error */
DCL &MSGDTA *CHAR LEN(512) /* Standard error */
DCL &MSGF *CHAR LEN(10) /* Standard error */
DCL &MSGFLIB *CHAR LEN(10) /* Standard error */
DCL &KEYVAR *CHAR LEN(4) /* Standard error */
DCL &KEYVAR2 *CHAR LEN(4) /* Standard error */
DCL &RTNTYPE *CHAR LEN(2) /* Standard error */

/*********************************************************************/
/* Monitor for the global error to handle errors that are not */
/* specifically checked */
/*********************************************************************/
MONMSG MSGID(CPF0000) EXEC(GOTO STDERR1) /* Std err */

RTVJOBA JOB(&DEVICE) USER(&USER) NBR(&NBR) TYPE(&TYPE)
CHGVAR &CMDLEN VALUE(1024.0)
CHGVAR &CMD VALUE(' ')

/*********************************************************************/
/* If this program is called interactively submit it to batch */
/*********************************************************************/
IF (&TYPE = '1') THEN(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) TOPGMQ(*SAME) +
KEYVAR(&MSGKEY)
RCVMSG MSGTYPE(*INFO) MSGKEY(&MSGKEY) WAIT(*MAX) +
SENDER(&SENDER)
CHGVAR VAR(&PROGRAM) VALUE(%SST(&SENDER 27 10))
SBMJOB CMD(CALL PGM(&PROGRAM)) +
JOB(&PROGRAM) LOG(4 00 *SECLVL)
RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*COMP)
RETURN
ENDDO

/*********************************************************************/
/* Insert program code here */
/*********************************************************************/



END:
RETURN

/*********************************************************************/
/* Process the standard error handling routines */
/*********************************************************************/
STDERR1:
IF &ERRORSW SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
CHGVAR &ERRORSW '1' /* Set to fail on error */
RCVMSG MSGTYPE(*EXCP) RMV(*NO) KEYVAR(&KEYVAR)
STDERR2: RCVMSG MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) +
KEYVAR(&KEYVAR2) MSG(&MSG) +
MSGDTA(&MSGDTA) MSGID(&MSGID) +
RTNTYPE(&RTNTYPE) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
IF (&RTNTYPE *NE '02') GOTO STDERR3
IF (&MSGID *NE ' ') SNDPGMMSG +
MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
IF (&MSGID *EQ ' ') SNDPGMMSG +
MSG(&MSG) MSGTYPE(*DIAG)
RMVMSG MSGKEY(&KEYVAR2)
STDERR3: RCVMSG MSGKEY(&KEYVAR) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

12/3/08 How to see space location locks

Using option 12 of the DSPJOB command may not show an abnormal number of locks, (i.e. it might just show a few object-level locks being held by the job), but if you are having locking issues there may be many “space location” locks that you don’t see. A space location lock is a symbolic locking protocol.

Unfortunately, there is no way to see space location lock information from a 5250 green screen; however, there is a way to view this with iSeries Navigator. Using “My Connections” in Navigator:
1. Expand the system you are interested in
2. Go to: Work Management > Active Jobs
3. Right-click on the job in question
4. Go to: Details > Locked Objects
5. At the top of this screen, go to: View > Customize this View > Include
6. Select the box to include space location locks

This view will show all locks—object level locks and/or space location locks. To show details about an individual lock, simply right-click on the lock of interest and select Properties. That display will show you more detailed information (such as how many locks this job holds on that object). Additionally, the ‘Details’ tab shows the module, library, program and instruction that was executed to gain that lock.


To learn more about space location locks, go to: http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzahw/rzahwsllco.htm


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

11/26/08 - Holiday - New post next week!

11/19/08 Use the Security Audit journal to find out when an object was deleted and by whom

Ever wonder what happened to one an object that is missing on a system? If not too much time has elapsed, you might be able to track what happened to that object (or set of objects) by viewing the Security Audit journal on the local system (provided you have access to the journal and the Audit Journal is running).

Enter the following command:

DSPAUDJRNE ENTTYP(DO) OUTPUT(*PRINT) JRNRCV(*CURCHAIN)

The value in the ENTTYP parameter represents the type of audit entry to display. For example, ‘DO’ represents ‘object deletion’ actions. ‘CO’ represents ‘object creation‘ actions (to see the eligible values for this parameter and their meanings, press the Help key).

This command creates a spool file for each of the entry types specified on the ENTTYP parameter. View the resulting spool file and search for the name of the object and/or library for which you are interested. The entry, if found, will show the job name and the time of when the object was deleted.
There are other obvious audits that you can also accomplish with this tool, such as viewing when system values have changed and who may have changed them. The ENTTYP for system value changes/modifications is ‘SV’.

The DSPAUDJRNE command can be subset by starting and ending date/time if you know an approximate time period that is of interest to you.

The CPYAUDJRNE command provides similar functionality, except that output can be directed to an outfile, which may be more useful in an automated environment.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.


11/12/08 WRKACTJOB - the F21 key

By default, the WRKACTJOB screen shows commands at the top of the screen, but when you press F21, these commands are hidden and you will see six additional jobs on the screen.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

11/5/08 WRKACTJOB - the JOB parameter

When using the WRKACTJOB command, the JOB parameter can be used to see all jobs (*ALL appears by default) a specific active job by name, or to select and view multiple jobs using a wildcard.

As an example of a wildcard, the following would show all jobs that start with "BATCH":

WRKACTJOB JOB(BATCH*)


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

10/29/08 WRKACTJOB - The SBS parameter

When using the WRKACTJOB command, the SBS parameter defaults to *ALL, but you can use this parameter to show one, several or many subsystems.

For instance, the following command will show jobs associated with three different subsystems:

WRKACTJOB SBS(QBATCH QBATCH1 QBATCH2)



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

10/22/08 How to view remote systems that can be accessed from a local system.

To show what remote systems you can access from a local system, simply use the WRKLNK/QFileSvr.400/* command. This will show you the remote system names that are accessible as they will appear as directories.

What if the remote system you wish to access does not appear in the list of directories? Simply create a directory of the same name as the system you wish to access. The name of the system is the TCP/IP host name or the SNA name of the remote system. Note: The QSERVER subsystem must be active on the remote system that you wish to connect to in this way.




Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

10/15/08 How to access IFS objects on a remote system.

To access the IFS on a remote system, type the following on a command line: WRKLNK/qfilesvr.400/(system name). For instance, if you are on system "ABC02" and want to access the IFS on system "ABC01", the command would be: WRKLNK/qfilesvr.400/ABC01.
The resulting screen shows the entire IFS file system on system ABC01. From here, you can do anything in the IFS that you can do if you were locally connected to ABC01 (including creating IFS objects, removing IFS objects, etc.).

Next week’s tip will show you how to quickly see what remote systems you can access from a local system, and even how to access a system that you can’t see.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

10/08/08 Easy way to look up and verify i5/OS commands:

If you happen to forget a command, or need to verify which command to use, start with the WRKCMD command. Specify *ALL and leave the Library as *LIBL. When you press Enter, a list of all commands will appear with a description of what each does.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

9/30/08 Use SQL to have i5/OS automatically handle a data type conversion

Use SQL (or any other HLL) to compare character and graphic data in two different products where their database CCSIDs are different (e.g. CCSID 65535 and CCSID 13488). This can be done without handling the data type conversion within SQL itself. All you need to do is to ensure the SQL program is running with job attributes that point to a system CCSID. When this is done, i5/OS automatically handles the conversion.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

09/23/08 How to always see correct field names for a physical file

To quickly see the fields that are available in a physical file without having to run a SQL statement use the DSPFFD command.

  1. Type from command line DSPFFD
  2. Press F4
  3. Type the File name and the Library where it is located
  4. Press Enter
You will see the all the column names in the file along with their descriptions.

This simple command is often superior to running a SQL statement because the names of fields in a file are not always correctly shown when using SQL. The DSPFFD command will always return the correct naming convention of the column names.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

09/16/08 How to map an IFS drive from a Windows PC

1. Go to My Computer and click Tools, then select Map Network Drive.
2. Select any drive Letter that in not in use. In the folder section you would put \\systemname\directory you would like access to, for example: \\PROD\TESTING.
3. You will be prompted for your user ID, which is your domain user ID (for example, Vision\AS400 Login ID), and your passoword, which is your i5/OS login password.

You will now have access to folders and files in this portion of the IFS. Going forward, all you need to do is go to My Computer and click on your mapped drive.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

9/09/08 Display contents of a command string

When you use an i5/OS command that is an IBM command, if you want to see what your command string is going to look like when it is executed, press F14 from the command line. The Display Command String screen will appear and show you all of the parms that you have changed. The screen will look something like this:

Display Command String


CPYF FROMFILE(HALA0A/EPIC)

TOFILE(QTEMP/EPIC)

CRTFILE(*YES)


This command is especially handy with longer commands. It is also useful if you need to cut and paste a command to another system.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

9/1/08 Change the default Java Runtime Environment for a specific user

To use a different version of Java as the default runtime environment for a specific user, create a new STMF file on the IFS within the home directory for the user as follows:

/home/UserPrf/SystemDefault.properties

Note: Replace underscored values with appropriate values.

This file should contain one line (e.g. 1.4, but it can be any version that is installed on the system), i.e.: java.version=1.4

Save and exit the file and that User will now be using this specified version of Java.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

08/26/08 Removing IFS folders via i5/OS "green" screens

Using the WRKLNK command, navigate to the folder that is above the folder you want to delete and type option 2. Press Enter. From the display that appears, type option 9 (Recursive delete) next to the folder you want to remove and press Enter. The folder and all sub-folders will be removed.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

08/19/08 Command Entry screen tips

To get to the Command Entry screen from any command line, do a Call QCMD. Once you are on the Command Entry screen, to view a full screen of lines for the entry of your command, press F11. Pressing F11 again brings your screen back to a partial display mode. If you select F10 (with the screen on partial display mode) it will include all detailed messages and commands that you have previously executed and show you the request level that they were run under.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, i5/OS and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

08/12/08 Creating a single startup program for multiple systems

This tip is particularly useful if you are using an iSeries high availability product for disaster recovery purposes. The idea is to create one startup program that will work on two or more systems -- one source code for multiple systems.

Use a data area to define the system's role in the iSeries replication environment. For example, the production system data area would have a setting of SRC and the backup system the setting of TGT. You may also want to define a value of SWT when the system is in the process of switching.

When a system is the production system, you want production subsystems/processes to start when the system is IPL'd. When a system is the backup system, you likely do not want these subsystems/processes to be started when the backup system is IPL'd. Of course, there will be some things you will want to start on all systems regardless of its role.

In the startup program, retrieve the pre-defined data area and then process accordingly.

Example source code for the startup program:


PGM

DCL VAR(&SYSROLE) TYPE(*CHAR) LEN(3)
RTVDTAARA DTAARA(YOURLIB/SYSROLE (1 3)) RTNVAR(&RTNVAL)
MONMSG MSGID(CPF1015) EXEC(CHGVAR VAR(&RTNVAL) +
VALUE('UNK'))

SELECT
WHEN COND(&SYSROLE = 'SRC') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS THE SOURCE */

ENDDO

WHEN COND(&SYSROLE = 'TGT') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS THE TARGET */

ENDDO

WHEN COND(&SYSROLE = 'SWT') THEN(DO)

/* INSERT COMMANDS TO RUN WHEN SYSTEM IS MID SWITCH */

ENDDO
ENDSELECT

/* INSERT COMMANDS TO RUN REGARDLESS OF SYSTEM ROLE */

ENDPGM



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

8/4/08 Designating authorities for journaled objects

System managers who work with journals don’t always realize when they create new journals that an authority can be designated for the journal receiver that differs from the object being journaled.

For more information on managing authorities for journals and receivers, see the IBM Redbook Technote on the topic at: http://www.redbooks.ibm.com/abstracts/tips0604.html.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

7/28/08 Using the System Request menu.

The System Request menu is basically a shortcut screen that allows you to access some commonly used commands without leaving the your current screen.

Accessing the System Request menu can be done in a variety of ways depending on your environment and emulation program. Common ways are: pressing the SHIFT and SysRq keys together, or if using PC emulation, right clicking your mouse and selecting ‘SysRq’ from the pop-up window.

Transfer to secondary display session.
Choosing Option 1 will give you a second sign on for the same session, but there is a caveat: once you start another session the first one is paused and it will not resume until you go back to it. This is important to remember if you are running an interactive query, compile, etc.

Cancel a display session
To cancel out the display session that your are viewing, use Option 2.

Display user messages
User messages for your log-on profile can be seen by selecting Option 4. From there you can also manage the messages (i.e. remove all or selected messages).

View System Operator messages (QSYSOPR) To display the system operator messages use Option 6. It takes you right to the QSYSOPR messages screen. This is particularly useful if your display session is running a program and receives an error message that needs to be answered.

View current job information
See your current job information by selecting option 7. This is particularly useful if you need to see job names and job numbers. If you have second display session running, you can see that job information too.




Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

7/23/08 How to change/create a CL source member and compile on a system where PDM is not available.

Use the command/parms: EDTF FILE(srclib/srcfile) MBR(srcmbr)

You will not be able to prompt the CL commands, but you can cut and paste or simply type the syntax that you want.

Press F3 twice, then use the CRTCLPGM to recompile the program.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

7/14/08 How to fix a print job that hangs because record count is exceeded.

If a job that creates a spool file hangs up with the message, "Reached Maximum number of spooled records for file XXXXXX in library YYYYYY", the printer file has tried to generate spool file records that exceeds the number of records the print job specified. A finite limit to the number of records in a spool file is usually specified in order to control a runaway job from filling up disk space. To increase the number of records the spool file can hold, change MAXRCDS parameter in the CHGPRTF command within the program. Example

CHGPRTF FILE(XXXXXX) MAXRCDS(100000)


Caution: You can change the value of the MAXRCDS parm to *NOMAX, but keep in mind that this takes away the “governor.” If the program somehow gets into a "loop" while the spool file, it will create output until system storage is completely used up causing your system to shut down.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

07/08/08 Automatically monitor message queues for Save While Active checkpoints to execute other actions

The following describes two CL programs that can automate your save process so that prior to it starting a program is submitted to batch that creates a job to monitor the message queue for the checkpoint message. When the checkpoint message is received other processes can then be initiated.

Create a save program (i.e.:pgmlib/savepgm)


PGM
CLRMSGQ MSGQ(QUSRSYS/SWAMSGQ)
MONMSG MSGID(CPF2403) EXEC(CRTMSGQ MSGQ(QUSRSYS/SWAMSGQ))

/* INSERT THINGS TO DO PRIOR TO THE SAVE SO A CHECKPOINT CAN BE REACHED */
/* Example ENDSBS SBS(QINTER) OPTION(*IMMED) */

SBMJOB CMD(CALL PGM(yourlibrary/SWAMONMSGQ)) JOB(#SWAMONMSG)
SAVLIB LIB(libtosave) DEV(yourdevice) +

SAVACT(*SYNCLIB) SAVACTMSGQ(QUSRSYS/SWAMSGQ)
ENDPGM


Create a program to monitor for checkpoint (i.e.: pgmlib/SWAMONMSGQ) that will monitor the message queue for the save while active checkpoint message. When the message is processed, other actions can then be executed; i.e.: letting users back into an application or restarting another process. If multiple backups are running at one time, a message queue for each save should be used.

PGM

DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
LOOP: RCVMSG MSGQ(QUSRSYS/SWAMSGQ) MSGID(&MSGID)
IF COND(&MSGID *NE 'CPI3712') THEN(GOTO CMDLBL(LOOP))

/*INSERT THINGS TO DO AFTER THE CHECKPOINT MESSAGE IS REACHED HERE */
/* Example STRSBS SBSD(QINTER) */


ENDPGM

Submit or schedule the save program you created (pgmlib/savepgm)


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

6/30/08 See the version of Java your System i is running

To see the JDK that the System i you are working on uses by default, enter the command:

JAVA *VERSION.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

6/23/08 Recursively changing ownership on an IFS directory and all the files stored within it

This function needs to be run in STRQSH.

In order to change the owner of all files and directories recursively run the following command:

for eachFile in $(find /directoryToChangeOwner -name '*');

do system "CHGOWN OBJ('"$eachFile"') NEWOWN(userProfile)";done

Note: Replace values in parenthesis with appropriate values.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

6/17/08 - How to streamline the deletion of logical files when you need to delete a physical file

Deleting logical files can be a time consuming task when you need to delete a physical file due to the number of logical files that have no common prefix to the file name to wildcard.

This simple CL program could help:


PGM PARM(&SYS1OBJ &SYS1LIB)
DCL VAR(&SYS1OBJ) TYPE(*CHAR) LEN(10)
DCL VAR(&SYS1LIB) TYPE(*CHAR) LEN(10)
DCLF FILE(QADSPDBR)
OVRDBF FILE(QADSPDBR) TOFILE(QTEMP/DBRRMV)
DSPDBR FILE(&SYS1LIB/&SYS1OBJ) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DBRRMV)
MONMSG MSGID(CPF3012) EXEC(GOTO CMDLBL(EOF))
READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(DLTF))
IF COND(&WHNO *EQ 0) THEN(GOTO CMDLBL(DLTF))
DLTF FILE(&WHRELI/&WHREFI)
MONMSG MSGID(CPF0001)
GOTO CMDLBL(READ)
DLTF: DLTF FILE(&SYS1LIB/&SYS1OBJ)
MONMSG MSGID(CPF0001)
EOF: ENDPGM



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

6/9/08 - How to send a message to multiple users

Type the command CALL QEZSNDMG.

Fill in the parameters as follows:

-Message needs reply (Y or N)
-Interrupt user (Y or N) – will send a break message when Y is specified
-Message text (up to 512 characters)
-Send to – this is a list and can also use special values of *ALL and *ALLACT
Press F10 to send the message

This will send out the message to all of the workstations that the users are signed on to at the time.



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

6/2/08 How to end a job that won't end by itself

Occasionally jobs can get hung up causing them to not end on their own. When this happens, as a last resort, you can use the ENDJOBABN command to force the job to end.


Editor's note: An expanded discussion on this topic can be found here: 10/21/09 Know the impact of using the ENDJOBABN command


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

5/28/08 How to find journal receivers taking the most disk space

Use the following command for an easy way to see the journal receivers that are taking up a lot of disk space on your system:

DSPOBJD *ALL/*ALL *JRNRCV

Example:


Display Object Description - Basic
Library 3 of 87
Library . . . . . . : AUDRCV Library ASP device . : *SYSBAS

Type options, press Enter.
5=Display full attributes 8=Display service attributes

Opt Object Type Size Text
_ AUDRCV1270 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1271 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1272 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1273 *JRNRCV 516202496 Qaudjrn receiver
_ AUDRCV1274 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1275 *JRNRCV 514105344 Qaudjrn receiver
_ AUDRCV1276 *JRNRCV 516202496 Qaudjrn receiver
_ AUDRCV1277 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1278 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1279 *JRNRCV 515153920 Qaudjrn receiver
_ AUDRCV1280 *JRNRCV 516202496 Qaudjrn receiver
_ AUDRCV1281 *JRNRCV 514105344 Qaudjrn receiver



The size of the receivers in the above example are .5 GB or larger. Press the Enter key to move from library to library, viewing the size of each receiver, look for receivers with a size of 10 positions which would indicate a receiver with the size of 1 GB or larger.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners

5/21/08 Creating symbolic links on the IFS

Anybody familiar with UNIX or Linux operating systems is aware of the usefulness of symbolic links to folders and files. This basically involves creating a link to a file in another location from the original, allowing people to access or edit the original file from another location.

On the System i this can be done by prompting the ADDLNK command. Enter the full IFS path of the object you want to link to in the Object field and the full IFS path of the link you would like to create for it.


Use link type *SYMBOLIC if you need to link to an object on another file system or if you would like the link to remain regardless of whether the object you are linking to still exists, use link type *HARD if you would like to make sure links are only maintained whilst the object exists (if you choose to delete the object at a later date you would need to remove its *HARD links first).

**Editor's note: This post was updated on 07/21/08 to correct an inaccuracy pointed out in the comments posted by a reader.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

5/13/08 How to stop page up/page down iterations

Ever held down the ‘Page Down’ or ‘Page Up’ keys down too long and the screen wouldn’t stop advancing? The easy way to stop it is to simply press the ‘Ctrl’ key.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

5/5/08 Copy contents of spool file to a flat file

Step 1:
Create a flat file that has a record length of 132 (most spool files have a width of 132).

CRTPF FILE(FLATFILE) RCDLEN(132)

Step 2: Copy the spool file to the newly created flat file.

CPYSPLF FILE(QPDSPAJB) TOFILE(FLATFILE) JOB(*) SPLNBR(1)

Step 3: Copy the file to the IFS.

CPYTOSTMF FROMMBR('/qsys.lib/library.lib/flatfile.file/flatfile.mbr') TOSTMF('/somewhereintheifs/spoolfile.txt')



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

5/1/08 How to streamline the deletion of logical files when deleting a physical file

Deleting a physical file can be time consuming at times due to the number of logical files that might are associated with it that have no common prefix to the name of the LF (thus cannot be found with a wildcard search).

This short program can help:


PGM PARM(&SYS1OBJ &SYS1LIB)
DCL VAR(&SYS1OBJ) TYPE(*CHAR) LEN(10)
DCL VAR(&SYS1LIB) TYPE(*CHAR) LEN(10)
DCLF FILE(QADSPDBR)
OVRDBF FILE(QADSPDBR) TOFILE(QTEMP/DBRRMV)
DSPDBR FILE(&SYS1LIB/&SYS1OBJ) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DBRRMV)
MONMSG MSGID(CPF3012) EXEC(GOTO CMDLBL(EOF))
READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(DLTF))
IF COND(&WHNO *EQ 0) THEN(GOTO CMDLBL(DLTF))
DLTF FILE(&WHRELI/&WHREFI)
MONMSG MSGID(CPF0001)
GOTO CMDLBL(READ)
DLTF: DLTF FILE(&SYS1LIB/&SYS1OBJ)
MONMSG MSGID(CPF0001)
EOF: ENDPGM



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

4/28/08 How to determine what is eating up your disk space

Step 1. Run the following command :

DSPOBJD OBJ(*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QGPL/OBJLIST)

CAUTION: Depending on the number of objects on your system this could take a while so you may want to submit it to batch:

SBMJOB CMD(DSPOBJD OBJ(*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE)
OUTFILE(QGPL/OBJLIST)) JOB(BLDOBJLIST)

Step 2. Go to the interactive SQL processor (STRSQL) and run the following SQL statement:

SELECT * FROM QGPL/OBJLIST ORDER BY ODOBSZ DESC

The biggest offenders will be at the top of the list!

Step 3. Delete the OBJLIST file (created in Step 1): DLTF QGPL/OBJLIST


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

4/22/08 How to quickly see the contents of a data queue

Use the command:

DMPOBJ OBJ(library/object) OBJTYPE(*DTAQ)

The contents will be found in the spool file called QPSRVDMP



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

4/17/08 How to automate copy, cut, and paste functions using 5250 Client Access

To enable the CTL-X, CTL-C, and CTL-V keyboard shortcuts so that you can delete, copy, and/or paste, click on the “Remap Keyboard Functions” icon (it looks like a little keyboard):

  • Select the “Edit Cut” item in the Function pull down list.
  • Set the Ctrl-X key for this function.
  • Click the “File” menu item and save the keyboard map file.
  • Click the “File” menu item on the 5250 window and save the change to the emulator.
Repeat these same steps to set the Ctrl-C key to run the “Edit Copy” function and the Ctrl-V key to run the “Edit Paste” function.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

4/13/07 How to ensure a job creates a job log when it ends

Ever have a job that ends abnormally but does not create a job log?

The command CHGJOB *SECLVL can be used to change an active job so that it creates a job log, which will allow you to see what has caused it to end.

From the WRKACTJOB screen, find the job and type a 2 (Change) next to the job, then press F10 (Additional parameters)

The following will appear under Message Logging:
Level . . . . . . . . . . . . > 4
Severity . . . . . . . . . . . > 00
Text . . . . . . . . . . . . . > *NOLIST

In the Text field, change *NOLIST to *SECLVL

You can also change parameters on this screen to log additional information about the CL being run.

In the Log CL Program Commands field change *NO to *Yes

So, the CHGJOB would look like this:

Message logging:
Level . . . . . . . . . . . . 4
Severity . . . . . . . . . . . 00
Text . . . . . . . . . . . . . *SECLVL
Log CL program commands . . . . *YES

This would then produce a joblog such as QEZJOBLOG

If you are running this from a command line - then do a CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES) before running your job. This should produce a job log when it ends abnormally (abend) or is shutdown abnormally.

If you cannot change the job once you logon - then look at what job description is being used and change that to the following:

CHGJOBD LOG(4 00 *SECLVL) LOGCLPGM(*YES)

You may need to change the signoff command to LOG(*LIST) to keep it from ditching the job log. SIGNOFF LOG(*LIST) if this is an interactive job you are wishing to log.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

4/7/08 View duration of the last Reclaim Storage operation.

Thinking it is time to run the Reclaim Storage command? Not sure how long it might take? Before you run it, you can see how long the operation took the last time it was excecuted.

On a command line type: DSPDTAARA QUSRSYS/QRCLSTG.

The screen will display the start and end times the last time a full Reclaim Storage command was excuted.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

4/3/08 How to locate partition ID, OS release level, serial number, model number, and processor feature

Your software vendors may ask you to confirm your system information in order to create license codes or PTF (Program Temporary Fix) information. Much information can be gained from system values and data areas.

Partition ID: Outside of the Hardware Management Console (HMC), you can find the partition ID in the Display Service Registration Information option on the Electronic Service Agent menu. To get to this display, open the Electronic Service Agent menu by typing GO SERVICE on a command line.
Select option 6. The screen will display service registration information and the machine type, serial number, and the partition ID.

You can also use the following commands to access these individually.
- i5/OS (OS/400) Release: (DSPDTAARA QSS1MRI) Can also be seen with the DSPPTF command.
- Serial Number: (DSPSYSVAL QSRLNBR)
- Model Number: (DSPSYSVAL QMODEL)
- Processor Feature Code: (DSPSYSVAL QPRCFEAT)


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/28/08 How to retrieve spool files from another System i

First, ensure communications are set correctly by utilizing the SNDNETMSG (Send Network Message) command to send a test message prior to transferring the spooled file.
1. On a command line, type: WRKOUTQ LIBNAME/OUTQ
2. Type "1" next to the spooled file you wish to send and press Enter.
3. Type the User ID. This will be the user you wish to send the spooled file to.
4. Type the name of the machine that the spooled file will be sent to.
5. Type *ALLDATA for the Data Format parameter so this will include all resources associated if needed and press Enter.

Once the spool file transfers, it will be located in the default OutQ for user profile to which you sent it.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/25/08 Process FTP on i5/OS via batch source file

The following code can be used to process an FTP command via a batch program.

Assumptions:

  • The source physical file is labeled QFTPSRC with two source members
  • The value FTPIN contains valid FTP commands
  • The value FTPOUT is an optional empty source member to contain FTP log statements

CLRPFM FILE(LIBRARY/QFTPSRC) MBR(FTPOUT)
OVRDBF FILE(INPUT) TOFILE(LIBRARY/QFTPSRC) +
MBR(FTPIN)
OVRDBF FILE(OUTPUT) TOFILE(LIBRARY/QFTPSRC) +
MBR(FTPOUT)
FTP RMTSYS('xxx.xxx.xxx.xxx')


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/19/08 Using macros in emulator programs

Within most 5250 emulator programs there is a little used featured called a macro. This can save you time and reduce errors. Macros can be used for all kinds of things. For instance, common commands (i.e. a basic spool file look up - WRKSPLF) or a pre-defined query (example: RUNQRY *N ‘name of query’)

Here is an example of using a macro for a basic AS/400 sign on.
(**NOTE: This can pose a security risk as this creates a file that displays this user ID and password in plain text. Anyone with access to the PC and that file could retrieve this information.**)

The following is an example using Client Access. To record the sign-on macro, click on "record" button in your emulator tool bar. A window will pop up asking you to name your macro (example: Signon) and select OK. The macro file will be created in the Client Access private folder with a .mac extension. This is also useful if your password changes so you can modify the macro without creating a new one. Now, type in the user ID and password, hit the Enter key. Once this is done, select the "Stop" button in your emulator tool bar.

To run the macro once the session is started, click on the "Start a macro/script" button or select it in the Actions drop down top bar. At the Play Macro/Script window, select the name of the macro to be used (example: Signon), and then click "OK." This will allow the macro to run automatically when the session is started and automatically log you into the system and run the command you just entered.

*Note: Other emulator programs such as MochaSoft offer similar options.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/14/08 Easy way to remove job schedule entries with one command.

Use the following command:

RMVJOBSCDE *ALL

Or wildcard RMVJOBSCDE XXX*

**CORRECTION**
RMVJOBSCHE *ALL is NOT valid. This was an oversight during the verification process. However the generic version (RMVJOBSCDE XXX*) does work, and will work better if the parameter ENTRYNBR(*ALL) is added to the command as follows: -

RMVJOBSCHE JOB(A*) ENTRYNBR(*ALL)

This command is valid on the following i5/OS environments: V4R5M0, V5R1M0, V5R2M0 and V5R3M0. It has not yet been verified for V6R1M0.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/10/08 Create a Universal SIGNOFF command

How would you like to be able to use the SIGNOFF command to perform any of the three following common connections?



SIGNOFF – normal signoff
ENDGRPJOB – end an active secondary job on a single workstation
ENDPASTHR – end a session to another system

This can be accomplished with the following command and control language code.

Modified SIGNOFF command


SIGNOFF: CMD PROMPT('Sign Off')
PARM KWD(LOG) TYPE(*CHAR) LEN(7) RSTD(*YES) +
DFT(*NOLIST) VALUES(*NOLIST *LIST) +
PROMPT('Job log')
PARM KWD(DROP) TYPE(*CHAR) LEN(5) RSTD(*YES) +
DFT(*DEVD) VALUES(*DEVD *YES *NO) +
PROMPT('Drop line')
PARM KWD(ENDCNN) TYPE(*CHAR) LEN(4) RSTD(*YES) +
DFT(*NO) VALUES(*YES *NO) PROMPT('End +
connection')

SIGNOFF CLP

SIGNOFF: PGM PARM(&LOG &DROP &ENDCNN)

/*=================================================================*/
/* Declare standard error handling variables */
/*=================================================================*/
DCL VAR(&ERRORSW) TYPE(*LGL)
DCL VAR(&MSG) TYPE(*CHAR) LEN(512)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&KEYVAR) TYPE(*CHAR) LEN(4)
DCL VAR(&KEYVAR2) TYPE(*CHAR) LEN(4)
DCL VAR(&RTNTYPE) TYPE(*CHAR) LEN(2)

/*=================================================================*/
/* Declare program parameters */
/*=================================================================*/
DCL VAR(&LOG) TYPE(*CHAR) LEN(07)
DCL VAR(&DROP) TYPE(*CHAR) LEN(05)
DCL VAR(&ENDCNN) TYPE(*CHAR) LEN(04)

/*=================================================================*/
/* Declare program variables */
/*=================================================================*/
DCL VAR(&GRPJOB) TYPE(*CHAR) LEN(10)

/* Setup the generic monitor message for standard error handling */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR1))

/* Determine if this is a group job */
RTVGRPA GRPJOB(&GRPJOB)

IF COND(&GRPJOB *EQ '*NONE') THEN(DO)
ENDPASTHR
MONMSG MSGID(CPF0000) EXEC(DO)
QSYS/SIGNOFF LOG(&LOG) DROP(&DROP) ENDCNN(&ENDCNN)
ENDDO
ENDDO
ELSE CMD(DO)
ENDGRPJOB
ENDDO
GOTO CMDLBL(ENDJOB)

/*=================================================================*/
/* S T A N D A R D E R R O R H A N D L I N G R O U T I N E */
/*=================================================================*/
STDERR1:
IF &ERRORSW SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
CHGVAR &ERRORSW '1' /* Set to fail on error */
RCVMSG MSGTYPE(*EXCP) RMV(*NO) KEYVAR(&KEYVAR)
STDERR2:
RCVMSG MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) +
KEYVAR(&KEYVAR2) MSG(&MSG) +
MSGDTA(&MSGDTA) MSGID(&MSGID) +
RTNTYPE(&RTNTYPE) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
IF (&RTNTYPE *NE '02') GOTO STDERR3
IF (&MSGID *NE ' ') SNDPGMMSG +
MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
IF (&MSGID *EQ ' ') SNDPGMMSG +
MSG(&MSG) MSGTYPE(*DIAG)
RMVMSG MSGKEY(&KEYVAR2)
STDERR3:
RCVMSG MSGKEY(&KEYVAR) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDJOB:
ENDPGM

The key to make this work is that the command and CL program are compiled into a system override library that is put at the beginning of the system library list. Add the library before the QSYS library by modifying the QSYSLIBL system value.




Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/7/08 How to quickly find jobs using high CPU

When a system is performing poorly, in terms of response time, here’s something that can help find the culprit:

WRKACTJOB

From the display, move the cursor to the CPU column heading and use F16 to sort the jobs by that column. From there, it is easy to determine which jobs are consuming system resources (and how much) at that point in time.

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/6/08 Display all installed licensed software.

The following command displays installed licensed software information including actual license key for OS/400.

Key the following on an OS/400 command line: CALL QSFWINV

Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

3/5/08 Remove IFS directory tree in single statement.

(Requires Qshell 5722SS1 Option 30)
Assumption: Directory ABC and all subdirectories need to be removed.

Key the following on an command line: QSH CMD('rm -r /ABC')


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

2/27/08 How to call batch program on remote system.

Generic evoke request (ability to call batch program on remote system) via SNA

CLP Source

$$EVOKETCL: PGM
OVRICFF FILE(QICDMF) ACQPGMDEV(QSNADS)
OVRICFDEVE PGMDEV(QSNADS) RMTLOCNAME(SNIC03ND)
CALL PGM($$EVOKET) PARM('PROGRAM' 'PSWD' +
'USER' 'LIBRARY')
ENDPGM


RPG Source

FQICDMF O F 80 WORKSTN
C *ENTRY PLIST
C PARM $PGM 8
C PARM $PSWD 8
C PARM $USER 8
C PARM $LIB 8
C EXCPTEVOKE
C MOVE '1' *INLR
OQICDMF E EVOKE
O K8 '$$EVOKET'
O $PGM 8
O $PSWD 16
O $USER 24
O $LIB 32


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

2/28/08 Replicating the active OS/400 History Log

If you use a high availability solution and you need to do an emergency switchover, the active history log that is contained in system storage (accessed via DSPLOG) can be replicated to a backup system in order for the history log to be reviewed during an unplanned switch. Using the following CL code*, you can actively poll this storage and store it in an OS/400 DB2 table.

DMPLOG: PGM
DCL VAR(&QTIME) TYPE(*CHAR) LEN(6)
DCL VAR(&QDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&STIME) TYPE(*CHAR) LEN(6)
DCL VAR(&SDATE) TYPE(*CHAR) LEN(6)

CRTPF FILE(QTEMPDB/QHSTLOG) RCDLEN(220)
OVRDBF FILE(QPDSPLOG) TOFILE(QTEMPDB/QHSTLOG) +
LVLCHK(*NO)

DSPLOG OUTPUT(*PRINT)

RTVSYSVAL SYSVAL(QDATE) RTNVAR(&SDATE)
RTVSYSVAL SYSVAL(QTIME) RTNVAR(&STIME)

LOOP: DLYJOB DLY(15)

RTVSYSVAL SYSVAL(QDATE) RTNVAR(&QDATE)
RTVSYSVAL SYSVAL(QTIME) RTNVAR(&QTIME)

DSPLOG PERIOD((&STIME &SDATE) (&QTIME &QDATE)) OUTPUT(*PRINT)
MONMSG MSGID(CPF2447)

CHGVAR VAR(&SDATE) VALUE(&QDATE)
CHGVAR VAR(&STIME) VALUE(&QTIME)

GOTO CMDLBL(LOOP)

ENDPGM



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

2/29/08 Clear false lock on OS/400 Printer Devices.

Occasionally, OS/400 Printer device (AFP capable) will have an "orphaned" lock left on the printer device by an abnormally ended writer job, which prevents successful start of the associated print writer. Key the following on an OS/400 command line to clear the lock:

CALL QSPENDWA PARM('printer device name')


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.