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 

converting char field to comp field(s9(9))

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


Joined: 08 Sep 2004
Posts: 3
Topics: 2

PostPosted: Thu Sep 09, 2004 9:48 am    Post subject: converting char field to comp field(s9(9)) Reply with quote

A small change to my previous question. I meant how to convert Char to comp. Please advise
Back to top
View user's profile Send private message
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Thu Sep 09, 2004 10:04 am    Post subject: Reply with quote

tniast,

Simply move the Char variable to a Numeric variable and then this Numeric variable into a Comp variable.

Else, you can use a Redefine.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
tniast
Beginner


Joined: 08 Sep 2004
Posts: 3
Topics: 2

PostPosted: Thu Sep 09, 2004 10:09 am    Post subject: Reply with quote

This char variable might contain -ve value(for example -23) ?
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Sat Sep 11, 2004 1:57 am    Post subject: Reply with quote

Yesterday I had similar problem. Sign was at end, blank or space. Where input was like " 992.20 "

My sending field was X(11). I defined receiving as "S9(7)V9(2) SIGN TRAILING SEPARATE".

In sending field I replaced leading spaces by zeroes and trailing space by "+" using inspect verb.

I broke both sending and receiving fields into subfields - dollar, cents and sign (and filler in sending field).

Did a "MOVE CORR ..."

Hope I didn't miss out anything Smile
Back to top
View user's profile Send private message Send e-mail
vara prasad
Beginner


Joined: 01 May 2003
Posts: 2
Topics: 0

PostPosted: Mon Sep 13, 2004 5:53 am    Post subject: Reply with quote

In these type of cases, where a edited numeric fields to be converted to numeric fields, need to take care of following.
1. Fix up the sign position.
2. Know the max positions before and after decimal point.
3. Moving digits before decimal and after decimal to corresponding fields declared.
4. Using above 3, arrive a signed numeric field, which you can move to a comp variable.
_________________
Thanks & Regards,
Vara Prasad.
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