Posted: Tue Dec 27, 2005 2:31 am Post subject: Updating the trailer record using sort
Hi,
I have one file like as below
20051227 ==> header record date
11111111111111111111 00000
11111111111111111112 00000
11111111111111111112 00000
11111111111111111113 00000
11111111111111111114 00000
00000005 ==>trailer with count of detail rec
i need to eliminate the duplicates and update the trailer record as below
20051227 ==> header record date
11111111111111111111 00000
11111111111111111112 00000
11111111111111111113 00000
11111111111111111114 00000
00000004 ==>trailer with count of detail rec
Is there any way to acheive this. I was able to create a new trailer record with count 4 by giving the sort card as below.But is there any way to update the orginal trailer record.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Dec 27, 2005 10:21 am Post subject:
Quote:
I was able to create a new trailer record with count 4 by giving the sort card as below.But is there any way to update the orginal trailer record.
What sort card below? Please show it?
What do you mean by "update the original trailer record"? Do you mean update the count, but keep other fields in the trailer record? Or do you mean something else? If the trailer record only has the count, then what's the difference between creating a new trailer record with the count vs updating the original trailer record? You need to explain what you want to do more clearly. A detailed example would help. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Dec 28, 2005 8:53 am Post subject:
Quote:
The existing trailer records has some more fields.. that is the reason i need to update the exististing one.
infoman123,
How do you differentiate the header and trailer records from detail records? Is there a field on these records which identify them? or are they the first and last records of the file?
the 1st 2bytes of header is low values and trailer is high values.
the detail record is having 1st 2 bytes numeric...
so i need to eliminate the duplicates from detail records and update the trailer with new counts of detail records in the trailer one..
i am seprating the header and trailer like said in the link above. and trying to eliminate the duplicates and build a new trailer record with new counts.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Dec 28, 2005 9:40 am Post subject:
Quote:
the 1st 2bytes of header is low values and trailer is high values.
infoman123,
can you post the low values and high values along with the dcb properties of the input file. Also post the position and format of the count field to be replaced.
the position is 3rd byte of the trailer.The low values X'0000' and high values is X'FFFF'. The DCB parameter is VB,rec length is 4504,blk size is 4508.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 28, 2005 11:42 am Post subject:
infoman123,
Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN, OVERLAY and COUNT-n functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VB input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
* Sort
SORT FIELDS=(5,20,ZD,A)
* Remove duplicates
SUM FIELDS=NONE
* T1 has header, detail records (w/o dups), trailer
OUTFIL FNAMES=T1
* C1 has a DFSORT symbol as follows:
* NEWCT,C'nnnnnnnn'
* where nnnnnnnn = count - 2 (-2 for header and trailer)
OUTFIL FNAMES=C1,REMOVECC,NODETAIL,OUTREC=(80X),VTOF,
TRAILER1=(C'NEWCT,C''',COUNT-2=(M11,LENGTH=8),C'''')
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&C1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... VB output file
//SYSIN DD *
OPTION COPY
* Overlay original count in trailer with NEWCT
INREC IFTHEN=(WHEN=(5,2,BI,EQ,X'FFFF'),
OVERLAY=(7:NEWCT))
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Frank,
i got the reason of problem mentioned above,it was because headr and trailer are short of the sort filed mentioned.Could you Please suggest any method to over come this and wht i found was the order of header and trailer will change because of the sort field mentioned.How to make header at top itself.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 28, 2005 1:55 pm Post subject:
Assuming you only have positive numbers for the detail record keys (as shown in your example), replace the SORT statement in the S1 SYSIN with these two statements:
Code:
OPTION EQUALS,VLSHRT
SORT FIELDS=(5,20,BI,A)
VLSHRT will take care of the "short" records.
With SORT FIELDS=(5,20,BI,A), the low value in the header record will keep it as the first record and the high value in the trailer record will keep it as the last record. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
We have two mainframes and i was trying this yeterday which we have this installed. So how can we achieve the same result where z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 is not installed.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Oct 27, 2010 4:38 pm Post subject:
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026, you can use DFSORT's new IFTRAIL function to do this kind of thing more easily like this:
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