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
 

 

Simple if statement - condition fail

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 2:19 pm    Post subject: Simple if statement - condition fail
Reply with quote

Code:
IF RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX)
    MOVE '1' TO NQA-SW                             
    MOVE 99 TO RMF-VCA-SECTION-CNTL-INDX.         



will this work??
Quote:

RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX) returns a string


when will this condition fail??

Please help.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 12, 2010 3:16 pm    Post subject:
Reply with quote

what is the data definition of RMF-RS-SECTION-ALPHA?

and COBOL does not deal with strings.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 3:21 pm    Post subject:
Reply with quote

Dick Brenholtz ,

Here is the definition.

Code:
20  RMF-RS-SECTION-TABLE OCCURS 99.   
             25  RMF-RS-SECTION-ALPHA   PIC X(03).


This is my production code, am analyzing this code.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 12, 2010 3:56 pm    Post subject:
Reply with quote

1. what cobol compiler was used to compile this production code?

2. where did the quote come from?

Quote:
Quote:

RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX) returns a string



actually the above addresses a 3 byte field defined as alphanumeric.
'returns a string' is verbiage applied to a function or method,
both of which the indexed Reference is not.

something else is going on, because the IF statement should not have compiled under ibm COBOL II or ibm E-COBOL.
are there any entries in the SPECIAL NAMES section?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 12, 2010 4:00 pm    Post subject:
Reply with quote

I guess the condition is always true, cause you get a string or spaces what
is also a string returned.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 12, 2010 4:15 pm    Post subject:
Reply with quote

Peter,

could you explain why this would be true? why it would even compile?
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 4:18 pm    Post subject:
Reply with quote

thanks peter. i ll check
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 4:19 pm    Post subject:
Reply with quote

Dick Brenholtz,
Am not sure.
The code is written some 20 years back.
Special names section is not mentioned.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 12, 2010 4:24 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
Peter,

could you explain why this would be true? why it would even compile?


Dick,

to be fair, I was thinking in C where string functions return a pointer
or NULL. So i assumed that today cobol has string functions too.
My latest cobol experience is about 30 years ago, so it maybe better to
refrain from cobol topics.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7909
Location: Bellevue, IA

PostPosted: Thu Aug 12, 2010 4:49 pm    Post subject:
Reply with quote

These things are not hard to test yourself, you know. If you put this into a program and attempt to compile it, you get
Code:
                IF RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX)

IGYPS2096-S An incomplete condition was found in a conditional expression.  The
            operand(s) was(were) discarded.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 5:13 pm    Post subject:
Reply with quote

Ya I knew I will get the error but still it is in my production module and it is working.

Is it possible in previous versions of cobol??
Because as i said the code was written 22 years back.

Now, am using Cobol-II.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 12, 2010 5:15 pm    Post subject:
Reply with quote

Robert has proved that the code snippet will not compile.

to continue the theoretical discussion -
since this code is in production,
obviously it compiled - sometime in the distant past

we need the 'enveloping' code.
it it appears to be part of a perform varying
(since the code modifies the subscript).

shankarm,
could you post the code that invokes the code snippet that you showed.

also, your quote about the returned string,
who told you that?
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 5:56 pm    Post subject:
Reply with quote

Folks,

Sorry for the delay.
I have some problem with my ID.
I am not able to logon to mainframe.

I ll paste the code once my logon issue is solved(in few mins).
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 6:21 pm    Post subject:
Reply with quote

Guys here is the code..

Code:

C100-BD-VALIDATE.                                       
    MOVE 0 TO  ERR-HLD1.                               
                                                       
**** STA-BA IS OVERRIDE FOR SAA-L, -J, -2 ************ 
    IF P-PRES-IND(STA-BA) = 'Y'                         
        IF P-PRES-IND(SAA-L) NOT = 'Y'                 
            IF P-PRES-IND(SAA-J) NOT = 'Y'             
                IF P-PRES-IND(SAA-2) NOT = 'Y'         
                    MOVE 2469 TO ERR-HLD1               
                    MOVE P-SCAN-SUB(STA-BA) TO HLD-SUB1
                    MOVE 'STA' TO SRCH-KEY             
                    PERFORM D000-ERR-LOAD THRU D000-EXIT
                                                       
********************************************************
* THIS CODE COMMENTED OUT AS PER GARY GOODNUFF 3/8/89. 
********************************************************
*   IF RMF-GAA-A-FLAG = 'Y'                             
*       IF P-PRES-IND (WAA-M) NOT = 'Y'                 
*           MOVE 2258 TO ERR-HLD1                       
*           MOVE P-SCAN-SUB (GAA-A) TO HLD-SUB1         
*           MOVE 'GAA' TO SRCH-KEY                     
*           PERFORM D000-ERR-LOAD THRU D000-EXIT.       
                                                       
    MOVE 1 TO RMF-VCA-SECTION-CNTL-INDX.               
    MOVE '0' TO NQA-SW.                                 
