Information Catalog Manager Programming Guide and Reference

FLGCreateInst

Creates a new instance of the specified object type.

Authorization

Administrator or authorized user (all object types); user (Comments object type only)

Syntax



APIRET  APIENTRY    FLGCreateInst( PFLGHEADERAREA   pObjInstStruct,
                                   PSZ              pszFLGID,
                                   PFLGEXTCODE      pExtCode );

Parameters

pObjInstStruct (PFLGHEADERAREA) -- input
Points to the input structure that contains the property specifications and values for the new object instance.

pszFLGID (PSZ) -- output
Points to the 16-character, system-generated ID for the new object instance.

Characters 1-6 of this ID identify the object type of this instance; these characters have the same value as bytes 33 through 38 in the input structure header record.

Characters 7-16 of this ID are the system-generated unique instance identifier.

This returned pszFLGID is used by other API calls when referring to this instance.

pszFLGID is set to NULL if the FLGCreateInst API call is not successful.

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

Figure 47. FLGCreateInst input structure


Figure FLAA2003 not displayed.

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

Usage

Prerequisites

Restriction

If you are not authorized to perform object management tasks and you are creating a Comments object instance, you must not change the Creator property value to be other than your logged-on user ID.

Input requirements

Header area:

All of the fields in the header record are required.

Definition area:

The definition area can contain any or all of the defined properties of the object type for which you are creating an object instance. The following rules apply:

  • You must first specify all five of the Information Catalog Manager required properties in the following order: OBJTYPID, INSTIDNT, NAME, UPDATIME, and UPDATEBY.
  • You must specify all other required (indicated by an R in byte 126) properties.
  • The Information Catalog Manager compares all specified properties to the object type definition for the following specifications:

    Data type

    Data length

    Property short name

    Value flag

    UUI number

Object area:

  • Values for the following properties must be specified:

    OBJTYPID
    Must be same as Header area, bytes 33 through 38.

    NAME
    Must not be all blank.

    The value of the property NAME does not have to be unique within an object type; you can successfully create duplicate entries. However, when you create duplicate entries, specify some descriptive information as the value of another property to differentiate one object instance from another.

  • Values for the following properties are system-generated and must be left blank:
    • INSTIDNT
    • UPDATIME
    • UPDATEBY
  • If a value is not specified for a required property (defined with an R in column 126 of the definition area) the appropriate space in the object area must be initialized as follows:
    Data type Initialized to
    CHAR Not-applicable symbol followed by blanks for the length of the property
    TIMESTAMP Set to the largest allowable value: 9999-12-31-24.00.00.000000

    VARCHAR
    LONG VARCHAR

    00000001; the length field, specified in 8 bytes, followed by the not-applicable symbol
  • If a value is not specified for an optional property, the appropriate space in the object area must be initialized as follows:
    Data type Initialized to

    CHAR
    TIMESTAMP

    Blanks for the entire length of the property

    VARCHAR
    LONG VARCHAR

    00000000; the length field, specified in 8 bytes, must be present and set to zero
  • The Information Catalog Manager removes all trailing blanks of values in the object area with data types of VARCHAR or LONG VARCHAR, and the length of that area is automatically adjusted.
  • The object type in the HANDLES property (when specified) must exist in the information catalog and be a non-Program object type. Any properties specified in the PARMLIST property must be a property of the object type specified in HANDLES. For more information, see Setting up Programs objects to start programs.
  • Each object instance must have unique values for the UUI properties. If an object instance already exists with the same UUI values as the object instance being created, an error will occur.

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 FLGCreateInst completes successfully. If FLGCreateInst does not complete successfully, you should include a call to FLGRollback (see FLGRollback).

Examples

Figure 48 shows the C language code required to call FLGCreateInst.

This sample code creates a new instance of a Grouping object type.

Figure 48. Sample C language call to FLGCreateInst

 
 APIRET          rc;                    // Declare reason code
 PFLGfEADERAREA  pObjInstStruct;        // Pointer to the input structure 
 UCHAR           pszFLGID[FLG_ID_LEN+1]; // Returns system-generated ID
 FLGEXTCODE      ExtCode = 0;                // Declare extended code
   .
   /* creating pObjInstStruct object Instance by providing property values */
   .
   .
 
 rc = FLGCreateInst (pObjInstStruct,    // input structure
                     pszFLGID,          // Returned ID of created instance
                     &ExtCode);              // Pass pointer to extended code
 

Figure 49 shows the input structure for the FLGCreateInst call. The pObjInstStruct parameter points to this structure, which carries the property and value information for the new object instance.

Figure 49. Sample input structure for FLGCreateInst


Figure FLAA2004 not displayed.

Notes:

  1. Bytes 33 through 38 of the header record contain the object type identifier (000033) that was generated by the FLGCreateReg when this object type was registered. The same value must be specified for the OBJTYPID in the object area. In this example, it appears as the first value in the object area.

  2. This object type contains the first five required properties (OBJTYPID, INSTIDNT, NAME, UPDATIME, UPDATEBY) plus three more properties that were added by the user.


[ Top of Page | Previous Page | Next Page ]