DL/I のコンテキストでは、replace ステートメントによって変更済みレコードが階層データベースに配置されます。
replace ステートメントは、DL/I REPL ステートメントを生成します。 DL/I では、セグメントを上書きする前に、そのセグメントを取得し、保持しておく必要があります。EGL キーワードの get...forUpdate、get next...forUpdate、および get next inParent...forUpdate はすべて、 置換のために要求されたセグメントを保持します。

//hostVarQualifier プロパティーを使用して DLI セグメント・レコードを定義する
Record CustomerRecordPart type DLISegment
{ segmentName="STSCCST", keyItem="customerNo", hostVarQualifier="myCustomer" }
...
end
Record LocationRecordPart type DLISegment
{ segmentName="STSCLOC", keyItem="locationNo", hostVarQualifier="myLocation" }
...
end
Record OrderRecordPart type DLISegment
{ segmentName="STPCORD", keyItem="orderDateNo", hostVarQualifier="myOrder" }
...
end
//create variables for the records
myCustomer CustomerRecordPart;
myLocation LocationRecordPart;
myOrder OrderRecordPart;
//build a segment search argument
myCustomer.customerNo = "5001";
myLocation.locationNo = "22";
myOrder.orderDateNo = "20050730A003";
//hold the requested order segment
try
get myOrder forUpdate;
onException(dex DLIException)
myErrorHandler(dex);
end
//update the information
changeOrder(myOrder);
//rewrite the order
try
replace myOrder;
onException(dex DLIException)
myErrorHandler(dex);
end
get...forUpdate ステートメントは、顧客、ロケーション、およびオーダーの修飾 SSA を生成します。GHU STSCCST (STQCCNO = :myCustomer.customerNo)
STSCLOC (STQCLNO = :myLocation.locationNo)
STPCORD (STQCODN = :myOrder.orderDateNo)
replace ステートメントは、
続いて次を生成します。REPL STPCORD