index.js
//Transform input and output ProgramParameter data to js object value
Transform input and output ProgramParameter data to js object value
Transform input and output ProgramParameter data to js object value
generateObjectFromProgramParameter(objModel, param) {
		var res=null;
		var data=param.getOutputDataSync();
		if(objModel.kind == 'in') {
			data=param.getInputDataSync();
		}
		if(data!=null) {
			var val=java.newArray('byte',Array.from(data));
			switch(objModel.type) {
				case "text" : res=new AS400Text(objModel.size).toObjectSync(val).trim(); break;
				case "bin4" : res=new AS400Bin4().toObjectSync(val); break;
				case "zoned" : res=new AS400ZonedDecimal(objModel.size, objModel.precision).toObjectSync(val); break;
				case "packed" : res=new AS400PackedDecimal(objModel.size, objModel.precision).toObjectSync(val); break;
				case "array" : 
					var size=objModel.size;
					if(this.returnObj[objModel.nboccurField]!=null) {
						size=parseInt(this.returnObj[objModel.nboccurField]);
					}
					var objectArray=new AS400Array(this.generateAs400StructureFromArrayObjectStruct(objModel.struct), size).toObjectSync(val); 
					res=new Array();
					for(var i = 0 ; i < objectArray.length ; i++) {
						res.push(this.generateDataObjectFromStructAndObject(objModel.struct, objectArray[i]));
					}
					break;
				case "struct" : 
					var obj=this.generateAs400StructureFromArrayObjectStruct().toObjectSync(val);
					res=this.generateDataObjectFromStructAndObject(objModel.struct, obj);
					break;
			}
		}
		return res;
	}
generateObjectFromProgramParameter ( objModel , param ) { var res = null ; var data = param . getOutputDataSync ( ) ; if ( objModel . kind == 'in' ) { data = param . getInputDataSync ( ) ; } if ( data != null ) { var val = java . newArray ( 'byte' , Array . from ( data ) ) ; switch ( objModel . type ) { case "text" : res = new AS400Text ( objModel . size ) . toObjectSync ( val ) . trim ( ) ; break ; case "bin4" : res = new AS400Bin4 ( ) . toObjectSync ( val ) ; break ; case "zoned" : res = new AS400ZonedDecimal ( objModel . size , objModel . precision ) . toObjectSync ( val ) ; break ; case "packed" : res = new AS400PackedDecimal ( objModel . size , objModel . precision ) . toObjectSync ( val ) ; break ; case "array" : var size = objModel . size ; if ( this . returnObj [ objModel . nboccurField ] != null ) { size = parseInt ( this . returnObj [ objModel . nboccurField ] ) ; } var objectArray = new AS400Array ( this . generateAs400StructureFromArrayObjectStruct ( objModel . struct ) , size ) . toObjectSync ( val ) ; res = new Array ( ) ; for ( var i = 0 ; i < objectArray . length ; i ++ ) { res . push ( this . generateDataObjectFromStructAndObject ( objModel . struct , objectArray [ i ] ) ) ; } break ; case "struct" : var obj = this . generateAs400StructureFromArrayObjectStruct ( ) . toObjectSync ( val ) ; res = this . generateDataObjectFromStructAndObject ( objModel . struct , obj ) ; break ; } } return res ; }
Transform input and output ProgramParameter data to js object value
Transform input and output ProgramParameter data to js object value