Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
niharika1234

New User

Joined: 01 May 2006
Posts: 9

 Posted: Fri Jan 05, 2007 2:02 pm    Post subject: How to covert data from x (18) to s9(15)99? Hi, There is a feild amount defined with pic x(18). This amount is then passed to another variable which is defined with pic s9(15)v99. But, the amount is not passed from 1st feild to second. What is the solution? Thanks

UmeySan

Active Member

Joined: 22 Aug 2006
Posts: 757
Location: Germany

 Posted: Fri Jan 05, 2007 3:19 pm    Post subject: Hi ! S9(15)V9(02) could import only 17 numerics. 15 before & 2 after the comma. For 9(18) use S9(16)V9(02) please. And if you use X(18) think of perhaps getting S0C7 ! Regards, UmeySan
tangentray

New User

Joined: 30 Dec 2006
Posts: 20
Location: Kolkata, India

 Posted: Fri Jan 05, 2007 5:27 pm    Post subject: I think just moving from an X(18) to a s9(15)V99 will work fine as long as the data contained in X(18) is all numeric. but there will be a justification issue as well as truncation issue. As pointed by UmeySan since ur numeric variable will contain only 17 numeric bytes so one byte will be truncated. Again X is left justified and 9 is right justified from decimal so when u move there will be a truncation issue. If u take a similar example where u move a X(6) to a s9(3)v99: when u have 999 in X(6) it actually conatains 999\$\$\$ where \$=space after moving also the s9(3)v99 will contain 999\$\$\$ and if u perform an arthmatic operation it will give SOC7. But if your X(6) has 999999 then your s9(3)v99 will have 99999 and u will not get an error. One other thing if you cosider size-wise then X(18) is 18 bytes and s9(15)v99 is also of 18 bytes (17 + 1 for the sign). The best way is to avoid moving X to 9 but if it cannot be avoided then u can use the following psedocode to handle: unstring X(18) delimited by space in another X(18) var move the second X(18) var to s9(16)v9 check s9(16)v99 is numeric or not before further action.
perez_a

New User

Joined: 02 Feb 2006
Posts: 25
Location: Italy

 Posted: Fri Feb 02, 2007 5:01 pm    Post subject: Re: How to covert data from x (18) to s9(15)99? Hi niharika, if you put in your x(18) var a number with the comma ex: 123456789112345,12 you can use this code: 01 x-num pic x(18). 01 x-num-red redefines x-num. 05 x-num-int pic x(15). 05 filler pic x(01). 05 x-mun-dec pic x(02). 01 w-int pic 9(15). 01 w-dec-temp pic 9(2). 01 w-dec pic 9v9(02). 01 number pic 9(15)v9(2). procedure division. move '123456789112345,12' to x-num move x-num-int to w-int move x-num-dec to w-dec-temp compute w-dec = w-dec-temp / 100 compute number = x-num-int + w-dec Alex
sachin_star3
Warnings : 1

New User

Joined: 30 Sep 2006
Posts: 78
Location: pune

 Posted: Mon Feb 05, 2007 2:10 am    Post subject: YOU CANT MOVE THE ALPHANUMERIC TO NUMERIC BUT VICE-VERSA IS NOT POSSIBLE,BUT THE ALPHANUMERIS CONTAINS ONLY NUMERIS THEN IT CAN POSSIBLE EXAMPLE: 01 ABC PIC X(18). 01 DEF REDEFINES ABC PIC S9(15)V9(2) ==================================
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us