IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

batch mofidy KSDS file base on given condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
quanzhong

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Fri Dec 19, 2008 3:58 pm
Reply with quote

Hi, all

now i want to batchly modify a KSDS file, I am using sort, and i want to using that file as both SORTIN and SORTOUT, is that possible? can someone give me a template?

thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Dec 19, 2008 4:22 pm
Reply with quote

NO using the same dataset for SORTIN and SORTOUT is discouraged in general
it is not possible for VSAM in particular
it' s a more general paradigm ralated to VSAM rather than a DFSORT limitation

sort processing is based on a sequential processing approach

read input file,
process each record
write output file

in this case the logic that You migh use is
process the KSDS(SORTIN) writing a work file(SORTOUT)
delete/define the KSDS
repro back the work file into the empty KSDS
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Dec 19, 2008 6:44 pm
Reply with quote

Quote:
it is not possible for VSAM in particular


I believe you can do a destructive SORT if the VSAM file is defined with REUSE and DFSORT uses the OPTION RESET,VSAMIO.

That said, it's still not a good idea to risk losing your data this way.

Garry.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 19, 2008 9:35 pm
Reply with quote

Quote:
NO using the same dataset for SORTIN and SORTOUT is discouraged in general
it is not possible for VSAM in particular
it' s a more general paradigm ralated to VSAM rather than a DFSORT limitation


Enrico,

Yes, you're right that it is discouraged. And if we're talking about a COPY, then you're right that it can't be done. But if we're talking about a SORT, then it can be done with DFSORT. Garry is right about the requirements. To quote from the description of DFSORT's VSAMIO operand:

VSAMIO

specifies that DFSORT can use the same VSAM data set for input and output when all of the following conditions are met:

o The application is a sort.

o RESET is in effect.

o The VSAM data set was defined with REUSE.

These conditions ensure that the VSAM data set is processed as NEW for output and will contain the sorted input records, that is, it will be sorted in-place.

DFSORT terminates if the same VSAM data set is specified for input and output and any of the above conditions are not met.

Quote:
sort processing is based on a sequential processing approach

read input file,
process each record
write output file


That's the way it works for a copy. But for a sort, the process is to read the records from the input file, sort the records, and write the sorted records to the output file. If you think about it, you can't read, process, write for a sort because the last record in the input file could be the first record in the output file.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top