MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Moving alphanumeric to COMP (SMALLINT)

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
sant_1028
Beginner


Joined: 23 Dec 2004
Posts: 8
Topics: 4

PostPosted: Thu Jan 27, 2005 10:25 am    Post subject: Moving alphanumeric to COMP (SMALLINT) Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jan 27, 2005 10:28 am    Post subject: Reply with quote

Sant_1028,


Check this link which might be of some help

http://www.mvsforums.com/helpboards/viewtopic.php?t=2429&highlight=justified

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Sun Jan 30, 2005 12:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group