Page 1 of 1

what disp parameter can be used?

Posted: Mon Aug 07, 2023 4:36 pm
by Maven JJ
Hi,

I have a step that passes data from input to output file my output file should created newly and next my job runs i dont want to change any of the disp parameters..So can please suggest what disp parameter i can use

Re: what disp parameter can be used?

Posted: Mon Aug 07, 2023 5:09 pm
by Abbey Tiwari
Probably you want to know which DISP can be used in two steps where at one step it works in OUTPUT mode and in other step as INPUT: It’s MOD but keep in mind when you will run job second time first step will append data at bottom instead of writing altogether new from first line

Re: what disp parameter can be used?

Posted: Mon Aug 07, 2023 5:11 pm
by Maven JJ
Abbey Tiwari wrote: Mon Aug 07, 2023 5:09 pm Probably you want to know which DISP can be used in two steps where at one step it works in OUTPUT mode and in other step as INPUT: It’s MOD but keep in mind when you will run job second time first step will append data at bottom instead of writing altogether new from first line
What if I want to overwrite the data when I run job 2times .what disp parameter will use or how it can be achieved?

Re: what disp parameter can be used?

Posted: Mon Aug 07, 2023 5:33 pm
by zum13
DISP=NEW doesn't tolerate the dataset already existing, so assuming your job is a single step that takes an input dataset, processes it and writes the output dataset as new, the job will fail on the second run. The way to avoid this is to put in an initial step that deletes the dataset first:

Code: Select all

//STEP1  EXEC PGM=IEFBR14
//DD01     DD DSN=your.output.dataset,DISP=(MOD,DELETE,DELETE),
//            SPACE=(TRK,0),RECFM=xx,LRECL=yyy
This will temporarily allocate the dataset and delete it if it's not there, or it will delete the dataset if it is there. The DISP=NEW in the following step should then work both on the first run and any subsequent re-runs.

Re: what disp parameter can be used?

Posted: Mon Aug 14, 2023 4:55 pm
by Maven JJ
Thanks zum13. This works.

I'll keep posted in case our requirements changes.

What does zum13 means?