View previous topic :: View next topic
|
Author |
Message |
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
HI friends,
4020-NEW-RECORD-PARA.
MOVE xxxx-yyy-NBR TO WS-xxxx-yyy-NBR-SRT
MOVE xxxx-yyyy-CD TO WS-xxxxx-yyyy-CD-SRT
READ zzzzzSORT
AT END CONTINUE
NOT AT END PERFORM 4020-COMPARE-KEY-PARA
END-READ.
4020-COMPARE-KEY-PARA.
IF xxxxx-DLR-KEY EQUAL TO WS-xxxxx-SRT-KEY THEN
PERFORM 4030-UPDATE-DATE-PARA.
Control should come out once the IF statement is satisfied(i.e, after executing 4030-UPDATE-DATE-PARA).
Direct me how to do it. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What do you want to do if the IF is not satisfied? |
|
Back to top |
|
|
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
According to the info i got that situation wont arise. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
jpraveenreddy wrote: |
According to the info i got that situation wont arise. |
Then why have the IF? |
|
Back to top |
|
|
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
Quote: |
IF xxxxx-DLR-KEY EQUAL TO WS-xxxxx-SRT-KEY THEN
|
I have to compare these two fields from different files and If the condition is satisfied,I have to populate fields.
Is there any way to do so? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
The flow of the program will go to the statement following the IF when the if is not satisfied or after performing 4030-UPDATE-DATE-PARA if the if is satisfied. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
jpraveenreddy wrote: |
4020-COMPARE-KEY-PARA.
IF xxxxx-DLR-KEY EQUAL TO WS-xxxxx-SRT-KEY THEN
PERFORM 4030-UPDATE-DATE-PARA. |
Hi,
With this, control will go to the next executable sentence of COBOL program, if there is any such sentence after 4030-para that will be executed. You could use EVALUATE but the scope of EVALUTE will last till it gets next WHEN, everything will get executed between to WHENs.
eh...I'm sure enough You were not searching for this answer, so showing little more code & a little more explanation on 'situation' might fetch better suggestions. Good Luck.. |
|
Back to top |
|
|
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
Here is little bit more explanation:
This
is a flat file(PS).
I am reading this
from the above file.
I am reading
from a VSAM file.
If the key
is present in the PS the I have to perfrom
Quote: |
4030-UPDATE-DATE-PARA |
.
So, as soon as I find the key matching, I should stop reading PS.
Otherwise this will go into infinite loop(I think, as I am getting S322 abend while executing JCL, correct me if I am wrong). |
|
Back to top |
|
|
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
isn't there any way to do it? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
isn't there any way to do it? |
Of course there is. . .
To get useful replies, you need to more clearly specify your requirement.
One easy to do this is to post some of the "input" data and the processing required for the input. Show data that meets all of the conditions between the input files. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Quote: |
So, as soon as I find the key matching, I should stop reading PS |
You answered your own question. |
|
Back to top |
|
|
Pcrummey
New User
Joined: 26 Feb 2008 Posts: 4 Location: Van Wert, OH
|
|
|
|
Your AT END condition on your Read Statement shouldn't be CONTINUE, you have no logical way out of your READ. You need something like at STOP RUN or an EXIT depending on how your program was initiated. The Continue will take you to the next part of your program which would be 4020-COMPARE-KEY-PARA. |
|
Back to top |
|
|
madhavik
New User
Joined: 27 Oct 2007 Posts: 1 Location: florida
|
|
|
|
Hi,
I hope this answer will be helpful to u..........
As soon as ur IF condition is satisfied try to set some variable to true.
Then u can use this variable to control ur PS file reading para.
if it is not clear reply me
madhu |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
My understanding of the requirement (and my understanding may surely not be complete) tells me the requirement has not been completely defined so i suspect that any solution suggstions will also be incomplete.
Again, if some input data samples are posted and how that data should be processed is posted, we can provide much better suggestions.
If there are 50 records in the ps file, 200 in the vsam file and 20 of them "match" what should happen to the 19 "matches" other than the first match? |
|
Back to top |
|
|
|