update trailer counts



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: update trailer counts

Postby BillyBoyo » Tue Sep 27, 2011 2:36 pm

Manju Venkat wrote:Also, the trailer has one more field (field13) for updating the total number of records present in the file (including the header and trailer).
[...]


Once you fix your problem with copying the data for the trailer, perhaps you'd like to have a crack at the record counts yourself. Have a look for words like "trailer" in the manual, see if you can find appropriate counts available then.

If you look at Kolusu's "signature", you'll see that he actually works for IBM on their DFSORT product. The software product you are using. He is not at all in the habit of providing solutions which do not work according to the information people provide. I did not expect to find an error in his code, and did not find one. I fully expect there is an error in your code, even though it has been given to you.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: update trailer counts

Postby Manju Venkat » Tue Sep 27, 2011 4:40 pm

Hi Billy,

Skolusu's code is working perfectly fine. The field13 what I had mentioned, is a new query I had raised after that (new trailer layout)
Now, I had understood the logic and the field13 is also getting populated with the desired counts
Thanks a lot Skolusu and Billy!!!!

The sort card I am using now is

//SYSIN DD *
SORT FIELDS=COPY
SUM FIELDS=NONE
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,13X,5)),
IFTHEN=(WHEN=(27,2,PD,EQ,2,OR,18,3,PD,EQ,99999),
OVERLAY=(5:SEQNUM,4,PD,START=0),HIT=NEXT),
IFTHEN=(WHEN=(27,2,PD,EQ,4,OR,18,3,PD,EQ,99999),
OVERLAY=(9:SEQNUM,4,PD,START=0),HIT=NEXT),
IFTHEN=(WHEN=(21,2,PD,EQ,2,OR,21,2,PD,EQ,4,OR,18,3,PD,EQ,99999),
OVERLAY=(13:SEQNUM,5,PD,START=1))
OUTFIL IFTHEN=(WHEN=(18,3,PD,EQ,99999),
BUILD=(1,4,18,34,5,8,60,24,13,5)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,18))
/*
Manju Venkat
 
Posts: 16
Joined: Tue Mar 15, 2011 9:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: update trailer counts

Postby BillyBoyo » Tue Sep 27, 2011 5:48 pm

Good attempt to work it out from what you had.

I'm not sure it is actually working with what you have shown us. You have 21,2,PD, twice, where you have already extended record so should start in 27. Do you only want to count 2's and 4's plus header/trailer? I thought you had some other record-types as well.

If you look up anything related to "trailer" in your DFSort manual, you should find some ready-made possibilities for providing a total of all records on the file.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: update trailer counts

Postby Manju Venkat » Tue Sep 27, 2011 7:05 pm

Hi Billy,
Actually, there are 3 counts which I had to update in the trailer.

First one is - Number of 02 type records (in position 35 of trailer) - this rec type is present in field4 of the inp file
Second - Number of 04 type records (in position 39 of trailer) - this rec type is present in field4 of the inp file
Third - total num of records in the file (in position 67 of trailer) - this is counted based on values in field2 which may be 2 or 4 only (this is not the rec type field).

I had posted only abt the first two counts in my earlier posts yesterday. The one about field13: I had posted it earlier today

Also, please let me know if I want to count all the records present in the input file (without checking the values of field2 etc) is there a generic way to be added in the same step?
i.e how to avoid IFTHEN=(WHEN=(21,2,PD,EQ,2,OR,21,2,PD,EQ,4,OR,18,3,PD,EQ,99999) this sentence for overlaying counts OVERLAY=(13:SEQNUM,5,PD,START=1)) here.
Manju Venkat
 
Posts: 16
Joined: Tue Mar 15, 2011 9:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: update trailer counts

Postby skolusu » Tue Sep 27, 2011 10:01 pm

Manju Venkat wrote:Hi Billy,
Actually, there are 3 counts which I had to update in the trailer.

First one is - Number of 02 type records (in position 35 of trailer) - this rec type is present in field4 of the inp file
Second - Number of 04 type records (in position 39 of trailer) - this rec type is present in field4 of the inp file
Third - total num of records in the file (in position 67 of trailer) - this is counted based on values in field2 which may be 2 or 4 only (this is not the rec type field).

I had posted only abt the first two counts in my earlier posts yesterday. The one about field13: I had posted it earlier today

Also, please let me know if I want to count all the records present in the input file (without checking the values of field2 etc) is there a generic way to be added in the same step?
i.e how to avoid IFTHEN=(WHEN=(21,2,PD,EQ,2,OR,21,2,PD,EQ,4,OR,18,3,PD,EQ,99999) this sentence for overlaying counts OVERLAY=(13:SEQNUM,5,PD,START=1)) here.



Manju,

Couple of points you need to be aware.

1. Your input file is a VB file please state the positions to be modified accounting the RDW.
2. SUM FIELDS=NONE is ignored with SORT FIELDS=COPY. I am not sure as to why you even have that when the control cards I show does NOT have it.
3. Your latest control cards have a lot of mistakes with respect to the position number of the record id's. The first 2 IFTHEN are checking for pos 27 and the last one is checking for 21. Also while building the trailer record you ignored the tail. You are only creating a 88 byte trailer. so if you have anything beyond that you are ignoring it.

Coming to your latest query, you don't have to check for any indicator to count the number of records in a file. You can populate the count on the IFTHEN=(WHEN=INIT statement itself . This will give you a count of all records including the trailer record. Use the following Control cards which will give you the desired results.

//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,SEQNUM,5,PD,5)),
  IFTHEN=(WHEN=(27,2,PD,EQ,2,OR,18,3,PD,EQ,99999),       
  OVERLAY=(5:SEQNUM,4,PD,START=0),HIT=NEXT),             
  IFTHEN=(WHEN=(27,2,PD,EQ,4,OR,18,3,PD,EQ,99999),       
  OVERLAY=(9:SEQNUM,4,PD,START=0))                       
                                                         
  OUTFIL IFTHEN=(WHEN=(18,3,PD,EQ,99999),                 
  BUILD=(1,4,18,34,5,8,60,24,13,5,89)),                   
  IFTHEN=(WHEN=NONE,BUILD=(1,4,18))                       
//*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: update trailer counts

Postby Manju Venkat » Wed Sep 28, 2011 10:33 am

Hi Skolusu,
Thank you!!
Manju Venkat
 
Posts: 16
Joined: Tue Mar 15, 2011 9:28 am
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post