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

Author Message
nightbuzzz

New User

Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

 Posted: Wed Aug 24, 2011 11:01 am    Post subject: Changing negative packed decimal to positive packed decimal. Hi, I have got a query How can we convert Negative packed Decimal number to Positive packed decimal number using JCL. Thanks in Advance. Regards Mayank

Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Wed Aug 24, 2011 11:08 am    Post subject: Reply to: Changing negative packed decimal to positive packe Using JCL it is not possible. You need a program/utility. Why do you want to change -ve to +ve like that anyway? Data fix?
prino

Senior Member

Joined: 07 Feb 2009
Posts: 1072
Location: Oostende, Belgium

 Posted: Wed Aug 24, 2011 11:10 am    Post subject: You cannot do this with JCL.
nightbuzzz

New User

Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

 Posted: Wed Aug 24, 2011 11:22 am    Post subject: Then how exactly we can do it? Regards Mayank
kratos86

Active User

Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

 Posted: Wed Aug 24, 2011 12:06 pm    Post subject: Why do you want to change it anyway? Basic mathematics: Multiplying the value with a -1 will convert it into positive. Using SORT you can achieve it. Check it yourself.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Wed Aug 24, 2011 12:29 pm    Post subject: Reply to: Changing negative packed decimal to positive packe Multiplying by -1 will change any positives to negative. Also, better to subtract from zero. You need some program (like SORT, which one do you have). You need to test that the field in question is negative. Then do "whatever". But you still haven't answered why you want to do this?
nightbuzzz

New User

Joined: 04 May 2007
Posts: 21
Location: kuala lumpur

 Posted: Wed Aug 24, 2011 12:32 pm    Post subject: Its actually a temporary datafix that i need to make.. the file coming is having some reverse sign data that why for a while i need an idea to do this in JCL.. Regards Mayank
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Wed Aug 24, 2011 12:47 pm    Post subject: Reply to: Changing negative packed decimal to positive packe Has anybody already analysed the scale of the problem and the impacts? For instance, to people/companies whose data is held in your system? If you just "fix" the data, where is your audit trail? Who knows that the total of "fixed" items, value and number, is correct? Are your accountants/internal auditors happy with your approach? What about a nice program, that knows what it is doing, produces a report of what it is doing, and which can be run and signed-off by people with the authority to do so? Just whacking it with "JCL" strikes me as the wrong way to do it, with consequences down the line.
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Wed Aug 24, 2011 10:58 pm    Post subject:

Mayank,

You could use a DFSORT statements like the following. For the example, I assumed your PD field is in positions 5-7.

 Code: OPTION COPY    INREC IFTHEN=(WHEN=(5,3,PD,LT,0),       OVERLAY=(5:5,3,PD,MUL,-1,TO=PD,LENGTH=3))

Whether doing that is a good idea or not is up to you.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm

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