Coding Question

25 pts.
Tags:
Coding
Hi, I came across this piece of code in one of the programs in our shops and I am stumped as to what it does. I am referring to the line after %parms condition. The interesting thing is I am getting two different values on var_ind after that operation on ProfoundUI vs Client access. *****************************************************************
* Program prototype
*****************************************************************
 D Program1 pr
 D Input1 likeds(ds1) options(*nopass)
 D Input2 1a options(*nopass)
 D var_ind S n inz(*off)
 if %parms = 2;
    var_ind = Input2 = 'A';
 endif;
I've only put in the relevant code here
 Please help!


Software/Hardware used:
RPGLE
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Does the existing code work? I personally have never seen that type of code in all my years of coding. I would hate to have to debug that. var_ind is being initialized to *off yet the code is trying to make it = to an alpha  'A'.
    131,645 pointsBadges:
    report
  • sam007
    The code does work however what I'd mentioned in the question is incorrect. I am getting two different values when I call the program from a menu VS the command line.

    I tried debugging and it doesn't give me any answers since it's simply assigning values and in the two different scenarios I mentioned above, the values are assigned differently. I will once again have a look at the entire code to see if there is some more useful part that I can add here.
    25 pointsBadges:
    report
  • sam007
    So.. I found the answer myself. (I overlooked something during my earlier debugging)

    var_ind = Input2 = 'A'; 
    The above line of code is the equivalent of:
    If Input2 = 'A'; 
       var_ind = *On;
    EndIf;

    I overlooked the fact that input2 is passed in as 'A' when var_ind is set *ON.

    Well.. that's my lesson for the day 

    25 pointsBadges:
    report
  • ToddN2000
    Glad you found it.. Sometimes it hard to resolve when all the code is not available.
    131,645 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: