private void setAttributesFromUsage ( final Usage usage ) { switch ( usage ) { case BINARY : _cobolType = CobolTypes . BINARY_ITEM ; _xsdType = XsdType . INTEGER ; break ; case NATIVEBINARY : _cobolType = CobolTypes . NATIVE_BINARY_ITEM ; _xsdType = XsdType . INTEGER ; break ; case SINGLEFLOAT : _cobolType = CobolTypes . SINGLE_FLOAT_ITEM ; _xsdType = XsdType . FLOAT ; _minStorageLength = 4 ; break ; case DOUBLEFLOAT : _cobolType = CobolTypes . DOUBLE_FLOAT_ITEM ; _xsdType = XsdType . DOUBLE ; _minStorageLength = 8 ; break ; case PACKEDDECIMAL : _cobolType = CobolTypes . PACKED_DECIMAL_ITEM ; _xsdType = XsdType . DECIMAL ; break ; case INDEX : _cobolType = CobolTypes . INDEX_ITEM ; _xsdType = XsdType . HEXBINARY ; _minStorageLength = 4 ; break ; case POINTER : _cobolType = CobolTypes . POINTER_ITEM ; _xsdType = XsdType . HEXBINARY ; _minStorageLength = 4 ; break ; case PROCEDUREPOINTER : _cobolType = CobolTypes . PROC_POINTER_ITEM ; _xsdType = XsdType . HEXBINARY ; _minStorageLength = 8 ; break ; case FUNCTIONPOINTER : _cobolType = CobolTypes . FUNC_POINTER_ITEM ; _xsdType = XsdType . HEXBINARY ; _minStorageLength = 4 ; break ; case DISPLAY : _cobolType = CobolTypes . ALPHANUMERIC_ITEM ; _xsdType = XsdType . STRING ; break ; case DISPLAY1 : _cobolType = CobolTypes . DBCS_ITEM ; _xsdType = XsdType . STRING ; break ; case NATIONAL : _cobolType = CobolTypes . NATIONAL_ITEM ; _xsdType = XsdType . STRING ; break ; default : _log . error ( "Unrecognized usage clause " + toString ( ) ) ; } }
Derive XML schema attributes from a COBOL usage clause . This gives a rough approximation of the XSD type because the picture clause usually carries info that needs to be further analyzed to determine a more precise type . If no usage clause we assume there will be a picture clause .