/* REXX */ /* */ /* AUTHOR: Mark Zelden */ /* Last Updated 11/14/2006 */ /*********************************************************************/ /* This exec will show the virtual storage usage of the task that */ /* invokes the REXX exec. This could be an interactive TSO user, a */ /* batch TSO step, or even a Unix System Services user / Web server. */ /* For z/OS 1.2 and above running in z/Architecture mode, it will */ /* also display the MEMLIMIT and the MEMLIMIT source. */ /*********************************************************************/ /* SEE OA14391 for an explanation of MEMSRC.10 */ /*********************************************************************/ Numeric digits 14 /* dflt of 9 not enough!*/ ASCB = C2d(Storage(224,4)) /* current ASCB */ LDA = C2d(Storage(D2x(ASCB + 48),4)) /* local data area */ LDALIMIT = C2d(storage(D2x(LDA + 208),4)) /* <16m v=v */ LDALIMIT = Right(LDALIMIT/1024,9) /* convert to kbytes */ LDALOAL = C2d(storage(D2x(LDA + 232),4)) /* <16m v=v alloc */ LDALOAL = Right(LDALOAL/1024,9) /* convert to kbytes */ LDAELIM = C2d(storage(D2x(LDA + 216),4)) /* >16m v=v */ LDAELIM = Right(LDAELIM/1024,9) /* convert to kbytes */ LDAELOAL = C2d(storage(D2x(LDA + 240),4)) /* >16m v=v alloc */ LDAELOAL = Right(LDAELOAL/1024,9) /* convert to kbytes */ LDAREGRQ = C2d(storage(D2x(LDA + 204),4)) /* region requested */ LDAREGRQ = LDAREGRQ/1024 /* convert to kbytes */ AVAIL = Right(LDALIMIT-LDALOAL,9) /* available <16M */ EAVAIL = Right(LDAELIM-LDAELOAL,9) /* available >16M */ /*********************************************************************/ /* MEMLIMIT code */ /*********************************************************************/ Show_MEMLIMIT_Display = 0 /* Init flag to "false" - used later */ CVT = C2d(Storage(10,4)) /* point to CVT */ CVTOSLV3 = Storage(D2x(CVT+1267),1) /* byte 3 of CVTOSLVL */ FLCARCH = Storage(A3,1) /* FLCARCH in PSA */ If bitand(CVTOSLV3,'10'x) = '10'x & , /* z/OS 1.2 64-bit srvs */ C2d(FLCARCH) <> 0 then do /* non-zero is z/Arch. */ Show_MEMLIMIT_Display = 1 /* Set FLAG to "true" */ RAX = C2d(Storage(D2X(ASCB+364),4)) /* point to RAX */ RAXLVMEMLIM = C2d(Storage(D2x(RAX+152),8)) /* MEMLIMIT in MB */ MEMLIM=FORMAT_MEMSIZE(RAXLVMEMLIM) /* Format MEMLIMIT size */ RAXLVMEMLIMS= C2d(Storage(D2x(RAX+184),1)) /* MEMLIMIT Source */ End /* If bitand(CVTOSLV3,'10'x) */ /* Memlimit Source Table */ MEMSRC.0 = ' ' MEMSRC.1 = 'SMF' MEMSRC.2 = 'JCL' MEMSRC.3 = 'REGION=0' MEMSRC.4 = 'IEFUSI' MEMSRC.5 = 'OMVS SEGMENT' MEMSRC.6 = 'UNIX SETRLIMIT' MEMSRC.7 = 'UNIX SPAWN' MEMSRC.8 = 'SETOMVS CMD' MEMSRC.9 = 'AUTH PROGRAM' MEMSRC.10 = 'IEFUSI + REGION=0' /*********************************************************************/ /* Display results */ /*********************************************************************/ Say '' Say 'V I R T U A L S T O R A G E U S A G E' Say '-------------------------------------------' Say ' ' Say ' Region requested:' LDAREGRQ'K' Say ' ' Say ' Limit In-Use Avail' Say 'Below 16M:' LDALIMIT'K' LDALOAL'K' AVAIL'K' Say 'Above 16M:' LDAELIM'K' LDAELOAL'K' EAVAIL'K' If Show_MEMLIMIT_Display = 1 then do /* FLAG set to "true"? */ Say 'Above 2G :' Right(MEMLIM,10) , ' (64-bit MEMLIMIT)' Say 'MEMLIMIT Source:' MEMSRC.RAXLVMEMLIMS End Exit 0 FORMAT_MEMSIZE: /****************************************************************/ /* The following code is used to display the storage size in */ /* the largest possible unit. For example, 1023G and 1025G are */ /* displayed as 1023G and 1025G, but 1024G is displayed as 1T. */ /* The size passed to the routine must be in MB. */ /****************************************************************/ Arg SIZE_IN_MB Select When SIZE_IN_MB < 1024 then do MUNITS = 'M' End When SIZE_IN_MB >= 1024 & SIZE_IN_MB < 1048576 then do If SIZE_IN_MB/1024 == TRUNC(SIZE_IN_MB/1024) then do SIZE_IN_MB = SIZE_IN_MB/1024 MUNITS = 'G' End Else MUNITS = 'M' End When SIZE_IN_MB >= 1048576 & SIZE_IN_MB < 1073741824 then do If SIZE_IN_MB/1048576 == TRUNC(SIZE_IN_MB/1048576) then do SIZE_IN_MB = SIZE_IN_MB/1048576 MUNITS = 'T' End Else do SIZE_IN_MB = SIZE_IN_MB/1024 MUNITS = 'G' End End When SIZE_IN_MB >= 1073741824 & , SIZE_IN_MB <= 17591112302592 then do If SIZE_IN_MB/1073741824 == TRUNC(SIZE_IN_MB/1073741824) , then do SIZE_IN_MB = SIZE_IN_MB/1073741824 MUNITS = 'P' End Else do SIZE_IN_MB = SIZE_IN_MB/1048576 MUNITS = 'T' End End When SIZE_IN_MB = 17592186040320 then do SIZE_IN_MB = 'NOLIMIT' /* 16384P */ MUNITS = '' End Otherwise say 'Error in MEMLIMIT SIZE code. Contact Mark Zelden.' End /* select */ STOR_SIZE = SIZE_IN_MB || MUNITS Return STOR_SIZE