---
name: "sdsetdimval_comp"
section: "3hdf"
platform: "linux"
package: "libhdf4g-dev"
version: "4.0.2-6"
release: "Debian 2.0 (Hamm)"
platforms: ["linux"]
url: "https://new.carta.tech/sdsetdimval_comp"
---

# sdsetdimval\_comp(3hdf)

**#include \<mfhdf.h\>**

- **intn SDsetdimval\_comp(int32 dimid, intn comp\_mode)**

  *dimid*\
   	**IN: dimension ID returned from SDgetdimid**\
   *comp\_mode*\
           **IN: backward compatibility:**\
                  **SD\_DIMVAL\_BW\_COMP -- compatible**\
                  **SD\_DIMVAL\_BW\_INCOMP -- incompatible.**

- **Purpose**

  **Set the backward compatibility mode of a dimension record for** **next write of that dimension.**

- **Return value**

  **Returns SUCCEED if no error, else FAIL.**

- **Description**

  **SDsetdimval sets the backward compatibility of a dimension record** **for the next write of that dimension. The default mode is backward**  **compatible for HDF4.0b2 and will be changed to incompatible in**  **HDF4.1.**

  **Unlimited dimension is always backward compatible. SDsetdimval\_comp**  **takes no action for unlimited dimension.**

  **In HDF4.0b1 and previous releases a dimension record was represented** **by a vgroup which contains a vdata. The vdata has \<dimension size\>**  **number of elements and the values of the elements are fake values** **from 0, 1, 2, ... , \<dimension size\> -1. The vdata has class**  **"DimVal0.0".**

  **Starting from HDF4.0b2 a new version of dimension vdata will be**  **created, which has only 1 element and the value of that element**  **is the \<dimension size\>. The new version of vdata has class**  **"DimVal0.1".**

  **If SD\_DIMVAL\_BW\_INCOMP is used to set incompatible mode,**  **only the vdata of "DimVal0.1" will be written to the hdf file.**  **The dimension vgroup has only the "DimVal0.1" vdata.**  **Tools using HDF4.0b1 or older version can not understand this**  **version of dimension value, therefore can not read the SDS.**

  **SDsetdimval\_comp(dimid, SD\_DIMVAL\_BW\_COMP) sets compatible mode.** **Both vdatas of "DimVal0.0" and of "DimVal0.1" will be written to**  **the hdf file. The dimension vgroup has two vdatas, "DimVal0.0"**  **and "DimVal0.1". Tools compiled with HDF4.0b1 or older HDF**  **libraries can read dimension information from "DimVal0.0"**  **dimension vdata.**

  **SDsetdimval\_comp can be called any time between SDstart and SDend.** **The current call overrides the mode set by previous calls.**

- **Examples**

  **Assuming the following,**

  ```
          dimid=SDgetdimid(sdsid, 0);
          status = SDsetdimval_comp(dimid, SD_DIMVAL_BW_INCOMP);
  ```

- **FORTRAN**

  **integer function sfsdmvc(dimid, compmode)**\
   **integer dimid, compmode**

- **See Also**

  **SDisdimval\_bwcomp(3)**
