# ISMBLD

> [HTML Version](ismbld_sbx.htm)

_Updated September 2026_

**xcall ISMBLD, opflags, status, fspec, keysiz, keypos, recsiz, reccnt \{, idadev, infile, maxrecs, idxblksiz, idxlvls, extrablks, exprecs\}**

ISMBLD.SBX, the subroutine version of ISMBLD.LIT, may be more convenient for building files than having to first generate a CMD file. The file is actually identical to ISMBLD.LIT which is why it has the same version (and hash, for that matter). It determines whether to act as a subroutine or LIT command based on how it is called. It was introduced in A-Shell as part of an ISAM overhaul that vastly improved [ISAM Performance](isamperformance.md), which see for an in-depth discussion of performance issues. 

**Parameters**

_opflags_  ([Num](num.md))  \[in\]

Operation flags (see IBF\_xxx in [AHSINC:ISMDEF.BSI](https://bitbucket.org/microsabio/soslib/src/master/907016/ismdef.bsi))

| **Symbol** | **Value** | **Description** |
|------|------|------|
| IBF\_SECONDARY | \&h0002 | build secondary index |
| IBF\_AUTOBLKLVL | \&h0004 | Auto calculate optimum index block size and levels based on keysiz and maxrecs. |
| IBF\_EXISTING | \&h0008 | process existing file |
| IBF\_PROGRESS1 | \&h0100 | progress style 1 (% at cursor location) |




_status  _([Num](num.md))  \[out\]

Return status: 

| **Value** | **Description** |
|------|------|
| 0 | success |
| \-1 | param error |
| \-2 | load terminated in mid-record |
| \-3 | file doesn't exist (IBF\_EXISTING) |
| \-4 | file already exists |
| \-5 | load file doesn't exist |
| \-6 | expanded version/blocks size requires newer A |
| \-7 | main idx doesn't exist (for secondary load) |
| 30+ | erf values (during load) |




_fspec_  ([String](string.md))  \[in\]

File to create (no extension)

_keysiz_  ([Num](num.md))  \[in\]

size of key

_keypos_  ([Num](num.md))  \[in\]

key position

_recsiz_  ([Num](num.md))  \[in\]

record size

_reccnt_  ([Num](num.md))  \[in\]

number of records (initial allocation)

_idadev_  ([String](string.md))  \[in\]

IDA device (e.g. "DSK7:") if not same as IDX

_infile_  ([String](string.md))  \[in\]

Sequential file to load from, or name of main IDX if creating a secondary IDX

_maxrecs_  ([Num](num.md))  \[in\]

Expected / eventual number of records, used only to improve the auto-configuration/optimization of _idxblksiz_ and _idxlvls_ (IBF\_AUTOBLKLVL). Does not set any limitation on the actual maximum growth of the file. See Comments below.

_idxblksiz_  ([String](string.md))  \[in\]

IDX block size (default 512). Will be ignored (auto-calculated) if the IBF\_AUTOBLKLVL flag is set in opflags.

_idxlvls_  ([Num](num.md))  \[in\]

IDX levels (default 3). Will be ignored (auto-calculated) if the IBF\_AUTOBLKLVL flag is set in opflags.

_extrablks_  ([Num](num.md))  \[in\]

Extra IDX blocks (if omitted, use 50%). 0.05 - 1.00 = % x 100, e.g. 0.5 = add 50%)

_exprecs_  ([String](string.md))  \[in\]

Deprecated. Functions the same as _maxrecs_. If both _maxrecs_ and _exprecs_ are specified, the larger of the two will be used.

**Comments**

Although ISMBLD.SBX shares much of the same code as ISMBLD.LIT, it offers the option of allowing ISMBLD to auto-determine appropriate values for the IDX block size and levels, based on the key size and expected maximum records (while only allocating the file for the desired initial size). Use ISMDMP XXX /V afterwards to confirm the configuration.

Unless the [NOAUTOX](noautox.md) option is specified in the system parameters, ISAM files auto-expand as needed; _reccnt_ only affects the initial allocation, and _maxrecs_ only affects the optimization of the _idxblksiz_ and _idxlvls_ parameters. Although the DAT and IDX files will expand as needed, the organization of the IDX (_idxblksiz_ and _idxlvls_) will remain the same as when the file was created.

**See Also**

•	[ISMBLD.LIT](ismbld_lit.md)

•	[ISMDMP](ismdmp_lit.md).LIT

•	[ISMROK](ismrok_sbr.md)