View previous topic :: View next topic
|
Author |
Message |
nivasaya
New User
Joined: 03 May 2007 Posts: 27 Location: India
|
|
|
|
Dear Buddies,
I need to select and copy a few Records from a KSDS file to another KSDS file.
Records to be copied – Header (000), Trailer(999) and Partial KEY ‘123’ records.
Currently I am it is done in 2 steps:
STEP 1 - SORT ing the I/P KSDS file to a FLAT file,
STEP 2 - IDCAMS to copy the FLAT file to new O/P KSDS file.
Can we have any other way to have only ONE step to do this.
Thanks & Regards,
Nivasaya |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
IDCAMS REPRO FROMKEY( ) TOKEY( ) |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
What do you mean by
Quote: |
and Partial KEY ‘123’ records. |
You need to give more information on your input records and what you expect in output. Is the key 3 bytes? Is it character? Is '123' a key or part of a key? If part, is it a generic the start of key(s)? If it's a full key, are you looking to extract only part of the data for that key?
Garry. |
|
Back to top |
|
|
nivasaya
New User
Joined: 03 May 2007 Posts: 27 Location: India
|
|
|
|
Key1 9(3)
Key2 X(19)
Key1 - 123 |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
I still don't know what you want. We're not clairvoyants. What does
Quote: |
Key1 9(3)
Key2 X(19)
Key1 - 123 |
mean? and how does it relate to your requirements?
Garry. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What is the actual key length of the KSDS, is it 3, 19 or 22. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Nivasaya,
Assuming that the 3 characters of interest are in the first three bytes of the records, I would think that a DFSORT job like this would do what you want:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input KSDS
//SORTOUT DD DSN=... VSAM output KSDS
//SYSIN DD *
OPTION COPY
RECORD TYPE=V
INCLUDE FORMAT=ZD,
COND=(5,3,EQ,0,OR,5,3,EQ,123,OR,5,3,EQ,999)
/*
|
|
|
Back to top |
|
|
nivasaya
New User
Joined: 03 May 2007 Posts: 27 Location: India
|
|
|
|
Thanks a lot Frank, Gary and Robert for your kind response.
I am very sorry to give only a few info, 'cause of the of the crunchy delivery.
Thanks Frank, i shall test the same, i was looking for the similar one.
our earlier plan was
1) Select a few records from the KSDS file to FLAT file using COBOL pgm based on few criteria.
2) Sort the FLAT file based on the key1,FLd1,Key2
3) use the SORTed file to O/P to the other FLAT report file.
Thanks & Regards,
Nivasaya |
|
Back to top |
|
|
|