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.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Jun 09, 2004 5:27 am Post subject:
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.
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Wed Jun 09, 2004 6:40 am Post subject:
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.
---+----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.
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Wed Jun 09, 2004 1:47 pm Post subject:
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.
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