-1

I would like to put in comment several lines. In the documentation, we can use this -> (/*...*/)

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzajp/rzajpcommentsirpg.htm

I tried several times but it does not work.

/*
   dsply 'Enter your number1 please : ' '' Number1;
   dsply 'Enter your number2 please : ' '' Number2;
*/   

I am obliged to use two slashs on each line.

//dsply 'Enter your number1 please : ' '' Number1;
//dsply 'Enter your number2 please : ' '' Number2; 

I don't like. Do have you an idea please?

Thank you

2 Answers2

3

That only applies to embedded SQL, not regular RPG... from the manual:

Bracketed comments (/.../) are allowed within embedded SQL statements whenever a blank is allowed

David G
  • 3,940
  • 1
  • 22
  • 30
  • 1
    [RPG Reference](https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasd/coment.htm) for comments outside of an embedded SQL Statement – Charles Dec 29 '20 at 15:35
0

You could use /IF and /ENDIF to remove several lines from the compile:

/IF DEFINED(skip)
   dsply 'Enter your number1 please : ' '' Number1;
   dsply 'Enter your number2 please : ' '' Number2;
/ENDIF

If you actually want to use that code sometimes, use some more meaningful condition that you can define with the DEFINE parameter on the CRTBNDRPG or CRTRPGMOD command or with the /DEFINE directive.

/IF DEFINED(prompt_for_input)
   dsply 'Enter your number1 please : ' '' Number1;
   dsply 'Enter your number2 please : ' '' Number2;
/ENDIF
Barbara Morris
  • 3,195
  • 8
  • 10