********************************************************************************************** * CHKTMPSTG: Checks temporary storage for active jobs, reporting those over preset threshold * Copyright (C) 2001 Martin Rowe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ********************************************************************************************** * Note: Change variable ThresholdMb to the value (in megabytes) to check for. ********************************************************************************************** * Data Structures ********************************************************************************************** * Standard error code DS for API error handling D Error_Code DS D BytesProvd 10I 0 Inz(0) D BytesAvail 10I 0 Inz(0) D Except_ID 7 D Reserved 1 D Exception 256 * Receiver value DS for user space header info (used in first call to QUSRTVUS) D GenRcvrDS DS D UserArea 64 D GenHdrSize 10I 0 D StrucLevel 4 D FormatName 8 D APIUsed 10 D CreateStamp 13 D InfoStatus 1 D SizeUsUsed 10I 0 D InpParmOff 10I 0 D InpParmSiz 10I 0 D HeadOffset 10I 0 D HeaderSize 10I 0 D ListOffset 10I 0 D ListSize 10I 0 D ListNumber 10I 0 D EntrySize 10I 0 ********************************************************************************************** * Type Definition for the JOBL0100 format. ********************************************************************************************** D ListDataDS DS D L_JobName 10 D L_JobUser 10 D L_JobNbr 6 D L_JobIdent 16 D L_Status 10 D L_JobType 1 D L_JobSubTy 1 D L_Reserved 2 D L_JobInfoSts 1 D L_Reserved2 3 D L_NbrFldsRtn 10I 0 D L_LenInfoRtn 10I 0 D L_KeyFld 10I 0 D L_DataType 1 D L_Reserved3 3 D L_LenDataRtn 10I 0 D L_KeyValue 10I 0 ********************************************************************************************** * Field definitions ********************************************************************************************** D DataLength S 10I 0 Inz(140) D CurrentEnt S 5P 0 Inz(1) D ExtendAttr S 10 Inz('USRSPC ') D InitialSiz S 10I 0 Inz(1024) D InitialVal S 1 Inz(X'00') D JobStatus S 10 Inz('*ACTIVE ') D JobType S 1 Inz('*') D ListFormat S 8 Inz('JOBL0200') D NbrToRtn S 10I 0 Inz(1) D KeysToRtn S 10I 0 Inz(2009) D P_DataLength S 10I 0 D P_MsgData S 512 D P_MsgFile S 20 Inz('QCPFMSG *LIBL') D P_MsgID S 7 Inz('CPDA0FF') D P_MsgKey S 4 D P_MsgType S 10 D P_PgmQueue S 10 D P_PgmStack S 10I 0 D PublicAut S 10 Inz('*ALL ') D QualifyJob S 26 Inz('*ALL *ALL *ALL ') D ReplaceSpc S 10 Inz('*YES ') D StartPos S 10I 0 Inz(1) D TextDescrp S 50 Inz('User space for List Job API') D ThresholdMb S 10I 0 Inz(50) D UserSpace S 20 Inz('CHKTMPSTG QTEMP ') ********************************************************************************************** * MAINLINE PROGRAM ********************************************************************************************** * Create a user space to hold the job list entries C Call 'QUSCRTUS' C Parm UserSpace C Parm ExtendAttr C Parm InitialSiz C Parm InitialVal C Parm PublicAut C Parm TextDescrp C Parm ReplaceSpc C Parm Error_Code * List all the *ACTIVE jobs C Call 'QUSLJOB' C Parm UserSpace C Parm ListFormat C Parm QualifyJob C Parm JobStatus C Parm Error_Code C Parm JobType C Parm NbrToRtn C Parm KeysToRtn * Get the header info for this space C Call 'QUSRTVUS' C Parm UserSpace C Parm StartPos C Parm DataLength C Parm GenRcvrDS C Parm Error_Code * Check to see how many entries returned B001 C If ListNumber > 0 * Set the initial offset for the start of the list entries C Eval ListOffset = ListOffset + 1 * Loop through the entries held in the list section of the user space B002 C DoW CurrentEnt <= ListNumber * Get the header info for this space C Call 'QUSRTVUS' C Parm UserSpace C Parm ListOffset C Parm EntrySize C Parm ListDataDS C Parm Error_Code * B003 C If L_KeyValue > ThresholdMb C Eval P_MsgData = 'Job ' + L_JobNbr + '/' + C %Trim(L_JobUser) + '/' + %Trim(L_JobName) + C ' is using temp storage of ' + C %EditC(L_KeyValue : 'Z') + 'Mb' C C Eval P_DataLength = 78 C Eval P_PgmStack = 0 C Eval P_PgmQueue = '*EXT' C Eval P_MsgType = '*INFO' * C Call (E) 'QMHSNDPM' C Parm P_MsgID C Parm P_MsgFile C Parm P_MsgData C Parm P_DataLength C Parm P_MsgType C Parm P_PgmQueue C Parm P_PgmStack C Parm P_MsgKey C Parm Error_Code E003 C EndIf * Bump up the counter & offset for the next entry C Eval ListOffset = ListOffset + EntrySize C Eval CurrentEnt = CurrentEnt + 1 E002 C EndDo E001 C EndIf * C Eval *INLR = *On C Return **********************************************************************************************