Display name as blanks in RPGLE

1,215 pts.
Tags:
AS/400
AS400 RPGLE
FTESTCF IF E K Disk * /Free EmpNo = 100; Chain (EmpNo) TestCF; If %Found(TestCF); Dsply EmpName; Endif; Dsply EmpName; Clear RTEST; EmpNo = 101; Chain (EmpNo) TestCF; If %Found(TestCF); Dsply EmpName; Endif; Dsply EmpName; 

Above Code Employee NUmber 100 is found in File. Employee Name is coming as expected. But EMPNO = 101 is not available. But Program is still referring Old Employee Name. File is declared in Input Mode. I want to display Name as Blanks while executing the Command outside of %Found Command. Please help me.
ASKED: December 18, 2012  9:18 AM
UPDATED: August 26, 2013  3:08 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

And an Else to the If statment to clear EMPNAME or just check foir the NOT %Found condition and clear the field.

Chain

If Not %Found

Clear EMPNAME

EndIf

DSPLY EMPNAME

Discuss This Question: 2  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Since '101' wasn't found, there was no value to replace the previous value of EmpName. You need to tell your program what value to use when no record was found. If you don't, then the EmpName variable is not going to change. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Is RTEST the record format from TESTCF? If it is, then your CLEAR statement needs to be corrected. You need the *ALL modifier because you aren't using RTEST as an output format. Since you only use it for input, none of the subfields are cleared. -- Tom
    125,585 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following