MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Omit some detail records but keep their count in report.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 1:05 am    Post subject: Omit some detail records but keep their count in report. Reply with quote

Hi,
Consider the following input data in a FB 80 dataset.
Code:

----+----1----+
70601YYYY1235I
70601XXXX1111I
70601XXXX1111U
70601XXXX1111U
70601XXXX1111D
89601XXXX1112I
89601XXXX1112I
89601XXXX1112D


1 - 3 : Main code
4 - 5 : Sub code
6 - 13: Customer number
14 - 14 : Flag (I = Inserted, D = Deleted, U = Updated)

I created a report as follows:
Code:

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
                MAIN CODE = 706          SUB CODE = 01               
                                                                               
-------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 01:48:42                                         
-------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                               
                     CUSTOMER NUM                                             
                     XXXX1111                                                 
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                             
                     YYYY1235                                                 
                     XXXX1111                                                 
                                                                               
DETAILS:UPDATED                                                               
                     CUSTOMER NUM                                             
                     XXXX1111                                                 
                     XXXX1111                                                 
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        2       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 01               
                                                                               
-------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 01:48:42                                         
-------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                               
                     CUSTOMER NUM                                             
                     XXXX1112                                                 
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                             
                     XXXX1112                                                 
                     XXXX1112                                                 
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        0       


(The ouput has been shifted by 1 byte to right as it is in spool right. It must begin from column 1.)

Now, the requirement is to omit all records and headers for updated records and, yet, display the numbers in the trailer. That is, the report must be,

Code:

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
                MAIN CODE = 706          SUB CODE = 01               
                                                                               
-------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 01:48:42                                         
-------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                               
                     CUSTOMER NUM                                             
                     XXXX1111                                                 
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                             
                     YYYY1235                                                 
                     XXXX1111                                                 
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        2       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 01               
                                                                               
-------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 01:48:42                                         
-------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                               
                     CUSTOMER NUM                                             
                     XXXX1112                                                 
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                             
                     XXXX1112                                                 
                     XXXX1112                                                 
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        0       


If there are only updated records for a given main code/sub code, then they should not come in output under a header. But, their count must come in the trailer.

As of now, I cannot think of an approach but to create the above report with some kind of indicator for every record. Then, use OMIT to omit the relevant records.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 1:06 am    Post subject: Reply with quote

Evil or Very Mad
Why is the indentation messed up???
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Wed Jun 09, 2004 5:27 am    Post subject: Reply with quote

Cogito,

The indentation looks ok for me in the first post. May be it is your screen resolution that puts indentation out of whack.

My screen resolution is : 1024 by 768

If you are using 800 by 600 resolution then some of the posts might appear weird.

I briefly looked into your question , I think you can use a change command to space out the customer number for the update records and change the flag to I. Also put the update flag somewhere at the end. Now for the update counts use that field.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 6:40 am    Post subject: Reply with quote

Kolusu,

I changed the settings and then it looks ok. But, the fonts/icons on my computer become painfully small; atleast for me! So, I will change the settings only when I really feel like. Thank you for this tip.

I do not think, I can change the flag to I. This is because, my report must break twice. Lower level on the value of flag and the higher level at main-code, sub-code combination. So, if the data is to break at flag value I, then the spaced out customer numbers will also come under the section. This should not happen.

(Or, maybe, while writing out the record you want me to include only non-blank customer records?)

Quote:

Also put the update flag somewhere at the end. Now for the update counts use that field.

I am not sure, I get your idea.

I had an idea to get the number of Update records by using SORT FIELDS and SUM FIELDS for X'F0F0F0F0F0F0F0F1' padded to the end of the each record (using INREC). I was thinking of splicing this output with the first record under a given main-code, sub-code combination. The problem with this approach is, I will not have a record to splice onto if there are ONLY Update records.

The link is not good right now. I will post the job that I am using currently for the earlier requirement.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 8:41 am    Post subject: Reply with quote

This job,
Code:

//STEP     EXEC PGM=ICETOOL                         
//TOOLIN   DD *                                     
 COPY FROM(IN01)          USING(CPY1)               
 SORT FROM(CON)  TO(T4)   USING(SRT1)               
 SORT FROM(CON)  TO(OT01) USING(SRT2)               
