1
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++Comments++++++++++++
DQty              S             11p 3 INZ(123.50)                                              
DQtyX             S             +1    LIKE(Qty)                                                
 *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

How can standalone variables be declared and sized relatively in fully-free RPG?

Here I want to declare QtyX as 12p3

jmarkmurphy
  • 11,030
  • 31
  • 59
ojay
  • 91
  • 6
  • 2
    This question is perfectly clear to an RPGLE developer. – Charles Aug 21 '23 at 13:37
  • 1
    The answer [per the manual](https://www.ibm.com/docs/en/i/7.4?topic=keywords-likename-length-adjustment) is `dcl-s QtyX like(Qty:1);` – Charles Aug 21 '23 at 13:41
  • 2
    typo, you need the `+` or `-` so `dcl-s QtyX like(Qty:+1);` – Charles Aug 21 '23 at 14:59
  • It's tough to convince stackoverflow sometimes. Thank you @Charles for supporting this Q and helping with the exact solution :) – ojay Aug 24 '23 at 18:00

1 Answers1

2

The answer per the manual is

dcl-s QtyX like(Qty:+1);

Charles
  • 21,637
  • 1
  • 20
  • 44