rpg

0 pts.
Tags:
RPG
RPG Display File
RPG Subroutine
I have created a subroutine to update a display file. key CHAINfile 90 *IN90 IFEQ *OFF MOVELfieldvalue screenvalue EXFMTscreen MOVELscreenvalue filevalue UPDATrecfmt of file END ENDSR Is this logic right? 1.the value in the file is not getting displayed when screen is invoked 2.the field appears blank when updated the file doesnt get updated.
ASKED: December 9, 2008  4:00 PM
UPDATED: December 10, 2008  2:52 PM

Answer Wiki

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

Hi,

The logic looks OK.

Bear in mind that the record you’ve CHAINed will be locked until the UPDAT is done.

Do you only have one record in your data file with a matching key? It’s possible that the CHAIN will work and retrieve the first record with a matching key if you have several records with the same key. Maybe that first record has blanks in the fieldvalue?

Regards,

Martin Gilbert.

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.

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
  • philpl1jb
    and make sure that the field screenvalue on the screen is coded 'B' both input/output. Current coding might look more like this key CHAINfile 90 If %found(file) Eval screenvalue = fieldvalue EXFMT Screen Eval fieldvalue = screenvalue UPDATrecfmt ENDif ENDSR When you make a change on the screen are you pressing the enter key .. or are you pressing a function key?
    48,565 pointsBadges:
    report
  • philpl1jb
    Sorry First line should read key CHAINfile Indicator is not necessary when using the %found
    48,565 pointsBadges:
    report
  • hey thanks all....i was able to successfully display value on a screen and update the same. But i have not handled record lock while doing the update.Can i just add unlck opcode right after updat opcode or is there any other logic.I have done the updation in a seperate subroutine.
    0 pointsBadges:
    report
  • philpl1jb
    Not necesary. If your program updates the record, it is unlocked. If your program reads another record the previous one is unlocked-- your program can only lock one record per file (actually one per access path-but that's another story) If your program ends with *inlr on the file is closed and the record is unlocked. If your program closes the file the record is unlocked. So the unlock is used when your program reads a record (for update) but doesn't update it and doesn't immediately read another record. The exception to all above (for the experts) is commitment control where a commit may be required after one of these events to unlock the record.
    48,565 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