Does anyone have a sample program that allows a user to add or change a subfile. They want to enter a machine number and a date and pull up a subfile having data for the day on a machine. They want to be able to add more into the subfile or if nothing exist then add all of it. It has been years since I have written a subfile program that allowed editing, they have all been inquiry and I can't remember how to code for editing. Also, if the roll keys are pressed I need it to check for errors before writing. I was hoping someone would have a sample of a program doing this. If I can see one then I am sure I can change it to my needs. Thanks in advance for any help.
Announcement
Collapse
No announcement yet.
sample code to program a subfile that can be edited.
Collapse
X
-
Re: sample code to program a subfile that can be edited.
Originally posted by twigginsDoes anyone have a sample program that allows a user to add or change a subfile. They want to enter a machine number and a date and pull up a subfile having data for the day on a machine. They want to be able to add more into the subfile or if nothing exist then add all of it. It has been years since I have written a subfile program that allowed editing, they have all been inquiry and I can't remember how to code for editing. Also, if the roll keys are pressed I need it to check for errors before writing. I was hoping someone would have a sample of a program doing this. If I can see one then I am sure I can change it to my needs. Thanks in advance for any help.
Welcome twiggins
You could download the save file from here
There are a couple of subfiles that do entry/edit...
They use message files you may have to create the message file before
you can complie/run
Check this out for message file info
Let me know how you make out
JamieAll my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
-
Re: sample code to program a subfile that can be edited.
Thanks. Honestly I couldn't make out from all of that what I really am needing. Of course, I don't really know myself. LOL. I just can't remember how to do the routine to write or update the records. I need to pull in records matching my key criteria. If there are no records then there will be a blank subfile for them to key the info in to. It needs to check errors when the enter key is pressed or when the page key is used. When they press Enter it needs to update the file and bring in a description on all of the subfile records. If there was data matching the key data it needs to be displayed in the sub-file and then they can add more records. I just haven't had to write one of these in about 11 years and have no idea where to begin. It's not like riding a bike. I'm not sure if I need some special keywords on the dds or not. I assume I will read the subfile with a readc to do the update/write? Thanks for your help. I'm just struggling and it didn't make alot of sense to me. They won't be putting in an idicator to change like a C or 2 to change. They will just change the record.
- I also added that I am in Kansas.
Comment
-
Re: sample code to program a subfile that can be edited.
I saw the Kansas ---- no toto jokes allowed
The readc/SFLNXTCHG will work or you could create hidden fields in the subfile.
I myself tend to use the hidden field method
Then when enter key is pressed it compares the fields for changes.
Here is an example you will need to modify it to...of course
It really just deletes the current records in the physical then rewrites whats in the subfile back to the file.
You can modifiy this with your readc or hidden fields to check each record.
It should get you started
see attached.
JamieAttached FilesAll my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
Comment