Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Get This API gets the current position of a multiple-occurrence data structure.

...

  1. Data structure
Return value

This API returns Numeric value representing the current occurrence in the data-structure.position

Example
Code Block
languagejavascript
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()