The DLET call is used to delete a segment occurrence from the database. This has to be preceded by a successful Get-Hold call. Suppose, if a RECVABLE segment is to be deleted which is child of SHIPTO segment whose sequence num. is '01' which is under the CUSTOMER with num. 'DV0001'.
The DL/I calls to achieve this requirement is:
Step1 : GHU CUSTOMER(CUSTNUM='DV0001') SHIPTO(SHPTOSEQ='01') RECVABLE (RSINVNUM='R00001') Step2 : DLET
The GHU call in Step1 is issued to bring the RECVABLE segment into the I/O area. Then the DLET call is issued with an unqualified SSA. As because the GHU call mentioned above is not a path call, only RECVABLE segment is retrieved with a hold into the I/O area. Note that the DLET function, deletes RECVABLE segment along with its child segment occurrences, if any are present.
If the get hold call that immediately precedes a delete is a path call, then the delete operates on the entire path. Once the path call is issued, the entire path can be deleted by simply issuing the delete call. Alternately the scope of delete can be limited, by supplying one unqualified SSA without command code. The segment that the unqualified SSA names will be deleted, along with all of its dependents. However segments above it along the path retrieved will remain in the database.
When DLET call is issued to delete segment occurrences of a database, the status codes for the following codes needs to be checked. " "(Blank), "DJ", "DA".
Blank indicates that the delete call is successful. Return Status "DJ" indicates that the program has issued a delete call without a preceding Get-Hold call. The "DA" status code is returned, if the key field of the segment image in the I/O area is changed before the program issues the Delete call.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!