View previous topic :: View next topic
|
Author |
Message |
gragha
New User
Joined: 25 Jul 2006 Posts: 23
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
First x'05' is a TAB not a low-value.
Second try string <= all spaces |
|
Back to top |
|
|
gragha
New User
Joined: 25 Jul 2006 Posts: 23
|
|
|
|
The current condition is perform until string <= spaces. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
vsgaikwad
New User
Joined: 20 Nov 2007 Posts: 6 Location: Pune
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rag swain
New User
Joined: 17 Dec 2007 Posts: 33 Location: pune,INDIA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|