troubleshooting Question

Values of Data for REXX

Avatar of JCW2
JCW2 asked on
Mainframe LanguagesProgramming Languages-OtherProgramming
11 Comments1 Solution1594 ViewsLast Modified:
Note: I'm taking a class.

What are your hints as to how I can get the values for the amounts of data displayed?
T21JOB1

//T21JOB1      JOB  1,NOTIFY=&SYSUID                   
//**************************************************   
//* JCL TO COMPILE REXX  SOURCE CODE AND LINK MODULE   
//**************************************************   
//PROCLIB      JCLLIB ORDER=ZOS.PUBLIC.JCL             
//S1           EXEC REXXCL                             
//REXX.SYSIN   DD   DSN=&SYSUID..SOURCE(NETIO),DISP=SHR
//LKED.SYSLMOD DD   DSN=&SYSUID..LOAD(NETIO),DISP=SHR  


T21JOB2

//T21JOB2  JOB 1,NOTIFY=&SYSUID                                         
//**************************************                                
//STEP1    EXEC PGM=IKJEFT01                                            
//SYSTSPRT DD DSN=&&NETBYTE1,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//SYSTSIN  DD DSN=&SYSUID..PART3.DATA(NETBYTE),DISP=SHR                 
//**************************************                                
//STEP2    EXEC PGM=WAITABIT,PARM='15'                                  
//**************************************                                
//STEP3    EXEC PGM=IKJEFT01                                            
//SYSTSPRT DD DSN=&&NETBYTE2,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//SYSTSIN  DD DSN=&SYSUID..PART3.DATA(NETBYTE),DISP=SHR                 
//**************************************                                
//STEP4    EXEC PGM=SORT                                                
//SYSOUT   DD SYSOUT=*                                                  
//SYSIN    DD DSN=&SYSUID..PART3.DATA(T21CTL1),DISP=SHR                 
//SORTIN   DD DSN=&&NETBYTE1,DISP=(MOD,DELETE)                          
//         DD DSN=&&NETBYTE2,DISP=(MOD,DELETE)                          
//SORTOUT  DD SYSOUT=*                                                  
//SORTOUT  DD DSN=&&NETBYTE3,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//*************************************                                 
//STEP5    EXEC PGM=NETIO                                               
//STEPLIB  DD DSN=&SYSUID..LOAD,DISP=SHR                                
//NETRPT   DD SYSOUT=*                                                  
//NETBYTE  DD DSN=&&NETBYTE3,DISP=(MOD,DELETE)                          


T21JOB3

//T21JOB3  JOB 1,NOTIFY=&SYSUID                                         
//*********************************************                         
//STEP1    EXEC PGM=IKJEFT01                                            
//SYSTSPRT DD DSN=&&NETBYTE1,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//SYSTSIN  DD DSN=&SYSUID..PART3.DATA(NETBYTE),DISP=SHR                 
//*********************************************                         
//STEP2    EXEC PGM=WAITABIT,PARM='15'                                  
//*********************************************                         
//STEP3    EXEC PGM=IKJEFT01                                            
//SYSTSPRT DD DSN=&&NETBYTE2,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//SYSTSIN  DD DSN=&SYSUID..PART3.DATA(NETBYTE),DISP=SHR                 
//*********************************************                         
//STEP4    EXEC PGM=SORT                                                
//SYSOUT   DD SYSOUT=*                                                  
//SYSIN    DD DSN=&SYSUID..PART3.DATA(T21CTL1),DISP=SHR                 
//SORTIN   DD DSN=&&NETBYTE1,DISP=(MOD,DELETE)                          
//         DD DSN=&&NETBYTE2,DISP=(MOD,DELETE)                          
//*SORTOUT  DD SYSOUT=*                                                 
//SORTOUT  DD DSN=&&NETBYTE3,DISP=(,PASS),                              
//            SPACE=(CYL,(1,1)),UNIT=SYSDA,                             
//            DCB=(LRECL=80,RECFM=FB)                                   
//*********************************************                         
//STEP5    EXEC PGM=NETIO                                               
//STEPLIB  DD DSN=&SYSUID..LOAD,DISP=SHR                                
//NETRPT   DD SYSOUT=*                                                  
//NETBYTE  DD DSN=&&NETBYTE3,DISP=(MOD,DELETE)


