Tim,

You can use IFTHEN statements to initially squeeze just the IP address and 
then once again squeeze the entire data. I optimized your code a little 
bit.  INREC acts before SORT statement , so it is advisable to have only 
the fields you need so that you can reduce the resources required to SORT. 
You can do the editing on OUTREC phase to display the data in readable 
format.

I removed your SUM statement and added the counts on OUTFIL as the data is 
already sorted.  I also converted the output file to RECFM=FB with an 
lrecl of 50.

Here is a JCL that you can use to get the desired results

//SYSIN    DD * 
  OPTION VLSHRT,VLSCMP 
  INCLUDE COND=(06,1,BI,EQ,118,AND,          $ TYPE 118   
                23,2,BI,EQ,3)                $ SUBTYPE 3   
 
  INREC BUILD=(001,4,                        $ RDW 
               037,1,                        $ IP NODE1 IN BINARY 
               038,1,                        $ IP NODE2 IN BINARY 
               039,1,                        $ IP NODE3 IN BINARY 
               040,1,                        $ IP NODE4 IN BINARY 
               189,8,                        $ LOCAL ID 
               025,4,                        $ COMMAND 
               049,8)                        $ REMOTE ID 
 
  SORT FIELDS=(05,1,BI,A,                    $ IP NODE1 
               06,1,BI,A,                    $ IP NODE2 
               07,1,BI,A,                    $ IP NODE3 
               08,1,BI,A,                    $ IP NODE4 
               09,8,CH,A,                    $ LOCAL ID 
               17,4,CH,A,                    $ COMMAND 
               21,8,CH,A)                    $ REMOTE ID 
 
  OUTREC IFTHEN=(WHEN=INIT, 
          BUILD=(01,04,                      $ RDW 
                 05,1,BI,M10,LENGTH=4,       $ IP NODE1 TO DISPLAY 
                 06,1,BI,M10,LENGTH=4,       $ IP NODE2 TO DISPLAY 
                 07,1,BI,M10,LENGTH=4,       $ IP NODE3 TO DISPLAY 
                 08,1,BI,M10,LENGTH=4,       $ IP NODE4 TO DISPLAY 
                 C',',                       $ COMMA 
                 09,08,                      $ LOCAL ID 
                 C',',                       $ COMMA 
                 17,04,                      $ COMMAND 
                 C',',                       $ COMMA 
                 21,08,                      $ REMOTE ID 
                 C',')),                     $ COMMA 
 

         IFTHEN=(WHEN=INIT, 
          BUILD=(01,04,                                      $ RDW 
                 05,16,SQZ=(SHIFT=LEFT,MID=C'.',LENGTH=20),  $ IP SQZ 
                 25,24)),                                    $ DATA 
 
         IFTHEN=(WHEN=INIT, 
          OVERLAY=(5:5,44,SQZ=(SHIFT=LEFT)))  $ SQUEEZE ALL DATA 
 
  OUTFIL REMOVECC,NODETAIL,VTOF,BUILD=(50X), 
         HEADER2=(C'IP,LOCAL ID,COMMAND,REMOTE ID,COUNT'), 
  SECTIONS=(5,44, 
  TRAILER3=(5,44,COUNT=(M10,LENGTH=6))) 
//* 

Further if you have any questions please let me know

Thanks,
Sri Hari Kolusu
DFSORT Development
IBM Corporation
Email: [email protected]
Phone: 520-799-2237 Tie Line: 321-2237



From:   Tim Hare <[email protected]>
To:     [email protected]
Date:   08/01/2016 06:54 AM
Subject:        DFSORT SQZ question
Sent by:        IBM Mainframe Discussion List <[email protected]>



I've created an FTP client report in comma-delimited format from SMF 118s 
(yes, I know they should be capturing 119s but they aren't yet, and this 
isn't about that).

To make the IP address readable, I used an edit on each byte of the 
address and the SQZ function to put them back together.  However, to do 
this I had to do the edit on an INREC statement, and then treat the four 
edited fields as one on an OUTFIL statement. Here are the control 
statements,  sorry for the length but it's more readable this way:

===============================================
OPTION VLSHRT,VLSCMP 
INCLUDE COND=(6,1,BI,EQ,118, 
          AND,23,2,BI,EQ,3) 
INREC FIELDS=(1,24, 
              37,1,BI,M10,LENGTH=4, 
              38,1,BI,M10,LENGTH=4, 
              39,1,BI,M10,LENGTH=4, 
              40,1,BI,M10,LENGTH=4, 
              189,8, 
              25,4, 
              49,8, 
              X'00000001') 
 
SORT FIELDS=(25,16,CH,A,41,8,CH,A,49,4,CH,A,53,8,CH,A)
SUM FIELDS=(61,4,BI) 
OUTFIL FNAMES=REPORT,
       REMOVECC, 
       HEADER1=(C'IP,Local ID,Command,Remote ID,Count'),
       BUILD=(1,4, 
              25,16,SQZ=(SHIFT=LEFT,MID=C'.'), 
              C',', 
              41,8, 
              C',', 
              49,4, 
              C',', 
              53,8, 
              C',', 
              61,4,BI,M10,LENGTH=6) 
=====================================================

Given that this could have as input millions of records depending upon how 
long you want to summarize,  I'd like to be able to use the 4-byte IP 
address in the sort, and _then_  make it readable.  Is there a way for SQZ 
to work on a group of fields?  I'm envisioning something like this where 
the grouping of fields in parenthesis before the SQZ function means sort 
does those actions, then applies SQZ to the entire result... 

===============================================
OPTION VLSHRT,VLSCMP 
INCLUDE COND=(6,1,BI,EQ,118, 
          AND,23,2,BI,EQ,3) 
INREC FIELDS=(1,24, 
              37,4, 
              189,8, 
              25,4, 
              49,8, 
              X'00000001') 
 
SORT FIELDS=(25,4,CH,A,29,8,CH,A,37,4,CH,A,41,8,CH,A)
SUM FIELDS=(49,4,BI) 
OUTFIL FNAMES=REPORT,
       REMOVECC, 
       HEADER1=(C'IP,Local ID,Command,Remote ID,Count'),
       BUILD=(1,4, 
 
(25,1,BI,M10,LENGTH=4,26,1,BI,M10,LENGTH=4,27,1,BI,M10,LENGTH=4,28,1,BI,M10,LENGTH=4),SQZ=(SHIFT=LEFT,MID=C'.'),
 
 
              C',', 
              29,8, 
              C',', 
              37,4, 
              C',', 
              41,8, 
              C',', 
              49,4,BI,M10,LENGTH=6) 
===================================================== 

Seems like it would be a performance improvement for this use case 
anyway... 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN






----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to