DL/I에 대한 delete 고려사항
DL/I의 컨텍스트에서 delete 문은 계층 구조 데이터베이스에서 세그먼트를 제거합니다.
delete 문은 DL/I DLET 문을 생성합니다. DL/I에서 세그먼트를 삭제하려면 우선 세그먼트를 가져와서 보유해야 합니다. delete 문을 사용하기 전에 EGL get 문을 forUpdate 옵션과 조합하여 사용하십시오.
다음 예제는 forUpdate 옵션을 표시합니다.
if (userRequest == "D")
try
get myRecord forUpdate;
onException(dex DLIException)
myErrorHandler(dex); // exits the program
end
try
delete myRecord;
onException(dex DLIException)
myErrorHandler(dex);
end end
구문

- DLISegmentVariable
- 삭제되는 세그먼트에 해당하는 DLISegment 변수의 이름
- usingPCB pcbName
- 기본 PCB를 대체하도록 PSB 레코드에 정의된 PCB의 이름을 지정하는 옵션입니다.
- with #dli{ dliStatement }
- 명시적 DL/I DLET 호출을 작성하는 옵션입니다. #dli 지시문의 내용을 참조하십시오. #dli와 왼쪽 중괄호 사이에 공백을 두지 마십시오.
예제
다음 예제는 고객 데이터베이스에서 주문을 삭제합니다.
Record CustomerRecord type DLISegment
{ segmentName="STSCCST", keyItem="customerNo", hostVarQualifier="myCustomer" }
...
endRecord LocationRecord type DLISegment
{ segmentName="STSCLOC", keyItem="locationNo", hostVarQualifier="myLocation" }
...
endRecord OrderRecord type DLISegment
{ segmentName="STPCORD", keyItem="orderDateNo", hostVarQualifier="myOrder" }
...
end
//create variables for the records
myCustomer CustomerRecord;
myLocation LocationRecord;
myOrder OrderRecord;
//build a segment search parameter
myCustomer.customerNo = "005001";
myLocation.locationNo = "000022";
myOrder.orderDateNo = "20050730A003";
//hold the requested order record
try
get myOrder forUpdate;
onException(dex DLIException)
myErrorHandler(dex);
end
//delete the order
try
delete myOrder;
onException(dex DLIException)
myErrorHandler(dex);
end
get...forUpdate 문은 고객, 위치 및 주문에 대해
규정된 SSA를 생성합니다. GHU STSCCST (STQCCNO = :myCustomer.customerNo)
STSCLOC (STQCLNO = :myLocation.locationNo)
STPCORD (STQCODN = :myOrder.orderDateNo)
그런 다음 delete 문은 단일 코드 행을 생성합니다. DLET STPCORD