Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS400 update file 1

Status
Not open for further replies.

schwob

Technical User
Aug 27, 2002
7
FR
I am totally new at AS400 & RPG programming, and I wanted to make a prog that takes a file from PC and transfer it to AS400 ... I had help for this first part and it works perfectly, but now I want to update the file I get from the PC it and send it back to the PC. I used &quot;CPYTOSTMF&quot; in a CL which works perfectly, but when I try to use &quot;F<name of the file> UF E DISK&quot; with the file I used as input in the other prog, it says that the file is not defined for update... How can I do? It must be simple but I cannot manage to find documentation on RPG programming on AS400...

Thank you!
 
schwob,

What C-spec statement is giving you problems? If you are using a &quot;WRITE&quot;, then you must put an 'A' (file addition) in your file's F-spec. Otherwise, make sure that you are referring to the correct file or record name.

 
Is there a chance that some other program has opened the file using commitment control? Rod
 
I AM using a &quot;write&quot;.. I put an &quot;A&quot; in the file's F-spec as you said, but it seems that I'm not referring to the right record name, and I forgot how to look for the record name (I know, it must be VERY simple, but I'm not quite used to AS400 interface yet, since the first one I saw was 2 weeks ago...)

I don't think any other program opened the file using commitment control. There are only 2 programs that are using this file: the first one opens it as an input file in order to transfert data in another AS400 file, and the other one is the actual prog that *tries to* send the file back on the PC after changing some data.

Another thing: the language of the AS400 I'm working on is french, so it's not easy to translate the error messages for you to understand but ithe error I get is something like &quot;the second factor does not contain neither a filename nor a saving format&quot;
 
schwob,

I have been assuming that you are getting a COMPILE error - is this correct?

Do a DSPFD filename and scroll to the bottom of the information - 7 or 8 lines up from the bottom you will see the &quot;Record Format&quot; name. This is what you want.

K.Hood
 
That's right, I was getting a compile error... The problem is solved now, it was indeed an incorrect record name. Thank you for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top