It depends. You simply have not told us whether you want to do this in place, without copying the data, or if you can copy the ESDS data set to a KSDS data set.
- In place - NO. Period. Full stop. End of story.
- By copying - You must allocate the KSDS after determining the location and size of the key. Once you have done this, you can use the REPRO command in IDCAMS to create the data in the KSDS. If the REPRO fails, most likely you have specified the key in the KSDS incorrectly, and you will have to start over. If the key is correct, the ESDS is not sorted in key order, so you will have to start over, sort the ESDS, and then do the copy.