|
View previous topic :: View next topic
|
| Author |
Message |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Hi,
I have input file and sorting it on two fields with sum fields = none. In input file I have detail record and trailer
record. Trailer record contains total number of detail records that we have in input file. While sorting with
sum fields = none it's deleting dulicate records from that file. Suppose there 50 records and 5 duplicate records are
deleted then remaining are 45 records, so Trailer record should contain value 45 but it's not getting updated in output
file. Please tell me what sort should I use to update the trailer record as per my requirement.
NOTE - TYPE OF RECORD 2 IS FOR DETAIL AND 3 IS FOR TRAILER.
TYPE-OF-REC EMP-ID EMP-NAME EMP-DEPT
2 21400 SANDIP MECHANICAL
2 21300 MANISH IT
2 21500 TUSHAR COMP
2 21500 TUSHAR COMP
3 04
SORT CARD USING -
SORT FIELDS=(003,005,CH,A,
009,010,CH,A)
SUM FIELDS=NONE
After sorting Triler record will contain value 04, not 3 it should be updated to 3. Please provide me solution for this.
thanks,
Sandip Walsinge
Pune |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
From what has been posted, i see no reason for the trailer to be modified. . .
Possibly, there is something i misunderstand. |
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Hi Dick,
In next step it's matching triler record if it's not matching the job is abending that's the reason we need to update the trailer record count.
Thanks,
Sandip Walsinge |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
My reply was not clear. . . .
The posted code does not show any trailer being created/updated. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sandip_mainframe,
Use the following control cards. I assumed that your input is FB and LRECL of 80.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2 21400 SANDIP MECHANICAL
2 21300 MANISH IT
2 21500 TUSHAR COMP
2 21500 TUSHAR COMP
3 04
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(001,001,CH,A,
003,005,CH,A,
009,010,CH,A)
SUM FIELDS=NONE
OUTREC IFOUTLEN=80,
IFTHEN(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),
IFTHEN=(WHEN=(1,1,ZD,EQ,3),OVERLAY=(3:81,8))
//*
|
The output from this job is
| Code: |
2 21300 MANISH IT
2 21400 SANDIP MECHANICAL
2 21500 TUSHAR COMP
3 00000003
|
|
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Skolusu,
i think this line
| Code: |
| IFTHEN(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)), |
should be
| Code: |
| IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)), |
Gerry |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Actually, either syntax will work with z/OS DFSORT V1R10, but only the second one will work with z/OS DFSORT V1R5. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Thanks Frank
Gerry |
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Thanks for your inputs. I will check this code and if I find any difficulty I will let you know.
Sandip Walsinge |
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Hi Skolusu,
The code given by you is working fine for what I gave in test. But in actual environment my trailer record is comp-3 varilable.
10 BQREBATE-TRAILER-COUNT PIC S9(11) COMP-3.
207/19/20090002413941663200CRX002
FFF6FF6FFFFFFFFFFFFFFFFFFFFCDEFFF
207119120090002413941663200397002
--------------------------------
207/19/20090002885524393200COX123
FFF6FF6FFFFFFFFFFFFFFFFFFFFCDEFFF
207119120090002885524393200367123
--------------------------------
3...ñ.æ
F00043944444444444444444444444444
300390C00000000000000000000000000
Please suggest sort card for this.
Thanks,
Sandip Walsinge |
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
Input file format is
RECFM=FB
LRECL=563
BLKSIZE=27587
And Trailer Count start from 2nd column.
Thanks,
Sandip Walsinge |
|
| Back to top |
|
 |
sandip_mainframe Warnings : 2 New User

Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
| Thanks for input I got it. |
|
| Back to top |
|
 |
jebbin
New User
Joined: 13 Nov 2009 Posts: 6 Location: Bangalore
|
|
|
|
Hi, i tried to use this code for a file i have got. The only problem is that i have got a header record as well, so the count in the trailer is 1 more than it should be. I tried using a criteria which includes only detail records for the seqnum, but then the final overlay is writing spaces to the trailer count field since the seqnum field of the trailer record is empty. i.e
| Code: |
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),OVERLAY=(61:SEQNUM,8,ZD,START=0))
IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),OVERLAY=(10:61,8))
|
.
The detail records start with a '1' in first field, and the trailer starts with '9'. Header starts with '0'. Here the count will be calulcated correctly. But in the second overlay, since the 61st to 68th positions in the trailer recods is spaces, the count field of the trailer record is re-written with spaces. Any suggestions on how to work around this? |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
| Code: |
IFTHEN=(WHEN=INIT,OVERLAY=(61:SEQNUM,8,ZD,START=0)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),
OVERLAY=(10:61,8,ZD,SUB,+1,EDIT=(TTTTTT)))
|
Gerry |
|
| Back to top |
|
 |
jebbin
New User
Joined: 13 Nov 2009 Posts: 6 Location: Bangalore
|
|
|
|
Hi, i tried that and there is a change, but not expected. My trailer value was coming as:
72 was the earlier trailer count. So tried increasing the number of 'T's in the EDIT from 6 to 8. I am getting the desired output now. If that is not the way to go about it, please do let me know. Thanks alot for your help. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sandip,
Use the following control cards
| Code: |
//SYSIN DD *
SORT FIELDS=(001,001,CH,A,
003,005,CH,A,
009,010,CH,A)
SUM FIELDS=NONE
OUTREC IFOUTLEN=537,
IFTHEN(WHEN=INIT,OVERLAY=(538:SEQNUM,6,PD)),
IFTHEN=(WHEN=(1,1,ZD,EQ,3),OVERLAY=(2:538,6,PD,SUB,+2,PD,LENGTH=6))
//* |
jebbin,
Is your request same as sandip or different? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to do this kind of thing quite easily.
For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|