MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Evaluate Condition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Sat Jul 09, 2005 2:32 pm    Post subject: Evaluate Condition Reply with quote

Hi all,
Code:

10 STATUS                         PIC X(2)   
.
.
.
MOVE 'E ' TO STATUS 
.
.
.
EVALUATE STATUS                                 
    WHEN SPACES                                       
        ADD 1 TO CNT                     
        END-ADD                                       
    WHEN 'E'
        CONTINUE                                     
    WHEN OTHER                                       
        DISPLAY '*** ERROR READING INPUT FILE ***'   


This codes works perfectly fine....
Here in the Evaluate status variable is checked with only a single byte 'E', althought it is a 2 byte variable holding value 'E '. I hope 'E' NOT equal to 'E '.

Even when the value of the variable is 'E ' its working perfectly fine...

Rolling Eyes Surprised to see how this code works.. it will be great if some one can throw light on this...
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
Kathi
Beginner


Joined: 14 May 2003
Posts: 25
Topics: 0
Location: Mission Viejo, California

PostPosted: Sat Jul 09, 2005 4:58 pm    Post subject: Reply with quote

See the rules of character movement and padding. See also the rules for comparing values when their lengths are different.

I'd also rethink your closing quote if you don't understand the question you asked.
Back to top
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Sat Jul 09, 2005 11:21 pm    Post subject: Reply with quote

Hi Kathi,
Could you please provide me some Links to check the same.. Thanks in advance
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Sun Jul 10, 2005 3:44 pm    Post subject: Reply with quote

Hi Kathi,
Thanks for your clarrification...I got the my query clarrified...

Quote:
String comparison is performed whenever numeric comparison is
inappropriate. Comparison of strings whose lengths differ may be
performed in two ways:

- The longer string may be truncated to the length of the shorter
prior to comparison (TRUNCATE parameter).

- The shorter string may be padded to the length of the longer prior
to comparison (PAD parameter). The character used for padding may
be explicitly specified. If it is not, an EBCDIC blank (X'40') is
used for data described as CHARACTER data or data described
using a general value of types C or T. If the data was described
using a general value associated with ISO-8 ASCII CHARACTER data
(types Q or S), padding is performed using an ISO-8 ASCII blank
(X'20'). Padding with a null character (X'00') is used for all
other types of data.

_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
neilxt
Beginner


Joined: 01 Mar 2004
Posts: 23
Topics: 1

PostPosted: Wed Sep 20, 2006 8:24 am    Post subject: Re: Evaluate Condition Reply with quote

s_shivaraj wrote:
Hi all,
This codes works perfectly fine....
Here in the Evaluate status variable is checked with only a single byte 'E', althought it is a 2 byte variable holding value 'E '. I hope 'E' NOT equal to 'E '.

Even when the value of the variable is 'E ' its working perfectly fine...

Surprised to see how this code works.. it will be great if some one can throw light on this...


Allow me to shine some historical perspective.
Mainframe business languages in general and COBOL in particular have always been designed on the principle that the main unit of work is the Record consisting of a number of related data items which could be addressed by their position within a Record Layout and which were therefore fixed length.

So mainframe languages were always designed to treat different length character fields as if the shorter were padded to the length of the larger with spaces. Neil is always Neil no matter what size field you store his name in.

PC languages started with the Variable as the unit of work. Character strings were always variable length because storage was at a premium and there was no value to be gained by having fixed length fields.

So PC languages started their comparison by checking the length. It was the most efficient way to spot discrepancies. So PC languages have always tended to treat 'Neil' as being different from 'Neil '.

Both methods have their advantages however from a business POV I'd say the former is probably preferable to the latter.
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Sep 20, 2006 11:24 am    Post subject: Reply with quote

Your question is answered. Try EVALUATE STATUS (1:1) as a separate testcase and see what happens.... Smile
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group