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.