Modify text blocks in data sets

You can use ZOAU to modify text blocks and surround them with eye-catching markers.

Example data set IBMUSER.DATA:

property1=value1
property2=value2

You can insert a new block of lines between property1 and property2 in the following ways:

  • Issuing a shell command:
dmod -b -m "START\nSTOP\n#{mark} NEW CONTENT" "/property2/i\newproperty1=value\nnewproperty2=value" IBMUSER.DATA
  • Calling an API in Python programs:
datasets.blockinfile("IBMUSER.DATA", block="newproperty1=value\\nnewproperty2=value", marker="START\\nSTOP\\n#{mark} NEW CONTENT", ins_bef="property2")

The resulting content of IBMUSER.DATA will be:

property1=value
#START NEW CONTENT
newproperty1=value
newproperty2=value
#STOP NEW CONTENT
property2=value