4343 - >
4444 If I(state=absent) and the data set does exist on the managed node,
4545 remove the data set, module completes successfully with I(changed=True).
46+ - >
47+ If I(state=absent) and I(type=MEMBER) and I(force=True), the data set
48+ will be opened with I(DISP=SHR) such that the entire data set can be
49+ accessed by other processes while the specified member is deleted.
4650 - >
4751 If I(state=absent) and I(volumes) is provided, and the data set is not
4852 found in the catalog, the module attempts to perform catalog using supplied
247251 that is not available, then the value C(TMPHLQ) is used.
248252 required: false
249253 type: str
254+ force:
255+ description:
256+ - Specifies that the data set can be shared with others during a member
257+ delete operation which results in the data set you are updating to be
258+ simultaneously updated by others.
259+ - This is helpful when a data set is being used in a long running process
260+ such as a started task and you are wanting to delete a member.
261+ - The I(force=True) option enables sharing of data sets through the
262+ disposition I(DISP=SHR).
263+ - The I(force=True) only applies to data set members when I(state=absent)
264+ and I(type=MEMBER).
265+ type: bool
266+ required: false
267+ default: false
250268 batch:
251269 description:
252270 - Batch can be used to perform operations on multiple data sets in a single module call.
271289 - >
272290 If I(state=absent) and the data set does exist on the managed node,
273291 remove the data set, module completes successfully with I(changed=True).
292+ - >
293+ If I(state=absent) and I(type=MEMBER) and I(force=True), the data
294+ set will be opened with I(DISP=SHR) such that the entire data set
295+ can be accessed by other processes while the specified member is
296+ deleted.
274297 - >
275298 If I(state=absent) and I(volumes) is provided, and the data set is not
276299 found in the catalog, the module attempts to perform catalog using supplied
467490 type: bool
468491 required: false
469492 default: false
493+ force:
494+ description:
495+ - Specifies that the data set can be shared with others during a member
496+ delete operation which results in the data set you are updating to
497+ be simultaneously updated by others.
498+ - This is helpful when a data set is being used in a long running
499+ process such as a started task and you are wanting to delete a
500+ member.
501+ - The I(force=True) option enables sharing of data sets through the
502+ disposition I(DISP=SHR).
503+ - The I(force=True) only applies to data set members when
504+ I(state=absent) and I(type=MEMBER).
505+ type: bool
506+ required: false
507+ default: false
470508
471509"""
472510EXAMPLES = r"""
552590 state: absent
553591 type: MEMBER
554592
593+ - name: Remove a member from an existing PDS/E by opening with disposition DISP=SHR
594+ zos_data_set:
595+ name: someds.name.here(mydata)
596+ state: absent
597+ type: MEMBER
598+ force: yes
599+
555600- name: Create multiple partitioned data sets and add one or more members to each
556601 zos_data_set:
557602 batch:
@@ -894,14 +939,17 @@ def perform_data_set_operations(name, state, **extra_args):
894939 """Calls functions to perform desired operations on
895940 one or more data sets. Returns boolean indicating if changes were made."""
896941 changed = False
942+ # passing in **extra_args forced me to modify the acceptable parameters
943+ # for multiple functions in data_set.py including ensure_present, replace
944+ # and create where the force parameter has no bearing.
897945 if state == "present" and extra_args .get ("type" ) != "MEMBER" :
898946 changed = DataSet .ensure_present (name , ** extra_args )
899947 elif state == "present" and extra_args .get ("type" ) == "MEMBER" :
900948 changed = DataSet .ensure_member_present (name , extra_args .get ("replace" ))
901949 elif state == "absent" and extra_args .get ("type" ) != "MEMBER" :
902950 changed = DataSet .ensure_absent (name , extra_args .get ("volumes" ))
903951 elif state == "absent" and extra_args .get ("type" ) == "MEMBER" :
904- changed = DataSet .ensure_member_absent (name )
952+ changed = DataSet .ensure_member_absent (name , extra_args . get ( "force" ) )
905953 elif state == "cataloged" :
906954 changed = DataSet .ensure_cataloged (name , extra_args .get ("volumes" ))
907955 elif state == "uncataloged" :
@@ -1017,6 +1065,11 @@ def parse_and_validate_args(params):
10171065 aliases = ["volume" ],
10181066 dependencies = ["state" ],
10191067 ),
1068+ force = dict (
1069+ type = "bool" ,
1070+ required = False ,
1071+ default = False ,
1072+ ),
10201073 ),
10211074 ),
10221075 # For individual data set args
@@ -1086,6 +1139,11 @@ def parse_and_validate_args(params):
10861139 required = False ,
10871140 default = None
10881141 ),
1142+ force = dict (
1143+ type = "bool" ,
1144+ required = False ,
1145+ default = False ,
1146+ ),
10891147 mutually_exclusive = [
10901148 ["batch" , "name" ],
10911149 # ["batch", "state"],
@@ -1102,6 +1160,7 @@ def parse_and_validate_args(params):
11021160 ["batch" , "key_length" ],
11031161 # ["batch", "replace"],
11041162 ["batch" , "volumes" ],
1163+ # ["batch", "force"],
11051164 ],
11061165 )
11071166 parser = BetterArgParser (arg_defs )
@@ -1162,6 +1221,11 @@ def run_module():
11621221 default = False ,
11631222 ),
11641223 volumes = dict (type = "raw" , required = False , aliases = ["volume" ]),
1224+ force = dict (
1225+ type = "bool" ,
1226+ required = False ,
1227+ default = False ,
1228+ ),
11651229 ),
11661230 ),
11671231 # For individual data set args
@@ -1213,6 +1277,11 @@ def run_module():
12131277 required = False ,
12141278 default = None
12151279 ),
1280+ force = dict (
1281+ type = "bool" ,
1282+ required = False ,
1283+ default = False
1284+ ),
12161285 )
12171286 result = dict (changed = False , message = "" , names = [])
12181287
0 commit comments