_Rrollbck () -コミットメント制御の変更のロールバック
形式
#include <recio.h>
int _Rrollbck(void);言語レベル
ILE C Extension
スレッド・セーフ
いいえ
説明
_Rrollbck() 関数は、最後のコミットメント境界を現行のコミットメント境界として再設定します。 ジョブ内のコミットメント制御下でファイルに加えられた変更は、すべて反転されます。 ロック・レコードはすべて解除されます。 ジョブ内のコミットメント制御の下でオープンしているファイルが影響を受けます。 ファイルがコミットメント制御されるようにオープンしている場合は、キーワード・パラメーターを commit=y を指定する必要があります。 コミットメント制御環境は、この前にすでにセットアップされていなければなりません。
_Rrollbck() 関数は、データベースおよび DDM ファイルに対して有効です。
戻り値
例
#include <stdio.h>
#include <recio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char buf[40];
int rc = 1;
_RFILE *purf;
_RFILE *dailyf;
/* Open purchase display file and daily transaction file */
if ( ( purf = _Ropen ( "MYLIB/T1677RD3", "ar+,indicators=y" )) == NULL )
{
printf ( "Display file did not open.\n" );
exit ( 1 );
}
if ( ( dailyf = _Ropen ( "MYLIB/T1677RDA", "wr,commit=y") ) == NULL )
{
printf ( "Daily transaction file did not open.\n" );
exit ( 2 );
}
/* Select purchase record format */
_Rformat ( purf, "PURCHASE" );
/* Invite user to enter a purchase transaction. */
/* The _Rwrite function writes the purchase display. */
_Rwrite ( purf, "", 0 );
_Rreadn ( purf, buf, sizeof(buf), __DFT );
/* Update daily transaction file */
rc = (( _Rwrite ( dailyf, buf, sizeof(buf) ))->num_bytes );
/* If the databases were updated, then commit the transaction. */
/* Otherwise, rollback the transaction and indicate to the */
/* user that an error has occurred and end the application. */
if ( rc )
{
_Rcommit ( "Transaction complete" );
}
else
{
_Rrollbck ( );
_Rformat ( purf, "ERROR" );
}
_Rclose ( purf );
_Rclose ( dailyf );
}関連情報
- _Rcommit() — 現在の 記録をコミットする
- システムの回復のマニュアル