I am giving when STARTBR was successful and the key was the values which I entered through screen. And after READNEXT now what is happening is : READNEXT fetches the lowest value of the MODEL NUM(same as entered through screen)
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
If you have the full key value, then just issue a random READ. It's less overhead than a STARTBR then a READNEXT.
On the random READ, if you get a NOTFND, then the record doesn't exist.
A potential problem with browsing has to do with whether or not the file is defined to an LSR Pool. If it is NOT (this is known as NSR) and the browse is quite long, then control will not return to the QR (Quasi Reentrant) TCB until an explicit ENDBR (highly preferable) is issued or task termination (this is not a good idea EVER).
Many shops still lack in proper LSR Pool allocation as well as Threadsafe principles and associated coding techniques.
Note that for TS 3.2 (via an IBM PTF), Local VSAM can be made Threadsafe, but Remote VSAM remains non-Threadsafe. There's talk that TS 4.1 will acquire a Threadsafe PTF for Remote VSAM access, but I'm unsure whether this would be downward compatible.
I am pointing the browser to AR55,020496 and after that I am giving READNEXt but what happens it goes to the AR55,001734 record.Means first record of AR55
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
If the code is exactly as you've posted, when the PERFORM 1000-READ-NEXT-PARA condition is completed you'll fall through the END-IF into 1000-READ-NEXT-PARA and attempt another READNEXT.
IF WS-RESP = DFHRESP(NORMAL)
PERFORM 1000-READ-NEXT-PARA THRU 1000-EXIT
UNTIL RLA-MODEL-NUM NOT = WS-MODEL-PREV AND
RLA-SERIAL-NUM NOT = WS-SERIAL-PREV
GO TO 1000-EXIT
ELSE
GO TO 1000-EXIT
END-IF.
1000-READ-NEXT-PARA.
EXEC CICS READNEXT
DATASET('DGCRLAP1')
INTO(RLA-REC)
RIDFLD(RLA-ALT-KEY-1)
RESP(WS-RESP)
END-EXEC.
IF WS-RESP = DFHRESP(NORMAL)
Than some condns
and after that end-if
1000-EXIT.
EXIT.
1100-END-BROWSE.
EXEC CICS ENDBR
FILE ('DGCRLAP1')
RESP (WS-RESP)
END-EXEC.
1100-EXIT.
EXIT.
IF WS-RESP = DFHRESP(NORMAL)
PERFORM 1000-READ-NEXT-PARA THRU 1000-EXIT
UNTIL RLA-MODEL-NUM NOT = WS-MODEL-PREV AND
RLA-SERIAL-NUM NOT = WS-SERIAL-PREV
GO TO 1000-EXIT
ELSE
GO TO 1000-EXIT
END-IF.
I don't get it? after the Perform 1000-read-next-para
your logic is dropping into the 1100-end-browse
when do you move the record information to the map area ?
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
From the confusion of the responders and ongoing issues, I think you need to take a step back, redesign your entire program, and forget everything you have shown us. Your latest code performs 1000-READ-NEXT-PARA through 1000-EXIT until a pair of conditions are met, then branches to 1000-EXIT. At this point, since there's no PERFORM active, control will pass through the 1000-EXIT paragraph into 1100-END-BROWSE. Is that what you meant to do? We don't know. Is that possibly having an impact upon your code? Certainly it could if you still think you are browsing when the browse was ended!
I recommend you start by finding (hint: Google is your friend) a copy of Dijkstra's 1968 Communications of the ACM article entitled Go To Statement Considered Harmful, reading it, and realizing that with COBOL there is no need to use a GO TO statement. Ever. Period. GO TO statements and PERFORM statements can interact in unexpected ways in COBOL, especially when using exit paragraphs.