pjs.getOccur()
This API gets the current position of a multiple-occurrence data structure.
Parameter
Data structure
Return value
Numeric value representing the current occurrence position
Example
pjs.define("ds", { type: 'data structure', qualified: true, occurs: 2, elements: {
"sub1": { type: 'char', length: 1 },
"sub2": { type: 'char', length: 1 }
}});
pjs.define("test1", { type: 'integer', length: 3, decimals: 0 });
pjs.define("test2", { type: 'integer', length: 3, decimals: 0 });
pjs.define("test3", { type: 'integer', length: 3, decimals: 0 });
test1 = pjs.getOccur(ds);
pjs.setOccur(ds, pjs.getOccur(ds) + 1);
test2 = pjs.getOccur(ds);
pjs.setOccur(ds, pjs.getOccur(ds) - 1);
test3 = pjs.getOccur(ds);
RPG EquivalentÂ
OCCUR, %OCCUR()