Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions doc/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,22 @@ $ OC_EXTEND_CREATES=yes java ocextcreates
FILE STATUS: 00
```

#### COB_FILE_SEQ_WRITE_BUFFER_SIZE
#### COB_FILE_SEQ_BUFFER_SIZE

Specifies the write buffer size for sequential files.
Specifies the buffer size for sequential file I/O (both read and write).

- **Value**: Integer >= 0 (default: 10). The value represents a multiplier for the record size.
- **Example**: `COB_FILE_SEQ_BUFFER_SIZE=100`
- **Purpose**: Adjusts read and write performance for SEQUENTIAL and LINE SEQUENTIAL files. The actual buffer size is calculated as `COB_FILE_SEQ_BUFFER_SIZE * record_max` bytes. Setting to 0 disables buffering.

#### COB_FILE_SEQ_WRITE_BUFFER_SIZE (Deprecated)

Deprecated. Use `COB_FILE_SEQ_BUFFER_SIZE` instead.

This environment variable is retained for backward compatibility. When `COB_FILE_SEQ_BUFFER_SIZE` is not set, this variable is used as a fallback with the same effect.

- **Value**: Integer >= 0 (default: 10)
- **Example**: `COB_FILE_SEQ_WRITE_BUFFER_SIZE=100`
- **Purpose**: Adjusts write performance.

#### COB_IO_ASSUME_REWRITE

Expand Down
15 changes: 12 additions & 3 deletions doc/environment_variables_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,22 @@ $ OC_EXTEND_CREATES=yes java ocextcreates
FILE STATUS: 00
```

#### COB_FILE_SEQ_WRITE_BUFFER_SIZE
#### COB_FILE_SEQ_BUFFER_SIZE

順編成ファイルの書き込みバッファサイズを指定します。
順編成ファイルの読み書きバッファサイズを指定します。

- **値**: 0以上の整数(デフォルト: 10)。レコードサイズに対する倍率を指定します。
- **例**: `COB_FILE_SEQ_BUFFER_SIZE=100`
- **用途**: SEQUENTIALおよびLINE SEQUENTIALファイルの読み書きパフォーマンスを調整できます。実際のバッファサイズは `COB_FILE_SEQ_BUFFER_SIZE * record_max` バイトとなります。0を指定するとバッファリングが無効になります。

#### COB_FILE_SEQ_WRITE_BUFFER_SIZE(非推奨)

非推奨です。代わりに `COB_FILE_SEQ_BUFFER_SIZE` を使用してください。

後方互換性のために残されています。`COB_FILE_SEQ_BUFFER_SIZE` が設定されていない場合にフォールバックとして同じ効果で使用されます。

- **値**: 0以上の整数(デフォルト: 10)
- **例**: `COB_FILE_SEQ_WRITE_BUFFER_SIZE=100`
- **用途**: 書き込みパフォーマンスを調整できます。

#### COB_IO_ASSUME_REWRITE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public class CobolUtil {
/** TDOD: 準備中 */
public static Calendar cal;

/** TDOD: 準備中 */
public static int fileSeqWriteBufferSize = 10;
/** 順編成ファイルの読み書きバッファサイズ(レコード数単位) */
public static int fileSeqBufferSize = 10;

/** DISPLAY/ACCEPT文によるデータ出力時のエンコーディング */
public static CobolEncoding terminalEncoding = CobolEncoding.SHIFT_JIS;
Expand Down Expand Up @@ -345,11 +345,18 @@ public static void cob_init(String[] argv, boolean cobInitialized) {
CobolUtil.nibbleCForUnsigned = true;
}

s = System.getenv("COB_FILE_SEQ_WRITE_BUFFER_SIZE");
s = CobolUtil.getEnv("COB_FILE_SEQ_BUFFER_SIZE");
if (s == null) {
s = CobolUtil.getEnv("COB_FILE_SEQ_WRITE_BUFFER_SIZE");
}
if (s != null) {
int size = Integer.parseInt(s);
if (size >= 0) {
CobolUtil.fileSeqWriteBufferSize = size;
try {
int size = Integer.parseInt(s);
if (size >= 0) {
CobolUtil.fileSeqBufferSize = size;
}
} catch (NumberFormatException ignored) {
// ignore invalid value
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1243,9 +1243,8 @@ public int open_(String filename, int mode, int sharing) throws IOException {
}
if ((this.organization == COB_ORG_SEQUENTIAL
|| this.organization == COB_ORG_LINE_SEQUENTIAL)
&& (mode == COB_OPEN_OUTPUT || mode == COB_OPEN_EXTEND)
&& CobolUtil.fileSeqWriteBufferSize > 0) {
this.file.prepareWriteBuffer(CobolUtil.fileSeqWriteBufferSize * this.record_max);
&& CobolUtil.fileSeqBufferSize > 0) {
this.file.prepareBuffer(CobolUtil.fileSeqBufferSize * this.record_max);
}
return 0;
}
Expand Down
Loading
Loading