T021 (Task)

---------------------------------------------------
TASK021 TSO program, SORT and REXX
---------------------------------------------------

--------------------------------------------------------
Information to help complete this task is in member I021
--------------------------------------------------------

Example output format from t21job3:
------------------------------------------
During the past xxxx seconds
 32.97.110.57..34570
    received data from TN3270   on port 00623
    sent     data  to  TN3270   on port 00623
------------------------------------------
During the past xxxx seconds
 32.97.110.57..55650
    sent     data  to  TN3270   on port 00623

Modify NETIO REXX routine to alter output format from t21job3
replacing xxxx with difference in seconds using time values
between 'TIME-' records and replace data with differences in
byte_in and/or byte_out counts

Example:

------------------------------------------
During the past 15 seconds
 32.97.110.57..34570
    received 2159 from TN3270   on port 00623
    sent      213  to  TN3270   on port 00623
------------------------------------------
During the past 15 seconds
 32.97.110.57..55650
    sent     542   to  TN3270   on port 00623


***************************************************************
Learning how to modify REXX source code is not difficult.
The following is recommend to help you learn what you need
to know to complete this challenge.

  Internet search words - REXX examples

REXX detailed description of instructions
  z/OS TSO/E:
  REXX Reference
    Manual# SA22-7790-07
     Useful Sections
      Chapter 3. Keyword instructions
      Chapter 5. Parsing
      Chapter 6. Numbers and arithmetic

REXX examples with detailed explanation
  z/OS TSO/E:
  REXX Users Guide
    Manual# SA22-7791-01
     Useful Sections
      Chapter 3. Using Variables and Expressions
      Chapter 7. Manipulating Data

*NOTE: Original copy of NETIO REXX source is located in
       ZOS.PUBLIC.SOURCE(NETIO) in case you need it.


I021

---------------------------------------
Technical assistance for TASK021 (T021)
---------------------------------------

TSO program, SORT and REXX

Review REXX source ibm####.source(netio)

*****************************************************************
* The purpose is for you to see what REXX syntax looks like.    *
*   Remember this example of REXX code exists.  It could prove  *
*   useful to complete the final tasks of part 3.               *
*                                                               *
* REXX is heavily used by z/OS and z/VM system programmers and  *
*   administrators.  It can be used by developers to create     *
*   applications.  However, z/OS and z/VM developers are        *
*   frequently unfamiliar with the syntax.                      *
*****************************************************************

   The rexx source (netio) is written to report on foreign sockets
   that had either the byte_in (b_in) or byte_out (b_out) increment
   from the first netstat command to the second netstat command.

submit jcl(t21job1)

  t21job1 compiles ibm####.source(netio) and creates load module
  ibm####.load(netio)

submit jcl(t21job2)

  t21job2 JCL job does the following:
     STEP1  - execute TSO logon program IKJEFT01 and process
              tso commands 'time' and 'netstat byte'

     STEP2  - execute program WAITABIT passing parm to wait 15 seconds

     STEP3  - execute TSO logon program IKJEFT01 and process
              tso commands 'time' and 'netstat byte' (again)

     STEP4  - execute sort to sort the output from Steps 1 and 3.
                SORTOUT ddname is the sorted output.
                Sort column starting in 41 for length of 20
                  41 has foreign socket value from netstat byte output

   Several new JCL techniques are used t21job2 JCL job
     STEP1  - SYSTSPRT DD creates a temporary data set name
              (&&NETBYTE1) and the disposition is to PASS this
              data to subsequent execution steps.

              *NOTE=&& in front of a data set name means it is
                    temporary and it will not be stored on disk
                    upon job completion.

     STEP3  - SYSTSPRT DD creates a temporary data set name
              (&&NETBYTE2) and the disposition is to PASS this
              data to subsequent execution.

     STEP4  - SORTIN DD reads the 2 temporary data set names
              (&&NETBYTE1 and &&NETBYTE2) pass to it from
              Step 1 and 2.  These 2 temporary data set names
              are part of a DD concatenation.  Therefore, the
              data is treated like a single data set name by the
              program reading the data.

    SORTOUT is written to JES spool so that you can look at the
    job output.

    The following is in the SORTOUT output
      1) 2 records begin with 'TIME-' are at the bottom.
      2) netstat byte output with non-zero byte-in or byte-out count
         is just before the 'TIME-' records as a result of the sort.

