Page 1 of 1

do varying (help)

Posted: September 12th, 2011, 6:41 pm
by Guest
Hello,

I seek some help to improve the piece of code below.
It works but I would like to add that if "F" is found with any other letter, then generate an errmsg

I tried many variations but no success.

Thank you for any help

*********************************************
do varying i=1 until i>6
if Q132_DECLCONF[i:1] in "A", "B", "C", "D", "E" then //<------------If any found or any combination found, move to Q134
move to Q134_PROBPERSON;

elseif Q132_DECLCONF = "F" then //<------------If "F" alone, skip to Q135
skip to Q135_PROBPROFES;
endif;
enddo;
*********************************************

I would like to add //If "F" found with any other letter, error message

Re: do varying (help)

Posted: September 22nd, 2011, 1:51 pm
by Gregory Martin
I would write the code like this, without using a loop:
PROC Q132_DECLCONF

    
if Q132_DECLCONF = "F" then // F alone
        skip to Q135_PROBPROFES;

    
elseif poschar("ABCDE",Q132_DECLCONF) and poschar("F",Q132_DECLCONF) then // F found with another letter
        errmsg("You cannot enter F with another letter");
        
reenter;

    
else
        
skip to Q135_PROBPROFES;

    
endif;

Re: do varying (help)

Posted: July 2nd, 2012, 12:40 pm
by lls
Fantastic.

Thank you very much for your help.