...
Code Block |
---|
|
pjs.define("arr", { type: 'char', length: 10, dim: 3, initValue: '0123456789' }); |
Data
...
structures
When you declare a field of data-structure type, this means you need to provide an 'elements' object. Each key in this object will be the name of the subfield and the value of this key will be another config element. If a data-structure is qualified, the data-structure will act similar to a JavaScript object.
Example 5:
...
Data structure with two subfields (non-qualified)
Code Block |
---|
|
pjs.define("someDS", { type: 'data structure', elements: {
"Field1": { type: 'char', length: 10, initValue: '1' },
"Field2": { type: 'char', length: 10 }
}});
Field2 = '2'; |
Example 6:
...
Data structure array, qualified and two subfields
Code Block |
---|
|
pjs.define("dsarr", { type: 'data structure', qualified: true, dim: 2, elements: {
"field1": { type: 'char', length: 1 },
"field2": { type: 'char', length: 1 }
}});
dsarr[1].field1 = '1';
dsarr[1].field2 = '2';
dsarr[2].field1 = '3';
dsarr[2].field2 = '4'; |
...
Code Block |
---|
|
pjs.define("myNumber", {
type: 'packed decimal',
length: 10,
decimals: 0,
nullable: true
});
//Set value to 5
myNumber = 5;
//Set null-indicator to true
myNumber = null;
//Set value to 10, sets the null-indicator to false
myNumber = 10;
//Set null-indicator to true
pjs.nullInd(myNumber, true); |