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/28/08 How to retrieve spool files from another System i
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.