Information Catalog Manager Programming Guide and Reference

FLGCreateType

Creates a new user-defined object type.

The Administrator can create a type for any category except the Program and Attachment categories, because these categories can contain only the Programs and Comments types respectively, which the Information Catalog Manager automatically creates in the information catalog.

Authorization

Administrator

Syntax



APIRET  APIENTRY   FLGCreateType( PFLGHEADERAREA   pObjTypeStruct,
                                  PFLGEXTCODE      pExtCode );

Parameters

pObjTypeStruct (PFLGHEADERAREA) -- input
Points to the input structure that contains the specifications of the properties for this object type.

pExtCode (PFLGEXTCODE) -- output
Points to an extended code associated with the reason code. See Appendix D, Information Catalog Manager reason codes to see if a meaningful extended code is associated with the returned reason code.

Reason code (APIRET)
Represents the execution result of this API call.

See Appendix D, Information Catalog Manager reason codes for an explanation of the returned reason codes.

Input structure

To use FLGCreateType, you must define the input structure shown in Figure 53. This structure contains only the header area and the definition area.

Figure 53. FLGCreateType input structure


Figure FLAA2007 not displayed.

For an explanation of the meanings of the byte offsets, see The Information Catalog Manager API input structure.

Usage

Prerequisites:

Before you can call the FLGCreateType API to create a new object type, you need to call the FLGCreateReg API to register this new type.

You need to specify the object type identifier returned by the FLGCreateReg API when you call FLGCreateType.

Input requirements:

Header area

The object type that you specify in the header of the input structure must be registered, but not yet created.

Definition area

  • The first five properties defined in the definition area must be for these five Information Catalog Manager required properties: OBJTYPID, INSTIDNT, NAME, UPDATIME, and UPDATEBY. If these properties are not in this order, the create will fail.

    OBJTYPID
    Unique system-generated identifier (ID) for the object type

    INSTIDNT
    Unique system-generated ID for an object instance

    NAME
    User-specified name for an object

    UPDATIME
    System-generated time stamp of when the object was last updated

    UPDATEBY
    System-generated user ID of the administrator or user who last updated the object
  • Rules for the required properties:
    • The data type, length, property short name, and value flag (vf) of each of these required properties are fixed and must be specified exactly as shown in Figure 53.
    • The UUI sequence (us) is fixed as blank for each of the four system-generated (S) properties, but can be 1, 2, 3, 4, 5, or blank for the NAME property.
    • The 80-byte property name is fixed, but it is translated for the supported national language versions. The translation of the names of these required properties is returned in the output structure of FLGInit.
  • The total number of properties in the definition must not exceed FLG_MAX_PROPERTIES (255).
  • The total number of properties in the definition that have a data type of LONG VARCHAR must not exceed the Information Catalog Manager limit of FLG_MAX_NUM_LONG_VARCHARS (14).
  • Rules for the UUI:
    • At least one UUI property must be defined for each object type created.
    • Within the object type, you must start the UUI numbering with 1 and not skip any values. For example, in an object type, a set of UUI sequence values of 1, 2, and 3 is valid, but 2, 3, and 5 is not.
    • You cannot specify the same UUI sequence number more than once in the same object type.
    • Any property specified as a UUI must not exceed 254 bytes in length.
    • Any property specified as a UUI must be a required property ("R" value-flag, column 126).
    • Any property specified as a UUI (column 127) must not have a data type of LONG VARCHAR.
    • You should define the UUI properties so that each instance of this object type can be uniquely identified. You should be able to use these properties to identify a single instance of this object type, even if instances of this object type exist in several related information catalogs.
  • In addition to the required properties, the user can add more properties to tailor the created object type to the needs of the business.

    The order of these additional properties in the definition area does not matter because the Information Catalog Manager uses the property short names in bytes 118-125 as a key to ensure that all required properties are always specified. However, the order of the properties in the definition area for the FLGCreateType call is the order in which the Information Catalog Manager returns the properties to the calling application.

  • New property names must be unique within the object type.
  • New property short names must be unique within the object type.
  • If a property belongs to an object type that is shared among two or more related information catalogs, and you plan to import and export the Information Catalog Manager data to share information, then the values for data type, data length, property short name, value flag, and UUI sequence must be same as for the same object type in the other information catalogs. The property name can be different.
  • Property short names must follow these rules:
    • Must be (SBCS) only.
    • The first character must be an English alphabetic character (A through Z or a through z), @, #, or $.
    • Characters other than the first can be an English alphabetic character (A through Z or a through z), 0 through 9, @, #, $, or _ (underscore).
    • No leading or embedded blanks are allowed.
    • Cannot be any of the SQL reserved words for the current database.
  • The total length of all of the properties for an object type must not exceed the row limit for the underlying database. See the documentation for the underlying database for information about calculating the row length.

Controlling updates to your information catalog

To keep your program as synchronized as possible with your information catalog, you should include a call to FLGCommit (see FLGCommit) after FLGCreateType completes successfully. If FLGCreateType does not complete successfully, you should include a call to FLGRollback (see FLGRollback).

Examples

Figure 54 shows the C language code required to issue the FLGCreateType API call.

This sample code creates a new object type. This new object type is of the Elemental category, as indicated by E in the structure header area, with an object type ID of 000044. Along with the Information Catalog Manager-required properties, this object type contains three additional required properties: imagecolor, imagesize, and description.

Figure 54. Sample C language call to FLGCreateType

 
 APIRET           rc;              // Declare reason code
 PFLGHEADERAREA   pObjTypeStruct;  // Pointer to the input structure
 FLGEXTCODE       ExtCode=0;            // Declare extended code
   .
 
   .  /* creating pObjTypeStruct object type by */
      /* providing object type's properties  */
 
   .
 
 rc = FLGCreateType (pObjTypeStruct,
                     &ExtCode);         // Pass pointer to extended code
 

Figure 55 shows the input structure for the FLGCreateType API call. The pObjTypeStruct pointer points to the structure that carries the property information for the new object type.

Figure 55. Sample input structure for FLGCreateType


Figure FLAA2008 not displayed.

Special error handling

If FLGCreateType encounters a database error, the Information Catalog Manager rolls back the database to the last commit that occurred in your program.

If this rollback is successful, FLGCreateType returns the reason code FLG_SEVERR_DB_AUTO_ROLLBACK_COMPLETE. The extended code contains the SQL code for the database error that prompted the Information Catalog Manager to roll back the database.

Attention: If this rollback fails, FLGCreateType returns the reason code FLG_SEVERR_DB_AUTO_ROLLBACK_FAIL. The extended code contains the SQL code for the database error that prompted the Information Catalog Manager to roll back the database. In this case, your database could have severe integrity problems, and your program should call FLGTerm to exit the Information Catalog Manager.

Depending on the state of your database, you might need to recover your database using your backed-up database files. For more information about recovering your information catalog database, see the Information Catalog Manager Administration Guide.

To prevent the Information Catalog Manager from removing uncommitted changes that are not related to the FLGCreateType error, include FLGCommit calls in your program just before the call to FLGCreateReg for the object type you are creating.


[ Top of Page | Previous Page | Next Page ]