View previous topic :: View next topic
|
Author |
Message |
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Dear All
I have a requirement where i need to fetch every last record based on some field values. The details as as below.
The data in the VSAM comes like this,..
Code: |
Account No Seq No Distr Country
10000000001 01 Los Angeles USA
10000000001 02 Philadelphia USA
10000000001 03 Newyork USA
20000000001 01 Los Angeles USA
20000000001 02 Philadelphia USA
20000000001 03 Newyork USA
30000000001 01 Los Angeles USA
30000000001 02 Newyork USA |
and so on...
------------------------------
My Output should come as the below.
My idea of including the accounts would be based on Account No.
(like 5,6,pd,eq,10000000001,or,5,6,pd,eq,30000000001).
Code: |
10000000001 03 Newyork USA
30000000001 02 Newyork USA |
------------------------------------------Now ..coming to the data type in the columns ...
Accoun No- S9(11) Comp-3 Var
Seq No- S9(5) Comp-3 Var
And others are in Char format.
Account No+ Seq No = key of the file.
Please let me know if any more info is required and if its possible to achieve this by sort. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
I'd suggest using ICETOOL SELECT ON(5,6,PD) LAST which will give you the last (or only) record with matching key (account number).
Adding a USING to the ICETOOL control allows you specify which accounts to INCLUDE via DFSORT control statements.
Garry.[/code] |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
malayajena,
Use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=Your input vsam file,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(5,6,PD) LAST USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(5,6,PD,EQ,10000000001,OR,5,6,PD,EQ,30000000001)
//* |
|
|
Back to top |
|
|
malayajena
New User
Joined: 08 Jul 2006 Posts: 28 Location: Singapore
|
|
|
|
Thanks a lot garry and Skolusu.
The LAST phrase solved all my concerns.
Cheers:) |
|
Back to top |
|
|
|