View previous topic :: View next topic |
Author |
Message |
sant_1028 Beginner
Joined: 23 Dec 2004 Posts: 8 Topics: 4
|
Posted: Thu Jan 27, 2005 10:25 am Post subject: Moving alphanumeric to COMP (SMALLINT) |
|
|
we are using cobol stored procedures. We want to conevrt alphanumeric to comp field in cobol.
Please see the following code. We are sending IN-AGE as '32' but in the database storing as 3200. Why we are missing here.
Code: |
WORKING STORAGE SECTION.
01 WS-MOV-AGE JUSTIFIED RIGHT PIC X(04) VALUE SPACES.
01 CNT-AGE PIC S9(4) COMP.
LINKAGE SECTION.
01 IN-AGE PIC X(04).
PROCEDURE DIVISION USING IN-AGE.
0100-BEGIN.
MOVE IN-AGE TO WS-MOV-AGE
MOVE WS-MOV-AGE TO CNT-AGE
// Storing cnt-age in db2 database.
|
Thanks,
Sant |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sun Jan 30, 2005 12:56 pm Post subject: |
|
|
Hi Sant,
You might want to try something like this (verify the syntax):
Code: | WORKING STORAGE SECTION.
01 WS-MOV-AGE PIC S9(04).
01 CNT-AGE PIC S9(4) COMP.
LINKAGE SECTION.
01 IN-AGE PIC X(04).
PROCEDURE DIVISION USING IN-AGE.
0100-BEGIN.
COMPUTE WS-MOV-AGE = FUNCTION NUMVAL(IN-AGE)
MOVE WS-MOV-AGE TO CNT-AGE
|
// Storing cnt-age in db2 database. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
|
|