In this example, the segmented file consists of a host segment limited to 500 MB, a second segment limited to 1 GB, and a final segment unlimited in size. However, the file will not be a HUGE file, so the total size will be limited to 4 GB.
XCREblk creblk = {
0, /* FILEPOS8 is NOT on: not HUGE */
500, /* 1st segment size is 500MB */
0, /* no specified file size limit (HW) */
0, /* no specified file size limit (LW) */
104857600, /* file created at size 100MB */
10485760, /* file extend 10MB at a time */
3, /* maximum number of segments is 3 */
0 /* no disk full threshold */
};
SEGMDEF segdef[2] = {
{"d:dataseg.2",1024}, /* 1024MB = 1GB size limit */
{"e:dataseg.3",0} /* no limit on segment size */
};
/* create data file, specifying the host segment size */
CreateDataFileXtd8(
10, /* data file number */
"c:hostseg.dat", /* data file name */
384, /* record length */
0, /* creblk specifies large extent sizes */
TRNLOG, /* support transaction processing */
0L, /* no permission mask */
NULL, /* no group ID */
NULL, /* no password */
&creblk); /* pointer to extended create block */
/* specify definitions for the two other segments */
SetFileSegments(
10, /* data file number */
1, /* one active segment (the host segment) */
2, /* two segment definitions to be passed */
segdef); /* pointer to the segment definitions */