Search code examples
ibm-midrangerpglerpg

View value of variables in some kind of output in IBM RPG


I am trying to learn IBM RPG and rewrite a program for my employer. I need a way to see whether my variables are getting assigned to the values i expect them too but i dont know how to output something to my screen to just display the values. Is there a way to send a break message containing the variables in the RPG program, not the CL program? Thanks


Solution

  • Use the display (DSPLY) op-code
    http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzasd/sc092508935.htm%23zzdsply

    dsply 'Hello World';
    dsply 'value is:' + %char(myNumber);
    dsply myString;
    
    //the above don't pause, you'll see the message pop up and go away,  
    // but it will be in the joblog.  If you want to wait:
    dsply myString '*EXT' myResponse;