Need to format my REXX output



IBM's Command List programming language & Restructured Extended Executor

Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 7:56 pm

Hi,

I have written a code to get CPU utilization for active tasks. My output is not formatted as I want. Need some help.


the screen shots were deleted ( useless waste of disk space )

furthermore, posting attachments is strongly discouraged, not everybody is allowed to look at them

use a plain text cut and paste as everybody does
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 8:28 pm

isfprefix = "*"                                                        
 isfowner = "*"                                                        
 isfcols = "jobname cpupr"                                              
 isfsort = "cpupr d"                                                    
      /* Access the DA panel */                                        
 Address SDSF "ISFEXEC DA"                                              
 if rc<>0 then                                                          
   say 'Ended bad' :rc                                                          
   colonne = words(isfcols)                                            
 resp = ''                                                              
 numrows = isfrows                                                      
 do rows = 1 to numrows                                                
  do colonna = 1 to colonne                                            
  nome_colonna = word(isfcols, colonna)                                
  contenuto = value(nome_colonna"."rows)                                
    if (nome_colonna = 'TOKEN') then iterate                            
   resp = resp ||' ' || ' ' || contenuto                              
   end                                                                  
  end                                                                  
  say resp                                                              
  rc_isf = isfcalls("OFF")
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 8:32 pm

My output is in one line and not formatted properly
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby Garry F Carroll » Wed Oct 14, 2020 8:39 pm

You should use code tags when pasting (see buttons at top of entry panel). This preserves the formatting of what you are pasting.

You say that the output is not formatted the way you want. What do you expect the output to look like?

Garry.
Garry F Carroll
 
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 8:50 pm


 isfprefix = "*"                                                        
 isfowner = "*"                                                        
 isfcols = "jobname cpupr"                                              
 isfsort = "cpupr d"                                                    
      /* Access the DA panel */                                        
 Address SDSF "ISFEXEC DA"                                              
 if rc<>0 then                                                          
   say 'Ended bad' :rc                                                          
   colonne = words(isfcols)                                            
 resp = ''                                                              
 numrows = isfrows                                                      
 do rows = 1 to numrows                                                
  do colonna = 1 to colonne                                            
  nome_colonna = word(isfcols, colonna)                                
  contenuto = value(nome_colonna"."rows)                                
    if (nome_colonna = 'TOKEN') then iterate                            
   resp = resp ||' ' || ' ' || contenuto                              
   end                                                                  
  end                                                                  
  say resp                                                              
  rc_isf = isfcalls("OFF")
 




I hope I understood you correctly.


By formatting I mean my output is in one line I want columns "Jobname" and "CPU%" to b displayed as they are displayed in SDSF
right now it looks like

MII  1.00  ASCH  0.00  DFHSM  0.00  RESOLVER  0.00  TCPIP  0.00  TPX  0.00  T
SO  0.00  CCITCPGW  0.00  CTSGATE  0.00  BPXOINIT  0.00  FTPD1  0.00  VAARTN  0
.00  CALDAP  0.00  VAM  0.00  JES2AUX  0.00  JES2MON  0.00  SYSVUSER  0.00  RMF
 

I want it to look like

MII             1.00  
 ASCH          0.00
 DFHSM        0.00
 RESOLVER    0.00  
 TCPIP          0.00
 TPX             0.00  
 TSO             0.00
 CCITCPGW   0.00
 CTSGATE     0.00
 BPXOINIT    0.00
 FTPD1        0.00
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby Garry F Carroll » Wed Oct 14, 2020 9:07 pm

Rather than build all the rows into a single line output, why not "say" each row? An alternative might be to insert a newline character into "resp" after each row processed.

Garry.

These users thanked the author Garry F Carroll for the post:
abhsha27 (Wed Oct 14, 2020 11:56 pm)
Garry F Carroll
 
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 10:18 pm

What is a newline Character?
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby prino » Wed Oct 14, 2020 11:21 pm

abhsha27 wrote:What is a newline Character?

Ever thought about opening a manual?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 614
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 27 times

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 11:23 pm

could not find it, could you please tell me a manual, code did not come without opening it right?
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Need to format my REXX output

Postby abhsha27 » Wed Oct 14, 2020 11:55 pm

abhsha27 wrote:What is a newline Character?


I understood , Thank you!!
abhsha27
 
Posts: 12
Joined: Wed Oct 14, 2020 7:51 pm
Has thanked: 1 time
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post