IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Control should come out once the IF statement is satisfied


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Tue Mar 11, 2008 5:39 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 11, 2008 6:07 pm
Reply with quote

What do you want to do if the IF is not satisfied?
Back to top
View user's profile Send private message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Tue Mar 11, 2008 6:14 pm
Reply with quote

According to the info i got that situation wont arise.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 11, 2008 6:18 pm
Reply with quote

jpraveenreddy wrote:
According to the info i got that situation wont arise.


Then why have the IF?
Back to top
View user's profile Send private message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Tue Mar 11, 2008 6:26 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 11, 2008 6:42 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 11, 2008 9:59 pm
Reply with quote

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
View user's profile Send private message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Wed Mar 12, 2008 7:46 am
Reply with quote

Here is little bit more explanation:
This
Quote:
READ zzzzzSORT
is a flat file(PS).

I am reading this
Quote:
xxxxx-DLR-KEY
from the above file.

I am reading
Quote:
WS-xxxxx-SRT-KEY
from a VSAM file.

If the key
Quote:
WS-xxxxx-SRT-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
View user's profile Send private message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Wed Mar 12, 2008 3:37 pm
Reply with quote

isn't there any way to do it? icon_cry.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 13, 2008 12:19 am
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 13, 2008 12:23 am
Reply with quote

Quote:
So, as soon as I find the key matching, I should stop reading PS


You answered your own question.
Back to top
View user's profile Send private message
Pcrummey

New User


Joined: 26 Feb 2008
Posts: 4
Location: Van Wert, OH

PostPosted: Thu Mar 13, 2008 12:24 am
Reply with quote

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
View user's profile Send private message
madhavik

New User


Joined: 27 Oct 2007
Posts: 1
Location: florida

PostPosted: Thu Mar 13, 2008 2:59 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 13, 2008 8:21 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Help Control-R IBM Tools 2
No new posts Try to understand IMS control block IMS DB/DC 0
No new posts Control-M Delay All Other Mainframe Topics 0
Search our Forums:

Back to Top