Skip to content

Commit 7bf97fd

Browse files
add nonscratch parameter in main module
1 parent afe0662 commit 7bf97fd

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

plugins/modules/zos_data_set.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@
298298
type: bool
299299
required: false
300300
default: false
301+
noscratch:
302+
description:
303+
- "For C(state=absent), specifies whether to keep the data set's entry in the VTOC."
304+
- If C(noscratch=True), the data set is uncataloged but not physically removed from the volume. The DSCB is not removed from the VTOC.
305+
- This is the equivalent of using C(NOSCRATCH) in an C(IDCAMS DELETE) command.
306+
type: bool
307+
required: false
308+
default: false
301309
volumes:
302310
description:
303311
- >
@@ -575,6 +583,15 @@
575583
type: bool
576584
required: false
577585
default: false
586+
noscratch:
587+
description:
588+
- "For C(state=absent), specifies whether to keep the data set's entry in the VTOC."
589+
- If C(noscratch=True), the data set is uncataloged but not physically removed from the volume.
590+
The DSCB is not removed from the VTOC.
591+
- This is the equivalent of using C(NOSCRATCH) in an C(IDCAMS DELETE) command.
592+
type: bool
593+
required: false
594+
default: false
578595
extended:
579596
description:
580597
- Sets the I(extended) attribute for Generation Data Groups.
@@ -734,6 +751,12 @@
734751
name: someds.name.here
735752
state: absent
736753
754+
- name: Uncatalog a data set but do not remove it from the volume
755+
zos_data_set:
756+
name: someds.name.here
757+
state: absent
758+
noscratch: true
759+
737760
- name: Delete a data set if it exists. If data set not cataloged, check on volume 222222 for the data set, and then catalog and delete if found.
738761
zos_data_set:
739762
name: someds.name.here
@@ -1404,7 +1427,7 @@ def get_data_set_handler(**params):
14041427
)
14051428

14061429

1407-
def perform_data_set_operations(data_set, state, replace, tmp_hlq, force):
1430+
def perform_data_set_operations(data_set, state, replace, tmp_hlq, force, noscratch):
14081431
"""Calls functions to perform desired operations on
14091432
one or more data sets. Returns boolean indicating if changes were made.
14101433
@@ -1439,7 +1462,7 @@ def perform_data_set_operations(data_set, state, replace, tmp_hlq, force):
14391462
elif state == "absent" and data_set.data_set_type == "gdg":
14401463
changed = data_set.ensure_absent(force=force)
14411464
elif state == "absent":
1442-
changed = data_set.ensure_absent(tmp_hlq=tmp_hlq)
1465+
changed = data_set.ensure_absent(tmp_hlq=tmp_hlq, noscratch=noscratch)
14431466
elif state == "cataloged":
14441467
changed = data_set.ensure_cataloged(tmp_hlq=tmp_hlq)
14451468
elif state == "uncataloged":
@@ -1586,6 +1609,11 @@ def parse_and_validate_args(params):
15861609
required=False,
15871610
default=False,
15881611
),
1612+
noscratch=dict(
1613+
type="bool",
1614+
required=False,
1615+
default=False,
1616+
),
15891617
),
15901618
),
15911619
# For individual data set args
@@ -1676,6 +1704,11 @@ def parse_and_validate_args(params):
16761704
required=False,
16771705
default=False,
16781706
),
1707+
noscratch=dict(
1708+
type="bool",
1709+
required=False,
1710+
default=False,
1711+
),
16791712
mutually_exclusive=[
16801713
["batch", "name"],
16811714
# ["batch", "state"],
@@ -1788,6 +1821,11 @@ def run_module():
17881821
required=False,
17891822
default=False,
17901823
),
1824+
noscratch=dict(
1825+
type="bool",
1826+
required=False,
1827+
default=False,
1828+
),
17911829
),
17921830
),
17931831
# For individual data set args
@@ -1868,6 +1906,11 @@ def run_module():
18681906
required=False,
18691907
default=False
18701908
),
1909+
noscratch=dict(
1910+
type="bool",
1911+
required=False,
1912+
default=False
1913+
),
18711914
)
18721915
result = dict(changed=False, message="", names=[])
18731916

@@ -1895,6 +1938,8 @@ def run_module():
18951938
module.params["replace"] = None
18961939
if module.params.get("record_format") is not None:
18971940
module.params["record_format"] = None
1941+
if module.params.get("noscratch") is not None:
1942+
module.params["noscratch"] = None
18981943
elif module.params.get("type") is not None:
18991944
if module.params.get("type") in DATA_SET_TYPES_VSAM:
19001945
# For VSAM types set the value to nothing and let the code manage it
@@ -1921,6 +1966,7 @@ def run_module():
19211966
replace=data_set_params.get("replace"),
19221967
tmp_hlq=data_set_params.get("tmp_hlq"),
19231968
force=data_set_params.get("force"),
1969+
noscratch=data_set_params.get("noscratch"),
19241970
)
19251971
result["changed"] = result["changed"] or current_changed
19261972
except Exception as e:

0 commit comments

Comments
 (0)