_Rpgmdev () -デフォルト・プログラム・デバイスの設定
形式
#include <recio.h>
int _Rpgmdev(_RFILE *fp, char *dev);言語レベル
ILE C Extension
スレッド・セーフ
いいえ
ジョブ CCSID インターフェース
この関数に送信される文字データは、すべてジョブの CCSID 内にあると想定されます。 この関数によって戻された文字データは、すべてジョブの CCSID 内にあります。 詳しくは、 CCSID とロケールについて を参照してください。
説明
_Rpgmdev() 関数は、 fp に関連したファイルの現行プログラム装置を devに設定します。 装置は、大文字で指定してください。
dev パラメーターは、ヌル終了 C ストリングです。
_Rpgmdev() 関数は、ディスプレイ・ファイル、ICF ファイル、およびプリンター・ファイルに対して有効です。
戻り値
例
#include <stdio.h>
#include <recio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
char name[20];
char address[25];
} format1 ;
typedef struct {
char name[8];
char password[10];
} format2 ;
typedef union {
format1 fmt1;
format2 fmt2;
} formats ;
int main(void)
{
_RFILE *fp; /* File pointer */
_RIOFB_T *rfb; /*Pointer to the file's feedback structure */
formats buf, in_buf, out_buf; /* Buffers to hold data */
/* Open the device file. */
if (( fp = _Ropen ( "MYLIB/T1677RD2", "ar+" )) == NULL )
{
printf ( "Could not open file\n" );
exit ( 1 );
}
_Rpgmdev ( fp,"DEVICE2" );/* Change the default program device. */
/* Replace with actual device name. */
_Rformat ( fp,"FORMAT2" ); /* Set the record format for the */
/* display file. */
rfb = _Rwrite ( fp, "", 0 ); /* Set up the display. */
rfb = _Rwriterd ( fp, &buf, sizeof(buf) );
rfb = _Rwrread ( fp, &in_buf, sizeof(in_buf), &out_buf,
sizeof(out_buf ));
/* Continue processing. */
_Rclose ( fp );
}