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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have a program that loops

Status
Not open for further replies.

claudeb

Programmer
Nov 23, 2000
140
CA
Hi,
I have a program that loops at a certain point. From what i understand, the procedure
ReadNext is used to position at the first valid entry, and shouldn't be called again.
The program browses the valid entries from the most recent to the oldest. ReadPrevious is used for that (the oldest entries are the first ones).
Could any one explain to me how ReadNext works, or how to prevent the program to call this procedure more than once.
thanks
 
Could you post that section of code or e-mail it to me? It could be that you have a logic error somewhere else that is causing the problem.
 
Hi Claude,

From what I remember, a START statement positions you at the rec you want and READ NEXT gets the rec for you. You continue to RN to procede thru the file until you give up, issue a READ PREV (see below) or VSAM issues a RC 10 (EOF). At least that's the way COBOLII does it. I'd expect your version does the same.

If you're Changing directions you must issue the new direction statement twice in succession, e.g.,
READ PREV ... READ PREV. Apparently the 1st RP reads the same rec as the last RN.

You proceed as was shown for the RN above, except backward and the RC 10 announces your arrival at the beginning of the file.

All this may not explain why you're looping, but as nontrad wrote the code would help.

Jack.



 
Thanks,
I just found out that certain records were not correct.
when i modify them, the program works fine.
i have now to find the program that causes the problem
thanks again
claude
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top