Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Control should come out once the IF statement is satisfied

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Control should come out once the IF statement is satisfied
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    Post subject:
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    Post subject: Reply to: Control should come out once the IF statement is s
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    Post subject: Re: Reply to: Control should come out once the IF statement
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    Post subject: Reply to: Control should come out once the IF statement is s
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    Post subject:
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

Senior Member


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

PostPosted: Tue Mar 11, 2008 9:59 pm    Post subject: Re: Control should come out once the IF statement is satisfi
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    Post subject: Reply to: Control should come out once the IF statement is s
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    Post subject: Reply to: Control should come out once the IF statement is s
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

Site Director


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

PostPosted: Thu Mar 13, 2008 12:19 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Control should come out once the IF statement is s
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

Site Director


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

PostPosted: Thu Mar 13, 2008 8:21 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us