|
View previous topic :: View next topic
|
| Author |
Message |
vramya
New User
Joined: 07 Nov 2008 Posts: 13 Location: US
|
|
|
|
I have a variable length record and I have to select the rows based on particular set of values and the output file should not contain redundant records. (avoid duplicates and have only the first record found)
I have used the following with ICETOOL and it worked fine.
SELECT FROM(SORTIN1) TO(SORTOUT) ON(VLEN) -
ON(1,2,PD) ON (3,4,CH) -
FIRST VSAMTYPE(V)
In case, if I have to retain the header and trailer, do we have any way to
add in the above statement.
(I have one header and one trailer record in the file).
(or) do we have to use only datasort to achieve this ?
Thanks! |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| What does your header record look like? What does your trailer record look like? In particular, is there something in the header and trailer record that identify them as such (e.g. '0' in position 5 for header and '9' in position 5 for trailer)? |
|
| Back to top |
|
 |
vramya
New User
Joined: 07 Nov 2008 Posts: 13 Location: US
|
|
|
|
| The header record has '00' in the first two position and the trailer has '99' in the first two position. |
|
| Back to top |
|
 |
vramya
New User
Joined: 07 Nov 2008 Posts: 13 Location: US
|
|
|
|
Requirement is:
Input record:
00123LAC0000000
01123LAC1234520
....
99999LAC0000000
Its a variable length record.
a) The output should not have redundant records
(Order of the sorting should be:
(3,3,CH,A) (6,3,CH,A) (9,7,CH,A), (1,2,CH,A) )
b) Header and Trailer should be retained
I had a problem when I used VLEN, as (1,2,BI) was also getting executed which affected the sort order. When I removed it, everything was in place except for Header & Trailer.Just thinking if we have some logic to incorporate in the same 'select for' command'
Thanks! |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You don't seem to understand VB records. VB records have an RDW in positions 1-4 followed by the data starting in position 5. So all of your starting positions are wrong.
Also, you only show the header and trailer and one data record, so I can't tell if the data records all start with '01' or not. Do they? If all of the data records start with '01', this is much easier.
Please show a more complete example of input records and expected output records.
Also, please show the //DFSMSG messages you received for your run so I can verify that you really have VB records. |
|
| Back to top |
|
 |
vramya
New User
Joined: 07 Nov 2008 Posts: 13 Location: US
|
|
|
|
I am sorry that I posted a wrong card.
Output File looks like this:
0036DII000000000000000000002010-06-06DIRLIN
9936DII000000000000000000002010-06-06DIRLIN
0136DII00020139 PMR CLIFOR000201
0336DII00020139 CLICU100020139
0436DII00020139 6000432464
0136DII00022394 PMR CLIFOR000223
0336DII00022394 CLICU100022394
0436DII00022394 6000357646
I have used the following in my job:
SELECT FROM(SORTIN1) TO(SORTOUT) -
ON(7,2,PD) ON(9,3,CH) ON(12,20,CH) ON(5,2,CH) -
FIRST VSAMTYPE(V)
All I want is: can I exclude the header and trailer from sorting.
I want the record starting with '00' and '99' to be in the same position as like the input file.
DFSMSG:
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTIN=SORTIN1,SORTOUT=S
RTOUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NOCHEC
SORT FIELDS=(7,2,PD,A,9,3,CH,A,12,20,CH,A,5,2,CH,A)
MODS E35=(ICE35DU,12288)
RECORD TYPE=V
Many thanks! |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vramya,
It would have helped if you had posted the entire DFSMSG. Either way use the following control cards.
| Code: |
//TOOLIN DD *
SELECT FROM(SORTIN1) TO(SORTOUT) -
ON(5,1,CH) ON(8,2,PD) ON(10,3,CH) ON(13,20,CH) -
FIRST VSAMTYPE(V) USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'1',5)),
IFTHEN=(WHEN=(6,2,CH,EQ,C'00'),OVERLAY=(5:C'0')),
IFTHEN=(WHEN=(6,2,CH,EQ,C'99'),OVERLAY=(5:C'9'))
OUTFIL FNAMES=SORTOUT,BUILD=(1,4,6)
//* |
|
|
| Back to top |
|
 |
vramya
New User
Joined: 07 Nov 2008 Posts: 13 Location: US
|
|
|
|
| I am able to complete it. Thanks Everyone!! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|