Information Catalog Manager Programming Guide and Reference

FLGCreateReg

Creates registration information in the information catalog for an object type.

This API call does not create the object type itself; it registers the object type so that the object type can be created. The registration information that FLGCreateReg stores in the information catalog includes registration values that describe the object type.

You can register 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  FLGCreateReg( PFLGHEADERAREA   pObjRegStruct,
                                PSZ              pszIconFileID,
                                PSZ              pszObjTypeID,
                                PFLGEXTCODE      pExtCode );

Parameters

pObjRegStruct (PFLGHEADERAREA) -- input
Points to the input structure that contains the property specifications and values of the new object type registration.

pszIconFileID (PSZ) -- input
Contains the drive, directory path, and file name of the file that contains the icon for the new object type registration. If this parameter is NULL, then no icon is associated with the new object type registration.

pszObjTypeID (PSZ) -- output
Points to the 6-character, system-generated unique identifier (object type ID) of the registered object type.

This returned ObjTypeID is used by other API calls to identify the object type. It is set to NULL if the object type is not registered successfully.

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 FLGCreateReg, you must define the input structure shown in Figure 50. This structure contains the header area, the definition area, and the object area.

Figure 50. FLGCreateReg input structure


Figure FLAA2005 not displayed.

In the input structure, you must specify these six properties in the definition area in the order shown.

If you are using a version of the Information Catalog Manager other than English, the names of these required properties are translated, and are returned in the output structure of FLGInit.

Table 15

Table 15. Properties required for object type registrations
Property short name Property name1 Description Specify value in object area?
NAME EXTERNAL NAME OF OBJ TYPE 80-byte name of the object type; can be later modified. Required.
PTNAME PHYSICAL TYPE NAME 30-character name of the actual table in the information catalog that contains the object type. Optional; default value is the value for DPNAME.
DPNAME DP NAME 8-character short name for the object type. You must set this value using FLGCreateReg.

Required.

CREATOR CREATOR 8-character user ID of the administrator who creates the object type. No; the Information Catalog Manager sets this value when FLGCreateType is issued for the object type.
UPDATEBY LAST CHANGED BY 8-character user ID of the administrator who last modified the object type. No; the Information Catalog Manager sets this value when FLGAppendType is issued for the object type.
UPDATIME LAST CHANGED DATE AND TIME 26-character time stamp of the last date and time the object type was modified. No; the Information Catalog Manager sets this value when FLGCreateType or FLGAppendType is issued for the object type.
Note:
  1. The property names in this column apply to English versions of the Information Catalog Manager; if you are using a translated version of the Information Catalog Manager, the property name will also be translated.

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

Usage

Restrictions

Input requirements

Header area:

All of the information shown in the header record in Figure 50 is required.

Definition area:

  • The definition area must contain definitions for each of the six registration properties shown in Figure 50. The definitions for each of these registration properties, except translated property names (see Table 15), must be specified exactly as shown.
  • Each required property name (bytes 0-80 for each property) could be translated from the English property name shown in Figure 50 into any of the supported national languages. The translation of the names of these required properties is returned in the output structure of FLGInit.

Object area:

  • For properties defined with an S value in byte 126, leave the values in the object area blank; the Information Catalog Manager ignores any specified values for these properties because the system generates these values when you create or append the object type. These properties are CREATOR, UPDATEBY, and UPDATIME.
  • Rules for the PTNAME:
    • The PTNAME of the object type must be unique within the Information Catalog Manager catalog.
    • The Information Catalog Manager maximum length for the value of PTNAME is FLG_PTNAME_LEN (30); however, database constraints can shorten the maximum length in your information catalog environment. See the Information Catalog Manager Administration Guide for more information about setting this maximum.
    • If the number of significant characters of the PTNAME, not including trailing blanks, exceeds the maximum allowed for your environment (the value of STOR ENVSIZE returned by FLGInit), the registration request is rejected.
    • Specifying the PTNAME is optional. If you do not specify the PTNAME, then the Information Catalog Manager sets it to the value of DPNAME by default.
    • The restrictions for PTNAME are:
      • Must be SBCS only
      • The first character must be an English alphabetic character (A through Z or a through z), @, #, $
      • 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
      • The PTNAME cannot be any of the SQL reserved words for your database
  • The DPNAME of the object type:
    • Must be unique among all the information catalogs in the organization
    • 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
    • The NAME value must be unique within the local information catalog.

Output information

The system-generated object type identification is returned in the output parameter pszObjTypeID. When the Information Catalog Manager returns this number, you use this number in subsequent calls, such as FLGDeleteReg or FLGGetReg, to uniquely identify the object type registration.

Controlling updates to your information catalog

If FLGCreateReg does not complete successfully, you should include a call to FLGRollback (see FLGRollback). Do not call FLGCommit after FLGCreateReg completes successfully--wait until you complete a call to FLGCreateType.

Examples

Figure 51 shows the C language code required to issue the FLGCreateReg call. This sample code creates registration information for a new object type called MYIMAGE that belongs to the Elemental category.

Figure 51. Sample C language call to FLGCreateReg

 
 APIRET         rc;                  // Declare reason code
 PFLGHEADERAREA pObjRegStruct;       // Pointer to the input structure
 UCHAR          pszIconFileID[FLG_ICON_FILE_ID_MAXLEN+1]; // Path/File name of ICON
 UCHAR          pszObjTypeID[FLG_OBJTYPID_LEN+1];      // Returned system-generated ID
 FLGEXTCODE     ExtCode = 0;       // Declare extended code
   .
   .  /* creating pObjRegStruct object Type Registration by providing values  */
   .
 strcpy (pszIconFileID,"Y:\\FLGICON2.ICO");
 
 rc = FLGCreateReg (pObjRegStruct,   // input structure
                  pszIconFileID,     // Path/File name of file containing the ICON
                  pszObjTypeID,      //  Returned id of registered object type
                  &ExtCode);              // Pass extended code pointer
 

Figure 52 shows the input structure for the FLGCreateReg call. The pObjRegStruct pointer points to this structure, which carries the property and value information needed for registration of the new object type.

Figure 52. Sample input structure for FLGCreateReg


Figure FLAA2006 not displayed.

Special error handling

If FLGCreateReg 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, FLGCreateReg 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, FLGCreateReg 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 FLGCreateReg error, include FLGCommit calls in your program just before this call.


[ Top of Page | Previous Page | Next Page ]