Versions Compared

Key

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

...

  1. Numeric or Character Expression


Examples

Example 1: Int -> Float

Code Block
pjs.define("f1", { type: 'float', length: 8 });
 
f1 = pjs.parseFloat(12345);
 
return f1;
//1.2345E4
  


Example 2: Char -> Float


Code Block
pjs.define("c1", { type: 'char', length: 15, initValue: ' + 5 . 2 ' });
pjs.define("f1", { type: 'float', length: 8 });

fl1 = pjs.parseFloat(c1); 
 
return f1;
// 5.2E0

Example 3: Packed Decimal Expression


Code Block
pjs.define("p1", { type: 'packed decimal', length: 15, decimals: 0, initValue: 1 });
pjs.define("p2", { type: 'packed decimal', length: 25, decimals: 13, initValue: 3 });
pjs.define("result1", { type: 'packed decimal', length: 15, decimals: 5 });
 
result1 = pjs.parseFloat(p1 / p2);  
return result1;
//0.33333.
 


RPG Equivalent 

%FLOAT()