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 

Explicit sign and decimal point in file

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


Joined: 03 Dec 2002
Posts: 17
Topics: 5
Location: Columbus, GA

PostPosted: Sun Feb 29, 2004 4:21 pm    Post subject: Explicit sign and decimal point in file Reply with quote

Hi All,

My client want to see an explicit minus symbol and decimal point in a file using easytrieve.

This is an amount field of 6 pack 2 is moved to X(10).

For examples.
Code:

$-555.50  should be shown in a file has -00000055.50.


Its urgent and any suggestion will really help me out.
_________________
Regards,
Ganesh.B
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Mar 01, 2004 2:04 pm    Post subject: Reply with quote

Ganesh,

Easytrieve does not let you have a explicit symbol for negative as well as the imbedded decimal point when writting to a file. so you need to seperate them as different fields and move the approriate value.

Let us say your packed decimal value is defined as follows

Code:

IN-NUM     W 006 P 2


Now define the following fields in your output field for moving it to 10 byte character field.
Code:

OUT-NUM-SIGN          001  001 A
OUT-NUM-WHOLE         002  006 N 0
OUT-NUM-DPOINT        008  001 A
OUT-NUM-DECIMAL       009  002 N 0


Now define a working storage variable as follows:
Code:

W-NUM  W 008 N 2                       
W-NUM-WHOLE   W-NUM        006 N 0           
W-NUM-DECIMAL W-NUM   +006 002 N 0     


Now in your program code the following logic

Code:


  IF IN-NUM  < 0
     OUT-NUM-SIGN  = '-'
  ELSE
     OUT-NUM-SIGN  = '+'
  END-IF
 
  W-NUM   = IN-NUM

  OUT-NUM-WHOLE    = W-NUM-WHOLE
  OUT-NUM-DPOINT   = '.'
  OUT-NUM-DECIMAL  = W-NUM-DECIMAL


This will give you the desired results with sign and embedded decimal point.

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
GaneshB
Beginner


Joined: 03 Dec 2002
Posts: 17
Topics: 5
Location: Columbus, GA

PostPosted: Tue Mar 02, 2004 10:32 am    Post subject: Reply with quote

Thanks kolusu!!

I tried the way that you suggested and even I thought the same.But I am getting an Alpha value at the last byte(cozz the minus is imbedded) in my o/p.

For example

If the value of 6 P 2 is moved to X(10)(after conversion as per your suggestion).

Code:

for value -550.50 as -550.5{ or -555.51 as -555.5A


How to get rid of alpha value and special characters?.Is that I have to multiply by 10 or 100's?.

When I use the o/p amount value in another program to perform computation after eliminating Alpha value.Will I get the correct result.

Please advise.
_________________
Regards,
Ganesh.B
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 02, 2004 10:47 am    Post subject: Reply with quote

Ganesh,

It is not the alpha character at the end. Since the field is defined as signed zoned decimal , it show as characters. so change the definition of the decimal field as follows( just remove the zero after N)

Code:

OUT-NUM-DECIMAL       009  002 N


You will get the desired results.


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
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