View previous topic :: View next topic
|
Author |
Message |
nightbuzzz
New User
Joined: 04 May 2007 Posts: 21 Location: kuala lumpur
|
|
|
|
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 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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? |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
You cannot do this with JCL. |
|
Back to top |
|
|
nightbuzzz
New User
Joined: 04 May 2007 Posts: 21 Location: kuala lumpur
|
|
|
|
Then how exactly we can do it?
Regards
Mayank |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
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. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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? |
|
Back to top |
|
|
nightbuzzz
New User
Joined: 04 May 2007 Posts: 21 Location: kuala lumpur
|
|
|
|
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 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
Back to top |
|
|
|