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.
Software/Hardware used:
ASKED:
December 9, 2008 4:00 PM
UPDATED:
December 10, 2008 2:52 PM
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?
Sorry
First line should read
key CHAINfile
Indicator is not necessary when using the %found
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.
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.