Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

batch mofidy KSDS file base on given condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: batch mofidy KSDS file base on given condition
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Dec 19, 2008 4:22 pm    Post subject: Reply to: batch mofidy KSDS file base on given condition
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

Active Member


Joined: 08 May 2006
Posts: 991
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Dec 19, 2008 6:44 pm    Post subject:
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 Moderator


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

PostPosted: Fri Dec 19, 2008 9:35 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us