Alter

Alter an existing data set profile.

DataSetAdmin.alter()

def alter(
    self, data_set: str, traits: dict, volume: Union[str, None] = None, generic: bool = False
) -> Union[dict, bytes]:

📄 Description

 

Only a subset of available Segments and Traits are considered Stable. See Segments and Traits for more details.

 

Alter operations in pyracf require READ access to IRR.IRRSMO00.PRECHECK in the XFACILIT class This function will not produce output unless the user running the command has this access.

 

Alter an existing data set profile.

📥 Parameters

  • data_set
    The name of the data set profile being altered.

  • traits
    A dictionary of traits/attributes that should be given to the data set profile on creation. See Traits to see what all of the valid Data Set Traits are.

  • volume
    A single volume name for this data set profile. This argument is optional. If generic=True is specified, volume is ignored.

  • generic
    A bool indicating whether to treat this profile as generic or not. This argument is optional and defaults to False.

📤 Returns

  • Union[dict, bytes]
    Returns a Security Result dictionary or Security Request XML bytes if the DataSetAdmin.generate_requests_only class attribute is set to True.

❌ Raises

  • SecurityRequestError
    Raises SecurityRequestError when the SAF Return Code of a Security Result is equal to 4.
  • DownstreamFatalError
    Raises DownstreamFatalError when the SAF Return Code of a Security Result is greater than 4.
  • AlterOperationError
    Raises AlterOperationError when the data set profile cannot be altered because it does NOT exist.
  • SegmentTraitError
    Raises SegmentTraitError when the dictionary of traits/attributes provided contains one or more unknown traits.

💻 Example

The following example alters a data set profile called ESWIFT.TEST.T1136242.P3020470 with traits/attributes to alter specified in the traits dictionary.

Python Script
from pyracf import DataSetAdmin
data_set_admin = DataSetAdmin()

traits = {
    "base:universal_access": "Read",
    "base:owner": "eswift",
}

data_set_admin.alter("ESWIFT.TEST.T1136242.P3020470", traits=traits)
Security Result Dictionary as JSON
{
  "securityResult": {
    "dataSet": {
      "name": "ESWIFT.TEST.T1136242.P3020470",
      "operation": "set",
      "generic": "no",
      "requestId": "DatasetRequest",
      "info": [
        "Definition exists. Add command skipped due  to precheck option"
      ],
      "commands": [
        {
          "safReturnCode": 0,
          "returnCode": 0,
          "reasonCode": 0,
          "image": "ALTDSD               ('ESWIFT.TEST.T1136242.P3020470')  UACC        (Read) OWNER       (eswift)"
        }
      ]
    },
    "returnCode": 0,
    "reasonCode": 0,
    "runningUserid": "testuser"
  }
}