View previous topic :: View next topic
|
Author |
Message |
chaitanyav
New User
Joined: 13 May 2008 Posts: 3 Location: Hyderabad
|
|
|
|
Hi All,
Can any one tell me what are the values that are less than Spaces and Greater than Low-Values
I have the following logic in one of my programs that I need to test. I am confused about the values.
Please find the below logic.
Working storage Section.
-----------------------------
01 WW-TEST-COND.
05 WW-CADEAU PIC S9(7)V99 COMP-3.
05 WW-CADEAU-R REDEFINES WW-CADEAU.
07 WW-CADEAU-X PIC X(5).
Linkage Section:
-------------------
01 WL-LINKAGE.
03 WL-LINKAGE-LENGTH PIC S9(04) COMP.
03 WL-PARMS.
05 WL-JOB-NAME PIC X(7).
Procedure Division.
--------------------------
IF WW-CADEAU-X < SPACES
AND WW-CADEAU-X > LOW-VALUES
IF WW-CADEAU > 0 OR < 0
DISPLAY 'Test Condition'
DISPLAY 'WW-CADEAU - ' WW-CADEAU
END-IF
DISPLAY 'WW-CADEAU-X : ' WW-CADEAU-X
END-IF
When I am moving values to WW-TEST-COND thru the JCL parms like the below I am entering into that loop and when I check the spool the display is showing as spaces (I mean I cann't see any values in SYSOUT for WW-CADEAU-X).
JCL:
----
PARMS (12345&&)
Note: &&-->indicates Spaces
------
The way I am passing the parms is not correct as I delcared the linkage for this as mentioned above and the correct way is PARMS('12345&&').
When I am trying to use the below condition in the above code I am getting S0C7.
IF WW-CADEAU > 0 OR < 0
But still I am not getting how it entered into the loop for the first IF condition (IF WW-CADEAU-X < SPACES
AND WW-CADEAU-X > LOW-VALUES ). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
LOW-VALUE is hexadecimal (hex) '00'.
SPACE is hex '40' in EBCDIC.
Simple arithmetic tells you there are 62 characters in the EBCDIC collating sequence that are larger than LOW-VALUES and less than SPACES.
Quote: |
IF WW-CADEAU > 0 OR < 0 |
Why not say
Code: |
IF WW-CADEAU NOT EQUAL ZERO |
which makes a lot more sense than the code you have. Also note the improvement in readability that using BBcode provides.
You need to click on the manuals link at the top of the page, find the COBOL Language Reference and Application Programming Guide manuals and read them -- cover to cover. If you do so, you will find that the hex value for WW-CADEAU is x'000000000C' which is, indeed, less than SPACES (x'4040404040') and greater than LOW-VALUES (x'0000000000').
If you want the find the collating sequence characters between LOW-VALUES and SPACES yourself, Google is your friend. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I am confused about the values. |
Part of your confusion may be due to how things are done on ASCII (Windows, UNIX) systems. In UNIX, there is a term - "working below spaces" - that means the data is most likely some kind of control character rather than user data. On those systems a SPACE is an x'20', so these values are from x'00' thru x'1F'.
If you look at the ebcdic values from x'00' - x'FF' and the ascii values for the same, there is little similarity.
Before using a "user" input value as numeric, you should make sure that it contains valid numeric data. |
|
Back to top |
|
|
|