|
|
| Author |
Message |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
| Code: |
Field1 Field2 Field3 Field4
AAA 1458675 Multiplex ABCDEFGHIJ0
AAA 1458675 Normal ABCDEFGHOST
|
Field1 and Field2 are the same for both the records
If there is such an input then I want the output to include only the
record where the Field4 value ends in 'T' |
|
| Back to top |
|
 |
References
|
|
 |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 3742 Location: Brussels once more ...
|
|
|
|
Your RECFM= your LRECL=
Field 4 has a fixed position and length ? |
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
Field 4 has a fixed position of 45 and length of 11
LRECL=80 RECFM=FB |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1673 Location: germany
|
|
|
|
| great subject title. will definitely help anyone searching for wanting there output to be this way. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
dip,
Does your input file have only two records or can it have more? For each pair of records, will the record with T in the last position always be the second record or can it be the first record? Can the other record of the pair (not the T record) have only specific values (which specific values) in the last position or can it have any value in the last position?
It would really help if you would show a better example of your input records with all possible variations and the expected output records. It's difficult to get the complete picture from just two records. |
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
| The input file can have multiple records and the record with T in the last position can be the first one or the last one.The other record can have values ('0','A','9','C') |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1252 Location: Chennai - India
|
|
|
|
Dip,
Frank Wrote:
| Quote: |
| It would really help if you would show a better example of your input records with all possible variations and the expected output records. It's difficult to get the complete picture from just two records. |
Show better examples if you want the exact solution. |
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
| Code: |
Field1 Field2 Field3 Field4
ABA 7134567 Multiplex ABCDEFGHIJ0
AAA 1458675 Normal ABCDEFGHOST
ABA 7134567 Duplex ABCDEFGHIJT
AAA 1458675 Single ABCDEFGHOSO
BBA 7132227 Multiplex ABCDEFGHIJc
AAc 1333375 Normal AREFTREHOST
BBA 7132227 Duplex ABCDEFGHIJT
AAc 1333375 Single ABCDEFGHOS9
|
| Code: |
Field1 Field2 Field3 Field4
AAA 1458675 Normal ABCDEFGHOST
ABA 7134567 Duplex ABCDEFGHIJT
BBA 7132227 Duplex ABCDEFGHIJT
AAc 1333375 Normal AREFTREHOST
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for.
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABA 7134567 Multiplex ABCDEFGHIJ0
AAA 1458675 Normal ABCDEFGHOST
ABA 7134567 Duplex ABCDEFGHIJT
AAA 1458675 Single ABCDEFGHOSO
BBA 7132227 Multiplex ABCDEFGHIJc
AAc 1333375 Normal AREFTREHOST
BBA 7132227 Duplex ABCDEFGHIJT
AAc 1333375 Single ABCDEFGHOS9
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) ON(14,7,CH) -
FIRSTDUP USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(54,1,CH,EQ,C'T'),OVERLAY=(81:C'0'))
SORT FIELDS=(1,3,CH,A,14,7,CH,A,81,1,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
OUT will have the records in sorted order by field1 and field2:
| Code: |
AAc 1333375 Normal AREFTREHOST
AAA 1458675 Normal ABCDEFGHOST
ABA 7134567 Duplex ABCDEFGHIJT
BBA 7132227 Duplex ABCDEFGHIJT
|
|
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
Thanks..Its working fine .. There is one more doubt ........I want the output this way..........
Field 1 and Field 2 for some records can be similar. The idea is to remove the duplicates. If Field4 has a T as the last character then write that record to the output. If Field4 has a T as the last character for all the duplicate records then write the first one that is encountered.
Field4 can have a value that does not end in T. In such cases, write to the output the first value that is encountered.
The non-duplicare records should be written as-is to the output file
Field1 Field2 Field3 Field4
ABA 713456 Multiplex ABCDEFGHIJ0
AAA 145867 Normal ABCDEFGHOST
ABA 713456 Duplex ABCDEFGHIJT
AAA 145867 Single ABCDEFGHOSO
BBA 713222 Multiplex ABCDEFGHIJc
AAc 133337 Normal AREFTREHOST
BBA 713222 Duplex ABCDEFGHIJT
AAC 133337 Single ABCDEFGHOS9
CCC 234567 Single DHGJF892222
AZA 247298 Normal ADSSSSHDSj9
Field1 - length 3
Field2 - start -5, length 6
Field3 - start 12 , length 15
field 4 - start 25 length 11 |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
If I understand correctly what you want, then this DFSORT/ICETOOL job should do it:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ABA 713456 Multiplex ABCDEFGHIJ0
AAA 145867 Normal ABCDEFGHOST
ABA 713456 Duplex ABCDEFGHIJT
AAA 145867 Single ABCDEFGHOSO
BBA 713222 Multiplex ABCDEFGHIJc
AAc 133337 Normal AREFTREHOST
BBA 713222 Duplex ABCDEFGHIJT
AAc 133337 Single ABCDEFGHOS9
CCC 234567 Single DHGJF892222
AZA 247298 Normal ADSSSSHDSj9
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) ON(5,6,CH) -
FIRST USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(35,1,CH,EQ,C'T'),OVERLAY=(81:C'0'))
SORT FIELDS=(1,3,CH,A,5,6,CH,A,81,1,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
OUT would have:
| Code: |
AAc 133337 Normal AREFTREHOST
AAA 145867 Normal ABCDEFGHOST
ABA 713456 Duplex ABCDEFGHIJT
AZA 247298 Normal ADSSSSHDSj9
BBA 713222 Duplex ABCDEFGHIJT
CCC 234567 Single DHGJF892222
|
If that's not what you want, then you need to explain more clearly what you do want with a good example of your input records and the records you expect for output. |
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
The above sort is not producing the correct output .
Below is the actual output that is written to OUT DD.
The non-duplicate records are not written to the output.
Please help.
AAA 145867 NORMAL ABCDEFGHOST
AAC 133337 NORMAL AREFTREHOST
ABA 713456 DUPLEX ABCDEFGHIJT
BBA 713222 DUPLEX ABCDEFGHIJT |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1252 Location: Chennai - India
|
|
|
|
Dips,
| Quote: |
| The non-duplicate records are not written to the output. |
From the output posted by frank i can see the non-duplicates displayed too.
below mentioned are the non-duplicates
| Code: |
CCC 234567 Single DHGJF892222
AZA 247298 Normal ADSSSSHDSj9
|
Are you not getting this in your output? |
|
| Back to top |
|
 |
dip62001
New User
Joined: 04 Jul 2005 Posts: 12 Location: Pune
|
|
|
|
No I am not getting this in output.
Only the records where duplicates are present are displayed in the output file |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1252 Location: Chennai - India
|
|
|
|
Dip,
| Quote: |
| Only the records where duplicates are present are displayed in the output file |
I tested this and got the desired output. The output is same as that of Frank's.
The Problem could be because of the version used. Could you pls post your JCL and the version used? |
|
| Back to top |
|
 |
|
|