Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: how to move s9(8)v99 field to s9(7)v99 com-3 field.
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    Post subject: Reply to: how to move s9(8)v99 field to s9(7)v99 com-3 field
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    Post subject: Reply to: how to move s9(8)v99 field to s9(7)v99 com-3 field
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

Site Director


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

PostPosted: Sat Dec 22, 2007 2:50 am    Post subject:
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    Post subject: Reply to: how to move s9(8)v99 field to s9(7)v99 com-3 field
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

Site Director


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

PostPosted: Sat Dec 22, 2007 3:52 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Dec 22, 2007 6:53 am    Post subject:
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    Post subject: VALID NUMERIC
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: 788
Location: Chennai, India

PostPosted: Sat Dec 22, 2007 11:31 am    Post subject:
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    Post subject: Reply to: how to move s9(8)v99 field to s9(7)v99 com-3 field
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us