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
 

 

Low value in a string

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

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Fri Jan 25, 2008 3:53 am    Post subject: Low value in a string
Reply with quote

I have a string and the first character is a low value (X'05') and the string is 20 characters long and it has other varialbles like 'CLIENT'.

When I am checking this in the Perform until condition if the string is <= spaces the condition satisfies. The string definitely has the word 'CLIENT' in it so it has to be greater than spaces. But still the condition satisfies and it comes out of the loop. Is it because of the presence of 1 low value that the entire string is considered < spaces. Please advise.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


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

PostPosted: Fri Jan 25, 2008 4:11 am    Post subject:
Reply with quote

First x'05' is a TAB not a low-value.

Second try string <= all spaces
Back to top
View user's profile Send private message
gragha

New User


Joined: 25 Jul 2006
Posts: 23

PostPosted: Fri Jan 25, 2008 4:20 am    Post subject: Reply to: Low value in a string
Reply with quote

The current condition is perform until string <= spaces.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 25, 2008 4:27 am    Post subject: Low value in a string
Reply with quote

A correction. LOW-VALUE is X'00'.

Try this -

Code:

03  WS-STRING  PIC X(20).
03  WS-SUB     PIC 9(08) BINARY.
03  WS-FLENGTH PIC 9(08) BINARY.

MOVE ZERO         TO TALLY.

INSPECT WS-STRING TALLYING TALLY FOR CHARACTERS BEFORE INITIAL 'CLIENT'.


Then, if TALLY is less than the LENGTH OF WS-STRING, then 'CLIENT' can be found at WS-STRING (TALLY + 1:6).

Otherwise, it's not in WS-STRING.

_O R_

Code:

COMPUTE WS-FLENGTH     = (LENGTH OF WS-STRING - 5).
MOVE 1                 TO WS-SUB.
MOVE ZERO              TO TALLY.

PERFORM UNTIL WS-SUB > WS-FLENGTH
    IF  WS-STRING (WS-SUB:6) = 'CLIENT'
        MOVE WS-SUB    TO TALLY
        COMPUTE WS-SUB = (WS-FLENGTH + 1)
    ELSE
        ADD  1         TO WS-SUB
    END-IF
END-PERFORM.


Then, if TALLY > ZERO, then 'CLIENT' can be found at WS-STRING (TALLY:6).

Otherwise, it's not in WS-STRING.

HTH....

Regards,

Bill
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: Fri Jan 25, 2008 9:01 pm    Post subject:
Reply with quote

Hello,

If you look at the field in hex, is there more than 1 x'05' among the variables?

How was this field created? Is it possible that you have tab-delimited data?

If you do, you could UNSTRING the variables into separate fields using the x'05' as the delimiter.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Fri Jan 25, 2008 10:53 pm    Post subject:
Reply with quote

I was going to speculate that the x'05' might be the length of the data in the character field. Like when you pull a VARCHAR from DB2.

Although x'05' doesn't equal len('CLIENT') but maybe the O/P gave us data from two different records.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri Jan 25, 2008 10:59 pm    Post subject: Re: Reply to: Low value in a string
Reply with quote

gragha wrote:
The current condition is perform until string <= spaces.


If the first character of the field is x'05' then it would be less than space (x'40').
Back to top
View user's profile Send private message
vsgaikwad

New User


Joined: 20 Nov 2007
Posts: 6
Location: Pune

PostPosted: Mon Feb 04, 2008 6:58 pm    Post subject:
Reply with quote

Hi,

I saw like following.

Code:
IF ABC IS GREATER THAN SPACE/SPACES THEN


where ABC is X(05).

what is the meaning of above code. I got confused..Because suppose if ABC contains either 123 or 12ABC or ABC12 or ABCDEF, what will happen..Even I tried with program...But still confused..whether it's comparing with EBCDIC value or something else.....

Vikas.[/code]
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: Mon Feb 04, 2008 8:42 pm    Post subject:
Reply with quote

Hello,

Is this an additonal question or is this part of the original question?

Is the field PIC X(05) or does the field contain one or more characters with a value of x'05'.

This code:
Code:
IF ABC IS GREATER THAN SPACE/SPACES THEN
will compare the content of ABC against spaces and continue execution accordingly.

If you post what you tried with a program and the result you received, someone will be able to clarify.
Back to top
View user's profile Send private message
rag swain

New User


Joined: 17 Dec 2007
Posts: 33
Location: pune,INDIA

PostPosted: Tue Feb 05, 2008 10:16 pm    Post subject: Reply to: Low value in a string
Reply with quote

Quote:

Hi,

I saw like following.

Code:
IF ABC IS GREATER THAN SPACE/SPACES THEN


where ABC is X(05).

what is the meaning of above code. I got confused..Because suppose if ABC contains either 123 or 12ABC or ABC12 or ABCDEF, what will happen..Even I tried with program...But still confused..whether it's comparing with EBCDIC value or something else.....


Vikas-You should have started a new thread instead. however there is nothing wrong with the code you showed.

Dick,

The O/P is different than the last one who posed this question.
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: Wed Feb 06, 2008 1:39 am    Post subject: Reply to: Low value in a string
Reply with quote

Quote:
The O/P is different than the last one who posed this question.
Yup, noticed that. When "round 2" started, i couldn't convince myself whether the new post was a continuation or a completely new question - so i asked. So far, no response. . .

I'll be happy to split this into a separate topic or leave it where it is. Any preferences?

d
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


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