Hi I am using ICETOOL to sort a few workfiles and I need to update the counts in the trailer record for both the files... Can I update the count in the in the same step -if so how?
The trailer record is.. where 9022 is the current count and I need to replace this with the new count
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Your trailer seems to imply a "delimited" file. Is it? Or are all the data in fixed positions with fixed lengths?
If you have a delimited file, be fully aware that the order you get on output is dictated by the entire sort key, not just by the complete fields that you may be hoping for.
DATASORT is a very good choice when you don't want to disturb a header/trailer/both which does not have a natural sort key.
For INREC, INCLUDE/OMIT, SORT, SUM, only the records not identified as HEADER or TRAILER (in their variousness) will be processed.
For OUTFIL, however, all records will be processed.
Which means you can use OUTFIL IFTRAIL, if you are up-to-date in your DFSORT.
You don't need to specify any DCB information on your output datasets. DFSORT will provide accurate LRECL and optimal BLKSIZE for you automatically.
So, is all your data fixed? What level of DFSORT are you at? Paste the sysout from your step so that we can see, please.
Thanks Bill
The data is fixed format and the header/trailer is written at start/end of program. The sort key is A44 - the first two fields.
The header is different for the two files - text column tiitles.
The Trailer is (text|count|time date).
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Yes, DATASORT is good. IFTRAIL would work in the USING for a DATASORT. Unfortunately ICE201I G says that you don't have IFTRAIL. You need H for IFTRAIL.
Can you show good samples of your two trailer records, please?
Other than the count, do they contain any data which is not fixed/literal?
The trailer is exactly as you see it, if you are familiar with Adabas/Natural it is done by the COMPRESS statement - COMPRESS '***Filefooter|' #COUNT(I4) '|' and time & date leaving no space. This can be rewritten if it makes it easy.
Code:
=cols>,----+----1----+----2----+----3----+----4----+-
000287,***FileFooter|285|09:28:44 07/10/2013
******,**************************** bottom of data **
Code:
=cols>,----+----1----+----2----+----3----+----4----+-
009024,***FileFooter|9022|09:28:44 07/10/2013
******,**************************** bottom of data **
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I'm not sure what you mean by printing the total twice. Your are only keeping four digits for the total, and if you look to the right of your rcord, you'll see the total there as well.
Yes you can use any edit mask you want.
If you are saying that for some reason you want 285 instead of the identival value 000285, then you will need more coding.
You could use FS or CSF and SQZ, but you have a blank later on that you want to keep, so you'd have to protect that with quotes/apostrophes and take those off later. Or HIT=NEXT on your IFTHEN and some more IFTHENs starting with C'00000' then C'0000' etc in the start position of the number, and shift everything from the first non-zero digit left by the number of zeros (5, 4, 3, etc).
Have a search for user SQZ, postings by skolusu, in DFSORT forum, using the Search at the top of the page. This will give you some examples of SQZ.