i'm quite new to programming with REXX. I'd like to write a program that will show a task from DA with the biggest CPU usage on the LPAR. Thanks in advance
000001 /* rexx */
000002 RC=ISFCALLS('ON')
000003 isfcols = "JNAME CPUPR JTYPE"
000004 /*Access the DA panel */
000005 ADDRESS SDSF "ISFEXEC DA"
000006 IF RC<>0 THEN
000007 EXIT RC
000008 /* GET FIXED FIELD NAME FROM FIRST WORD */
000009 /*OF ISFCOLS SPECIAL VARIABLE */
000010 fixedField = word(isfcols,1)
000011 Say "Number of rows returned:" isfrows
000012 /* Process all rows */
000013 do ix=1 to isfrows
000014 Say "Now processing job:" value(fixedField"."ix)
000015 /* List all columns for row */
000016 do jx=1 to words(isfcols)
000017 col = word(isfcols,jx)
000018 say " Column" col"."ix "has the value:" value(col"."ix)
000019 end
000020 end
000021 rc=isfcalls('OFF')
I'm not sure if I started correctly, I'm reviewing Redbook to find some answers, but it's a little bit rough. Could someone advice me on that? I managed to specify colums which I would like to see, but still can't get to the point where it will return me only the task with highest CPU. I assume that I have to specify sth on line 13 just to search highest number
There are a number of special variables which are used to custpmize what, and how you want SDSF to return data. You're already using ISFCOLS
to specify which colums you need.
To get the row for the ASID (*) using the most CPU in this snapshot as the first row, tell SDSF to sort the data returned by descending CPU% value. Add the following line anywhere before calling SDSF:
isfsort="CPUPR D"
See Using special variables to invoke SDSF function, and specifically table Special variables reference in the SDSF manual for a list of all special variables.
(*) A note on terminology: SDSF lists data for Address Spaces (ASID), not tasks. There are a number of tasks running in each address space. With SDSF, you get the total usage per Address Space.