You can always call up the information from your text (txt) file, put it into a variable, change it around, and then re-write the information to the text file again.

Basically there are two types of text files, txt & ini, each has it's own advantages & disadvantages depending on what you're wanting to put in the file and how you want it stored.

Likewise, there are two types of variables, global & local.

Global variables, when set, stay set until they are modified, or unset. Local variables, are automatically emptied when the end of the script (that they were set in) is reached.

Also please note that hash tables are an excellent way of storing information. Hash tables are, I believe, the fastest way of storing and accessing a lot of information.

Per your example, the following would work
Code:
var %a = $left($read(file.txt,t,1),1), %b = $right($read(file.txt,t,1),1), %c = $calc(%a + %b)
echo -a $read(file.txt,t,1) summed is %c
  


Please note that this is a very simple example, and if you'd like assistance in writing the code, I'll need more details.

One reason that people have a hard time with variables in an RPG script, is the fact that most people (and I'm guilty of doing this myself) don't use variable names that are easily identifiable for the information that they hold.

I suggest you read
/help $read
/help /write
/help $readini
/help /writeini
/help $ini
/help Hash tables