pjs.move()



The pjs.move() API allows you to move values from one field to another, left or right adjusted, without any type checking. By default, the value is right adjusted in the target field.

Parameters
  1. Source - where you are taking data from

  2. Target - where you are moving data into

  3. Date/Time/Timestamp format (optional)

  4. Pad (optional) - if passed in as true, the Target field is first cleared.

  5. Adjust left (optional) - pass a value of true to left adjust; otherwise, the value is right adjusted.

Examples
Example 1: char -> char
pjs.define("source", { type: 'char', length: 5, initValue: 'bbbbb' }); pjs.define("unpadded", { type: 'char', length: 10, initValue: 'aaaaaaaaaa' }); pjs.move(source, unpadded); return unpadded; // "aaaaabbbbb"
Example 2: char -> char (padding)
pjs.define("source", { type: 'char', length: 5, initValue: 'bbbbb' }); pjs.define("padded", { type: 'char', length: 10, initValue: 'aaaaaaaaaa' }); pjs.move(source, padded, '', true); return padded; // " bbbbb"
Example 3: packed(5:2) -> char
pjs.define("char1", { type: 'char', length: 10, initValue: 'abcdefgh' }); pjs.define("pkd1", { type: 'packed decimal', length: 5, decimals: 2, initValue: 123.45 }); pjs.move(pkd1, char1); return char1; // "abcde12345"
Example 4: date(*YMD) -> integer (as *USA)
Example 5: const -> boolean
Example 6: date -> zoned (*ISO, *USA, *EUR, *JIS)



RPG Equivalent

MOVE