Page 1 of 2

Need to format my REXX output

PostPosted: Wed Oct 14, 2020 7:56 pm
by abhsha27
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

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 8:28 pm
by abhsha27
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")

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 8:32 pm
by abhsha27
My output is in one line and not formatted properly

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 8:39 pm
by Garry F Carroll
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.

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 8:50 pm
by abhsha27

 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

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 9:07 pm
by Garry F Carroll
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.

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 10:18 pm
by abhsha27
What is a newline Character?

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 11:21 pm
by prino
abhsha27 wrote:What is a newline Character?

Ever thought about opening a manual?

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 11:23 pm
by abhsha27
could not find it, could you please tell me a manual, code did not come without opening it right?

Re: Need to format my REXX output

PostPosted: Wed Oct 14, 2020 11:55 pm
by abhsha27
abhsha27 wrote:What is a newline Character?


I understood , Thank you!!