C100-BD-NQA-CHK.                                       
    IF RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX)
        MOVE '1' TO NQA-SW                             
        MOVE 99 TO RMF-VCA-SECTION-CNTL-INDX.           
    ADD 1 TO RMF-VCA-SECTION-CNTL-INDX.                 
    IF RMF-VCA-SECTION-CNTL-INDX > RMF-RS-SECTION-COUNT
        NEXT SENTENCE                                   
    ELSE GO TO C100-BD-NQA-CHK.                         
    IF P-PRES-IND (FFA-N) = 'Y'                         
        IF ((P-PRES-IND (FSA) NOT = 'Y') AND               



and goes on...

the calling module is
Code:

IF RMF-KA-REPORT-TYPE = 'BD'               
    PERFORM C100-BD-VALIDATE THRU C100-EXIT


This callin module is inside another perform.. and that inside another... but nothing in perform varying loop.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 12, 2010 6:37 pm    Post subject:
Reply with quote

Code:

    IF P-PRES-IND(STA-BA) = 'Y'                         
        IF P-PRES-IND(SAA-L) NOT = 'Y'                 
            IF P-PRES-IND(SAA-J) NOT = 'Y'             
                IF P-PRES-IND(SAA-2) NOT = 'Y'         
                    MOVE 2469 TO ERR-HLD1               
                    MOVE P-SCAN-SUB(STA-BA) TO HLD-SUB1
                    MOVE 'STA' TO SRCH-KEY             
                    PERFORM D000-ERR-LOAD THRU D000-EXIT
                                                       
********************************************************
* THIS CODE COMMENTED OUT AS PER GARY GOODNUFF 3/8/89.
********************************************************
*   IF RMF-GAA-A-FLAG = 'Y'                             
*       IF P-PRES-IND (WAA-M) NOT = 'Y'                 
*           MOVE 2258 TO ERR-HLD1                       
*           MOVE P-SCAN-SUB (GAA-A) TO HLD-SUB1         
*           MOVE 'GAA' TO SRCH-KEY                     
*           PERFORM D000-ERR-LOAD THRU D000-EXIT.       
                                                       
    MOVE 1 TO RMF-VCA-SECTION-CNTL-INDX.


the code commented out as per gary goodnuff 3/8/89
removed the only period '.' (end of if statement)
thus causing the period after
MOVE 1 TO RMF-VCA-SECTION-CNTL-INDX.
to end the (typical 20-year old BS) IF statement.
also, the move will only be executed if all four IF's are statisfied
otherwise RMF-VCA-SECTION-CNTL-INDX is never reset.
afterwards, the logic falls thru this garbage:
Code:

    MOVE '0' TO NQA-SW.                                 
C100-BD-NQA-CHK.                                       
    IF RMF-RS-SECTION-ALPHA (RMF-VCA-SECTION-CNTL-INDX)
        MOVE '1' TO NQA-SW                             
        MOVE 99 TO RMF-VCA-SECTION-CNTL-INDX.           
    ADD 1 TO RMF-VCA-SECTION-CNTL-INDX.                 
    IF RMF-VCA-SECTION-CNTL-INDX > RMF-RS-SECTION-COUNT
        NEXT SENTENCE                                   
    ELSE GO TO C100-BD-NQA-CHK. 


the next time thru C100-BD-VALIDATE
the value of RMF-VCA-SECTION-CNTL-INDX will be 99.
depending on if the aforementioned set of nested IF's.


Good Luck with this crap.

so you have two problems:
1. what was this incomplete IF really meant to be
2. correct the missing .
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Thu Aug 12, 2010 6:45 pm    Post subject:
Reply with quote

Thanks for your time and effort people.
I ll look into it and i ll post if i find any clue.
Back to top
View user's profile Send private message
saurabh39
Warnings : 1

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Thu Aug 12, 2010 8:05 pm    Post subject: Reply to: Simple if statement - condition fail
Reply with quote

Hi,

I have one question - Is it possible that, when this particular production code was moved, the load module did not refresh and was having same old load module.

Also, is it possible or are there any ways by which i can check whether a given statement is part of load module?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7909
Location: Bellevue, IA

PostPosted: Thu Aug 12, 2010 8:21 pm    Post subject:
Reply with quote

Depending upon how the move was done, it is possible that the load module was not refreshed -- but most of the time the production control group is aware of the possibility and is very careful to ensure the move actually did occur. An AMBLIST on the load module should resolve any doubts, one way or the other -- as long as you know the date of the move.

And as far as your second (of one) question, while there are some special circumstances in which source code is associated with load modules (such as compiling with products that allow source analysis of executions), in general you cannot determine which COBOL source statements were compiled to create a particular load module.
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 -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 pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am


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