Hi guys,
I have some issues with understanding of file handling in cobol and I need some help please.
I want to access a file but I don't have all the keys, the file has 5 keys and I have only two keys filled - it will be something similar with access with partial key in rpg with setll & dou, I made like this:
MOVE value1 to key1
MOVE value2 to key2
MOVE 0 to key3
MOVE 0 to key4
MOVE 0 to key5
start file1 key is >= externally-described-key invalid key move 1 to eof
end-start.
perform par1.
...
par1.
read file1 next at end move 1 to eof.
if key1 not = value1
and key2 not = value2
move '1' to eof
go to par1-fin.
...
par1-fin.
I want to simulate a loop to read all the records, for example when I made start I have value1=12 and value2='A' and I have 3 records in my file1
12 A
12 A
12 A
13 A
...
but I see in debug that it is something wrong, after read operation the value of key1 is 13 and not 12, it is something wrong with the positioning and reading?
Thanks
I have some issues with understanding of file handling in cobol and I need some help please.
I want to access a file but I don't have all the keys, the file has 5 keys and I have only two keys filled - it will be something similar with access with partial key in rpg with setll & dou, I made like this:
MOVE value1 to key1
MOVE value2 to key2
MOVE 0 to key3
MOVE 0 to key4
MOVE 0 to key5
start file1 key is >= externally-described-key invalid key move 1 to eof
end-start.
perform par1.
...
par1.
read file1 next at end move 1 to eof.
if key1 not = value1
and key2 not = value2
move '1' to eof
go to par1-fin.
...
par1-fin.
I want to simulate a loop to read all the records, for example when I made start I have value1=12 and value2='A' and I have 3 records in my file1
12 A
12 A
12 A
13 A
...
but I see in debug that it is something wrong, after read operation the value of key1 is 13 and not 12, it is something wrong with the positioning and reading?
Thanks
Comment