ITEM: AC8413L
Question on ClassSymbol for product class
Question:
ENV: RISC/6000 model
AIX version 3.2.5
DESC: Customer is trying to use the odm_ subroutines to query/
manipulate the 'product' class.
Customer has looked in InfoExplorer and it shows the first
argument should be a ClassSymbol with a type of Class. The
customer has found that when working with the 'product' class
this routine is not working correctly.
When using odm_close_class(product_CLASS) customer reports he
gets an ODM error of 5902.
Customer would like to know what is the class identifier for the
product_CLASS.
Action: According to /usr/include/odmi.h, a 5902 is a ODMI_MAGICNO_ERR
which indicates the class symbol does not identify a valid object
class.
The product_CLASS class symbol is not predefined for you like
CuAt_CLASS, CuDv_CLASS, and the others found in
/usr/include/sys/cfgodm.h. You must define the Class Symbol
yourself.
Here is a very small sample program that defines & initializes
the product_CLASS class symbol and prints out the structure for
the product class, including the elements and types for all
elements. Please note that custom coding assistance is
considered a Consult Line activity and this code should be used
as an example only. IBM does not provide technical support for
this code.
\#include\
\#include\
\#include\
main(int argc, char **argv)
{FILE *odmfile = fopen("./odmfile", "w");
struct Class *product_CLASS, *prod;
char odmtype[20];
int rc=0, i;
odm_initialize();
product_CLASS = odm_mount_class("product");
if ((int) product_CLASS == -1 || product_CLASS == NULL)
{ printf("odmerrno = %d\\n", odmerrno);
perror("getpdata: odm_mount_class"), exit(-1);
}
printf("Class name = %s\\n", product_CLASS->classname);
printf("Structure size = %d\\n", product_CLASS->structsize);
printf("Number of elements = %d\\n", product_CLASS->nelem);
for (i=0; i\nelem; i++)
{ switch ((product_CLASS->elem)[i].type)
{
case ODM_CHAR:
strcpy(odmtype,"ODM_CHAR");
break;
case ODM_LONGCHAR:
strcpy(odmtype,"ODM_LONGCHAR");
break;
case ODM_BINARY:
strcpy(odmtype,"ODM_BINARY");
break;
case ODM_SHORT:
strcpy(odmtype,"ODM_SHORT");
break;
case ODM_LONG:
strcpy(odmtype,"ODM_LONG");
break;
case ODM_LINK:
strcpy(odmtype,"ODM_LINK");
break;
case ODM_METHOD:
strcpy(odmtype,"ODM_METHOD");
break;
case ODM_VCHAR:
strcpy(odmtype,"ODM_VCHAR");
break;
case ODM_DOUBLE:
strcpy(odmtype,"ODM_DOUBLE");
break;
}
printf("Element[%d]:\\t%s\\t%s\\n", i, odmtype,
(product_CLASS->elem)[i].elemname);
}
odm_terminate();
}
To compile: cc -o getpdata getpdata.c -lodm
To run: getpdata
Output:
Class name = product
Structure size = 236
Number of elements = 15
Element[0]: ODM_CHAR lpp_name
Element[1]: ODM_CHAR comp_id
Element[2]: ODM_SHORT cp_flag
Element[3]: ODM_CHAR fesn
Element[4]: ODM_VCHAR name
Element[5]: ODM_SHORT state
Element[6]: ODM_SHORT ver
Element[7]: ODM_SHORT rel
Element[8]: ODM_SHORT mod
Element[9]: ODM_SHORT fix
Element[10]: ODM_CHAR ptf
Element[11]: ODM_SHORT media
Element[12]: ODM_CHAR sceded_by
Element[13]: ODM_VCHAR fixinfo
Element[14]: ODM_VCHAR prereq
Support Line: Question on ClassSymbol for product class ITEM: AC8413L
Dated: November 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:30
Comments or suggestions?
Contact us