View previous topic :: View next topic
|
Author |
Message |
rajulan
New User
Joined: 11 Jan 2008 Posts: 66 Location: India
|
|
|
|
Hi,
Code: |
WORKING-STORAGE SECTION.
01 VAR1 PIC X(10) VALUE 'CTS'.
01 VAR2 PIC X(10) VALUE 'TCS'.
01 VAR3 PIC X(4) VALUE 'INFY'.
01 VAR4 PIC X(10) VALUE 'INFOSYS'.
01 VAR5 PIC X(10) VALUE 'KEANE'.
01 VAR6 PIC X(10) VALUE SPACES.
01 VAR7 PIC X(10) VALUE SPACES.
01 VAR8 PIC A(10) VALUE 'RAJULAN'.
01 VAR9 PIC A(10) VALUE SPACES.
01 VAR10 PIC 9(4) VALUE 1234.
01 VAR11 PIC 9(4) VALUE 0.
01 VAR12 PIC 9(4) VALUE ZERO.
PROCEDURE DIVISION.
PARA-BEGIN.
MOVE VAR4 TO VAR1.
DISPLAY VAR1.
MOVE VAR8 TO VAR7.
DISPLAY VAR7.
MOVE VAR10 TO VAR6.
DISPLAY VAR6.
MOVE VAR3 TO VAR12.
DISPLAY VAR12. |
output:
INFOSYS
RAJULAN
1234
INF8
I think last output supposed to be INFY..but why is it displaying as inf8?
Thanks,
Rajulan R.C |
|
Back to top |
|
|
rajulan
New User
Joined: 11 Jan 2008 Posts: 66 Location: India
|
|
|
|
I tried all the possiblities alphanumeric to numeric , alphabetic; numeric, alphabetic to alphanumeric and so on..only thing we can not do is alphabetic to numeric and numeric to alphabetic ...then we do we get soc4 and soc7?
big confustion i have ...
i have tested the possibilities...so i do not think i no need to look for the previous posts...kindly suggest me...
Thanks,
rajulan r.c |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Since you specified VAR12 as unsigned, COBOL insured that the high haqlf of the last digit was a hex 'F'......
Make it S9(4) and see what happens then..... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what is the hex value for 'Y'.
also, why are you doing MOVEs instead of NUMVAL,
which is the function to be used to 'move' alpha to numerics? |
|
Back to top |
|
|
rajulan
New User
Joined: 11 Jan 2008 Posts: 66 Location: India
|
|
|
|
To dick,
000001 Y
E4444444444444444444444444444
80000000000000000000000000000
To CiCs guy,
INFOSYS
RAJULAN
1234
INFH
thanks,
Rajulan R.C |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
I tried all the possiblities alphanumeric to numeric , alphabetic; numeric, alphabetic to alphanumeric and so on..only thing we can not do is alphabetic to numeric and numeric to alphabetic ...then we do we get soc4 and soc7?
big confustion i have ...
i have tested the possibilities...so i do not think i no need to look for the previous posts...kindly suggest me... |
Actually, not even close ... where's your COMP, COMP-1, COMP-2, COMP-3 variables? A numeric DISPLAY variable does not behave the same as a numeric COMP variable nor like a COMP-3 variable. Have you read the COBOL manuals (link at the top of the page) on moves? If not, you really need to start by reading the manuals (both Language Reference and Programming Guide), which will clear up most of your confusion. The LR, for example, in its discussion of elementary moves (just elementary items) defines 10 different types of sending fields and 9 types of receiving fields and discusses which of the 90 possible moves are allowed, with footnotes. |
|
Back to top |
|
|
|