IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to move s9(8)v99 field to s9(7)v99 com-3 field.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
earla

New User


Joined: 17 Oct 2007
Posts: 4
Location: india

PostPosted: Sat Dec 22, 2007 12:30 am
Reply with quote

hi,

my input copybook as a field named amt-adj pic S9(8)V99.

My output copybook as a field named pd-amt pic s9(7)v99 comp-3.

i have to move amt-adj to pd-amt.

input values are like this. i am copying from fileaid.

DISPLAY 000033467L
10/SNUM -3346.73

DISPLAY 000000702M
10/SNUM -70.24

DISPLAY 000000878R
10/SNUM -87.89

while compiling and executing the cobol, i am not facing any errors. But while loading to database, i am facing data exception error.

please help me, how to move exact contents to the output field.
Back to top
View user's profile Send private message
suny_sn1

New User


Joined: 26 Jun 2007
Posts: 6
Location: India

PostPosted: Sat Dec 22, 2007 1:40 am
Reply with quote

Hi..I think redefining the s9(8)v99 varibale sud do the job....i m on vacations so cudnt try it out icon_sad.gif
lookin forward for your reply
Back to top
View user's profile Send private message
earla

New User


Joined: 17 Oct 2007
Posts: 4
Location: india

PostPosted: Sat Dec 22, 2007 1:46 am
Reply with quote

hi..

please suggest some definitions that i can try out
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 22, 2007 2:50 am
Reply with quote

Hello Earla and welcome to the forums,

Quote:
DISPLAY 000033467L
10/SNUM -3346.73
33467L is the zoned-decimal value for your amt-adj. The "actual" value is -3346.73 when the value is edited for readability. Neither is a comp-3 value.

If you execute the move posted ("move amt-adj to pd-amt"), and the value in adj-amt is not larger than pd-amt will hold, you will have a valid comp-3 number. The hex for this comp-3 number would be x'000334673D'.

I do not understand "10/SNUM".

I'd suggest you look at the output of the cobol program and verify the data is in the proper format.

If a subsequent load fails, it sounds like a mis-match between the cobol code and the table definition.
Back to top
View user's profile Send private message
earla

New User


Joined: 17 Oct 2007
Posts: 4
Location: india

PostPosted: Sat Dec 22, 2007 3:11 am
Reply with quote

Hi dick,

thanks for your valuable response.

the following is the output i got from the cobol

input field - AMOUNT-ADJUSTED: 000033467C
output field - PD-AMT: 000334673

i am wondering about the sign and decimal point.

please let me know is the mapping s9(8)v99 to s9(7)v99 comp-3 can be directly moved or some intermediate things need to be done.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 22, 2007 3:52 am
Reply with quote

Hello,

Quote:
i am wondering about the sign and decimal point.
The sign is represented differently with zoned-decimal and packed decimal. My earlier reply shows the difference of a value in zoned- versus packed-decimal. If it is not clear, let me know and i'll try to clarify.

In both cases, the decimal point is implied rather than explicit. When you define a number with 9(n)V99, the "V" tells the system that calculations or data movement should scale the decimal at that position in the number.

Quote:
s9(8)v99 to s9(7)v99 comp-3 can be directly moved
Yes, a value can successfully be moved from a zoned-decimal field ( s9(8)v99 ) to a packed-decimal field ( s9(7)v99 comp-3 ). No intermediate code is needed.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sat Dec 22, 2007 5:10 am
Reply with quote

Dick,

The 10/SNUM is from FileAid saying it is 10 bytes signed numeric.

And while a direct move can happen, it could overflow and you could lose data. If the S9(8)V99 fills all othe the positions with signification digits when you move to the S9(7)V99 you will lost the most significant digit.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 22, 2007 6:53 am
Reply with quote

Hi Steve,

Quote:
The 10/SNUM is from FileAid
Thanks icon_smile.gif

for Earla,

Has the data exception been ersolved?
Back to top
View user's profile Send private message
Nsuma

New User


Joined: 10 Dec 2007
Posts: 13
Location: Hyd

PostPosted: Sat Dec 22, 2007 11:18 am
Reply with quote

HI ALL,
In my application I have one rate-filed,
From the file some times I am getting value as some 19.24
But when I validate the rate-filed with is numeric clause it is giving not numeric result, but this rate is valid for my application, how to take this rate-filed is valid at this rate (19.24) in this situation.
Pic clause of rate-field is s9(10)v99.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Sat Dec 22, 2007 11:31 am
Reply with quote

Nsuma,

Instead of asking in other threads, please start as a fresh topic.
Back to top
View user's profile Send private message
earla

New User


Joined: 17 Oct 2007
Posts: 4
Location: india

PostPosted: Mon Dec 24, 2007 12:24 pm
Reply with quote

hi all,

thanks for your valuable suggestions and replys.

my data exception error has been resolved.

i found that we can directly move the s9(8)v99 to s9(7)v99 comp-3.

this issue happened because of the copybook layout of previous fields. thanks for your support otherwise i wouldn't have found the issue.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top