/*                                                   
//IN01     DD DSN=i/p dataset,DISP=SHR
//T1       DD DSN=&TEMP0001,                         
//            DISP=(,PASS)                           
//T2       DD DSN=&TEMP0002,                         
//            DISP=(,PASS)                           
//T3       DD DSN=&TEMP0003,                         
//            DISP=(,PASS)                           
//CON      DD DSN=&TEMP0001,                         
//            DISP=(SHR,PASS),                       
//            VOL=REF=*.T1                           
//         DD DSN=&TEMP0002,                         
//            DISP=(SHR,PASS),                       
//            VOL=REF=*.T2                           
//         DD DSN=&TEMP0003,                         
//            DISP=(SHR,PASS),                       
//            VOL=REF=*.T3                                 
//T4       DD DSN=&TEMP0004,                               
//            DISP=(,PASS)                                 
//OT01     DD SYSOUT=*                                     
//CPY1CNTL DD *                                             
 OUTFIL FNAMES=T1,                                         
        INCLUDE=(14,1,CH,EQ,C'D'),                         
        OUTREC=(1,80,7X'F0',X'F1',8X'F0',8X'F0',C'DELETED ')
 OUTFIL FNAMES=T2,                                         
        INCLUDE=(14,1,CH,EQ,C'I'),                         
        OUTREC=(1,80,8X'F0',7X'F0',X'F1',8X'F0',C'INSERTED')
 OUTFIL FNAMES=T3,                                         
        INCLUDE=(14,1,CH,EQ,C'U'),                         
        OUTREC=(1,80,8X'F0',8X'F0',7X'F0',X'F1',C'UPDATED ')
/*                                                         
//SRT1CNTL DD *                                             
 SORT   FIELDS=(1,5,CH,A)                                   
 SUM    FIELDS=NONE                                         
 OUTREC FIELDS=(C'  X,C',X'7D',1,3,C'/',4,2,X'7D',C',',80:X)
/*                                                         
//SRT2CNTL DD *                                                     
 SORT   FIELDS=(1,5,CH,A,14,1,CH,A)                                 
 OUTFIL FNAMES=OT01,                                               
        HEADER1=(80C'-',1/,                                         
           C'               MAIN HEADER',80:X,/),                   
        SECTIONS=(1,5,                                             
             HEADER3=(16X,C'MAIN CODE = ',1,3,10X,                 
                          C'SUB CODE = ',4,2,80:X,1/,80X,1/,       
                           80C'-',1/,                               
                           C'START DATE : ',DATE=(4MD-),C' TIME: ',
                            TIME,80:X,/,80C'-',/,80X),             
             TRAILER3=(2/,C'COUNT OF RECORDS ',                     
                       C'INSERTED IN THE TABLE        =          ',
                                    TOTAL=(81,8,ZD),80:X,1/,       
                       C'COUNT OF RECORDS ',                       
                       C'DELETED IN THE TABLE         =          ',
                                    TOTAL=(89,8,ZD),80:X,1/,       
                       C'COUNT OF RECORDS ',                       
                       C'UPDATED IN THE TABLE         =          ',
                                     TOTAL=(97,8,ZD),80:X,/,80X,/, 
                                                   80X,/,80X),     
                14,1,                                     
                 HEADER3=(1/,C'DETAILS:',105,8,80:X,/,21X,
                          C'CUSTOMER NUM')),             
       OUTREC=(21X,6,8,80:X)                             
/*                                                       
//DFSMSG   DD SYSOUT=*                                   
//TOOLMSG  DD SYSOUT=*                                   


for this input,
Code:

----+----1----+
70601XXXX1235I
70601XXXX1111I
70601XXXX1112U
70601XXXX1113U
70601XXXX1114D
89600XXXX1115U
89600XXXX1116U
89600XXXX1117U
89601XXXX1118I
89601XXXX1119I
89601ZZZZ1122D


gives this o/p

Code:

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
--------------------------------------------------------------------------------
               MAIN HEADER                                                     
                                                                               
                MAIN CODE = 706          SUB CODE = 01                         
                                                                               
--------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 09:29:04                                         
--------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                                 
                     CUSTOMER NUM                                               
                     XXXX1114                                                   
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                               
                     XXXX1235                                                   
                     XXXX1111                                                   
                                                                               
DETAILS:UPDATED                                                                 
                     CUSTOMER NUM                                               
                     XXXX1112                                                   
                     XXXX1113                                                   
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        2       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 00                         
                                                                               
--------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 09:29:04                                         
--------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:UPDATED                                                                 
                     CUSTOMER NUM                                               
                     XXXX1115                                                   
                     XXXX1116                                                   
                     XXXX1117                                                   
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        0       
COUNT OF RECORDS DELETED IN THE TABLE         =                        0       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        3       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 01                         
                                                                               
--------------------------------------------------------------------------------
START DATE : 2004-06-09 TIME: 09:29:04                                         
--------------------------------------------------------------------------------
                                                                               
                                                                               
DETAILS:DELETED                                                                 
                     CUSTOMER NUM                                               
                     ZZZZ1122                                                   
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                               
                     XXXX1118                                                   
                     XXXX1119                                                   
                                                                               
COUNT OF RECORDS INSERTED IN THE TABLE        =                        1       
COUNT OF RECORDS DELETED IN THE TABLE         =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        0       
                                                                               
                                                                               
                                                                               

_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 1:47 pm    Post subject: Reply with quote

In my previous post about, the TRAILER3 should look like this:

Code:

TRAILER3=(2/,C'COUNT OF RECORDS ',                   
          C'DELETED  IN THE TABLE        =          ',
                       TOTAL=(81,8,ZD),80:X,1/,       
          C'COUNT OF RECORDS ',                       
          C'INSERTED IN THE TABLE        =          ',
                       TOTAL=(89,8,ZD),80:X,1/,       
          C'COUNT OF RECORDS ',                       
          C'UPDATED IN THE TABLE         =          ',
                        TOTAL=(97,8,ZD),80:X,/,80X,/,
                                      80X,/,80X),     

_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jun 09, 2004 1:53 pm    Post subject: Reply with quote

I went with the approach of which I was not keen about.

Code:

//STEP     EXEC PGM=ICETOOL                         
//TOOLIN   DD *                                     
 COPY FROM(IN01)          USING(CPY1)               
 SORT FROM(CON)  TO(T4)   USING(SRT1)               
 SORT FROM(CON)  TO(T5)   USING(SRT2)               
 COPY FROM(T5)   TO(OT01) USING(CPY2)               
/*                                                 
//IN01     DD DSN=i/p file,DISP=SHR
//T1       DD DSN=&TEMP0001,                       
//            DISP=(,PASS)                         
//T2       DD DSN=&TEMP0002,                       
//            DISP=(,PASS)                         
//T3       DD DSN=&TEMP0003,                       
//            DISP=(,PASS)                         
//CON      DD DSN=&TEMP0001,                       
//            DISP=(SHR,PASS),                     
//            VOL=REF=*.T1                         
//         DD DSN=&TEMP0002,                       
//            DISP=(SHR,PASS),                     
//            VOL=REF=*.T2                         
//         DD DSN=&TEMP0003,                       
//            DISP=(SHR,PASS),                                   
//            VOL=REF=*.T3                                       
//T4       DD DSN=&TEMP0004,                                     
//            DISP=(,PASS)                                       
//T5       DD DSN=&TEMP0005,                                     
//            DISP=(,PASS)                                       
//OT01     DD SYSOUT=*                                           
//CPY1CNTL DD *                                                 
 OUTFIL FNAMES=T1,                                               
        INCLUDE=(14,1,CH,EQ,C'D'),                               
        OUTREC=(1,80,7X'F0',X'F1',8X'F0',8X'F0',C'DELETED ',C'D')
 OUTFIL FNAMES=T2,                                               
        INCLUDE=(14,1,CH,EQ,C'I'),                               
        OUTREC=(1,80,8X'F0',7X'F0',X'F1',8X'F0',C'INSERTED',C'I')
 OUTFIL FNAMES=T3,                                               
        INCLUDE=(14,1,CH,EQ,C'U'),                               
        OUTREC=(1,80,8X'F0',8X'F0',7X'F0',X'F1',C'UPDATED ',C'U')
/*                                                               
//SRT1CNTL DD *                                                 
 SORT   FIELDS=(1,5,CH,A)                                               
 SUM    FIELDS=NONE                                                     
 OUTREC FIELDS=(C'  X,C',X'7D',1,3,C'/',4,2,X'7D',C',',80:X)           
/*                                                                     
//SRT2CNTL DD *                                                         
 SORT   FIELDS=(1,5,CH,A,14,1,CH,A)                                     
 OUTFIL FNAMES=T5,                                                     
        HEADER1=(80C'-',1/,C'MAIN HEADER',/),                           
        SECTIONS=(1,5,                                                 
             HEADER3=(16X,C'MAIN CODE = ',1,3,10X,                     
                          C'SUB CODE = ',4,2,80:X,1/,80X,1/,           
                           80C'-',1/,                                   
                           C'START DATE : ',DATE=(4MD-),C' TIME: ',     
                            TIME,80:X,/,80C'-',/,80X),                 
             TRAILER3=(2/,C'COUNT OF RECORDS ',                         
                       C'DELETED  IN THE TABLE        =          ',     
                                    TOTAL=(81,8,ZD),80:X,1/,           
                       C'COUNT OF RECORDS ',                           
                       C'INSERTED IN THE TABLE        =          ',     
                                    TOTAL=(89,8,ZD),80:X,1/,           
                       C'COUNT OF RECORDS ',                           
                       C'UPDATED IN THE TABLE         =          ',     
                                     TOTAL=(97,8,ZD),80:X,/,80X,/,     
                                                   80X,/,80X),         
                14,1,                                                   
                 HEADER3=(1/,C'DETAILS:',105,8,79:X,113,1,/,21X,       
                          C'CUSTOMER NUM',79:X,113,1)),                 
       OUTREC=(21X,6,8,79:X,113,1)                                     
/*                                                                     
//CPY2CNTL DD *                                                         
 OMIT   COND=(81,1,CH,EQ,C'U')                                         
 OUTREC FIELDS=(1,79,X)                                                 
/*                                                                     
//DFSMSG   DD SYSOUT=*                                                 
//TOOLMSG  DD SYSOUT=*                                                 


I/P:

Code:

----+----1----+
70601XXXX1235I
70601XXXX1111I
70601XXXX1112U
70601XXXX1113U
70601XXXX1114D
89600XXXX1115U
89600XXXX1116U
89600XXXX1117U
89601XXXX1118I
89601XXXX1119I
89601ZZZZ1122D


O/P:
Code:

------------------------------------------------------------------------------ 
MAIN HEADER                                                                     
                                                                               
                MAIN CODE = 706          SUB CODE = 01                         
                                                                               
------------------------------------------------------------------------------ 
START DATE : 2004-06-09 TIME: 14:46:00                                         
------------------------------------------------------------------------------ 
                                                                               
                                                                               
DETAILS:DELETED                                                                 
                     CUSTOMER NUM                                               
                     XXXX1114                                                   
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                               
                     XXXX1235                                                   
                     XXXX1111                                                   
                                                                               
                                                                               
COUNT OF RECORDS DELETED  IN THE TABLE        =                        1       
COUNT OF RECORDS INSERTED IN THE TABLE        =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        2       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 00                         
                                                                               
------------------------------------------------------------------------------ 
START DATE : 2004-06-09 TIME: 14:46:00                                         
------------------------------------------------------------------------------ 
                                                                               
                                                                               
                                                                               
COUNT OF RECORDS DELETED  IN THE TABLE        =                        0       
COUNT OF RECORDS INSERTED IN THE TABLE        =                        0       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        3       
                                                                               
                                                                               
                                                                               
                MAIN CODE = 896          SUB CODE = 01                         
                                                                               
------------------------------------------------------------------------------ 
START DATE : 2004-06-09 TIME: 14:46:00                                         
------------------------------------------------------------------------------ 
                                                                               
                                                                               
DETAILS:DELETED                                                                 
                     CUSTOMER NUM                                               
                     ZZZZ1122                                                   
                                                                               
DETAILS:INSERTED                                                               
                     CUSTOMER NUM                                               
                     XXXX1118                                                   
                     XXXX1119                                                   
                                                                               
COUNT OF RECORDS DELETED  IN THE TABLE        =                        1       
COUNT OF RECORDS INSERTED IN THE TABLE        =                        2       
COUNT OF RECORDS UPDATED IN THE TABLE         =                        0       
                                                                               
                                                                               
                                                                               

_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group