submit jcl(t21job3)

  t21job3 JCL job does everything t21job2 does with the exception of
     STEP4  - SORTOUT is written to a temporary data set (&&netbyte3).

     STEP5  - Executes NETIO rexx routine compiled by t21job1 and
              the rexx routine writes report to NETRPT ddname

Example of the netio rexx routine output format follows:
--------------------------------------------------------
During the past xxxx seconds
 32.97.110.57..34570
    received data from TN3270   on port 00623
    sent     data  to  TN3270   on port 00623
------------------------------------------
During the past xxxx seconds
 32.97.110.57..55650
    sent     data  to  TN3270   on port 00623

If you did not get any output, then produce some
TSO session activity (such as entering TSO LISTC)
immediately after submitting t21job2 or t21job3
at least your session will increment byte_in
and byte_out counts for your socket.


NETIO

/* REXX */                
"EXECIO * DISKR NETBYTE (STEM row. FINIS)"
"EXECIO 0 DISKW NETRPT  (OPEN)" 
do i=1 to row.0 
 rec = row.i 
  if datatype(substr(rec,33,5)) = NUM 
   then call is_byte_count_non_zero  
   else nop 
end 
EXIT 0 
is_byte_count_non_zero:  
 app_name = substr(rec,1,8) 
 b_out    = substr(rec,10,10) 
 b_in     = substr(rec,21,10)
 l_port   = substr(rec,32,5)
 f_socket = substr(rec,40,22)
  if b_out || b_in = '00000000000000000000'
   then return
   else call active_socket
return
active_socket:
 if f_socket_1 = f_socket
  then call is_data_moving_on_this_socket
  else call must_be_first_socket_entry
return
is_data_moving_on_this_socket:
  if compare(b_out_1,b_out) = 0
   then b_out_diff = 0 
   else b_out_diff = 1 
  if compare(b_in_1,b_in) = 0 
   then b_in_diff = 0  
   else b_in_diff = 1 
  select;
   when b_out_diff || b_in_diff = '00' then call no_data_movement
   when b_out_diff || b_in_diff = '01' then call in_data_only
   when b_out_diff || b_in_diff = '10' then call out_data_only
   when b_out_diff || b_in_diff = '11' then call in_out_data
   otherwise
  end
return 
must_be_first_socket_entry: 
 app_name_1 = app_name 
 b_out_1    = b_out
 b_in_1     = b_in
 l_port_1   = l_port
 f_socket_1 = f_socket 
return
no_data_movement:         
 app_name_1 = ' '         
 b_out_1    = ' '         
 b_in_1     = ' '         
 l_port_1   = ' '         
 f_socket_1 = ' '         
return                    
in_data_only:             
outrec.1 = '------------------------------------------'                 
outrec.2 = 'During the past 15 seconds'          
outrec.3 = ' 'f_socket    
outrec.4 = '    sent data to   'app_name' on port 'l_port            
"EXECIO 4 DISKW NETRPT (stem outrec.)"           
 app_name_1 = ' '         
 b_out_1    = ' '         
 b_in_1     = ' '         
 l_port_1   = ' '         
 f_socket_1 = ' '         
return                    
out_data_only:            
outrec.1 = '------------------------------------------'                 
outrec.2 = 'During the past 15 seconds'          
outrec.3 = ' 'f_socket    
outrec.4 = '    received data from 'app_name' on port 'l_port           
"EXECIO 4 DISKW NETRPT (stem outrec.)"           
 app_name_1 = ' '         
 b_out_1    = ' '         
 b_in_1     = ' '         
 l_port_1   = ' '         
 f_socket_1 = ' '         
return                    
in_out_data:              
outrec.1 = '------------------------------------------'                 
outrec.2 = 'During the past 15 seconds'          
outrec.3 = ' 'f_socket    
outrec.4 = '    received data from 'app_name' on port 'l_port         
outrec.5 = '    sent     data  to  'app_name' on port 'l_port         
"EXECIO 5 DISKW NETRPT (stem outrec.)"           
 app_name_1 = ' '         
 b_out_1    = ' '         
 b_in_1     = ' '         
 l_port_1   = ' '         
 f_socket_1 = ' '         
return
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros