This is a guide for deciding what parameters need to be coded on a DD statement. Sometimes we need many parameters, and sometimes we need just a few.
If the data set is new
If it is a permanent file
Use DSN, UNIT=SYSALLDA, SPACE and DISP=(NEW,___,___)
Else (* It is a temporary file. *)
Case
The data set is to be printed:
Use DD SYSOUT=*
The data set is in-stream data:
If the data contains lines beginning with // or /*
Use DD DATA, DLM=__ and use __ as the delimiter
Else (* The usual delimiter will do. *)
Use DD * and use /* as the delimiter
EndIf
The data set is to be on disk:
If the data set is needed in a later job step
Use DSN=&&___, UNIT=SYSALLDA, SPACE and DISP=(NEW,PASS)
Else (* We can throw it away after this step. *)
Use UNIT=SYSALLDA and SPACE
(* There is no need for DSN or DISP. *)
EndIf
EndCase
EndIf
Else (* It is old. *)
If it is a permanent file
If it is catalogued
Use DSN and DISP=(SHR,___,___) or DISP=(OLD,___,___)
Else (* It is not catalogued. *)
Use DSN, UNIT=SYSALLDA and DISP=(SHR,___,___) or
DISP=(OLD,___,___)
EndIf
Else (* It is temporary, inherited from an earlier step. *)
Use DSN=&&___ (name from earlier step), UNIT=SYSALLDA and
DISP=(OLD,___)
EndIf
EndIf
This applies to ordinary sequential data sets, not to VSAM clusters.
If we are dealing with VSAM clusters, we do not normally use DD statements to create them or delete them (although this can be done with additional DD parameters). Instead we use the IDCAMS utility. All VSAM clusters created with IDCAMS are catalogued automatically.