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: 10231
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: 992
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 Batch job tunning sgandhla Testing & Performance analysis 0 Fri Mar 24, 2017 9:41 pm
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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