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

Changing negative packed decimal to positive packed decimal.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nightbuzzz

New User


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

PostPosted: Wed Aug 24, 2011 11:01 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 24, 2011 11:08 am
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Aug 24, 2011 11:10 am
Reply with quote

You cannot do this with JCL.
Back to top
View user's profile Send private message
nightbuzzz

New User


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

PostPosted: Wed Aug 24, 2011 11:22 am
Reply with quote

Then how exactly we can do it?

Regards
Mayank
Back to top
View user's profile Send private message
kratos86

Active User


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

PostPosted: Wed Aug 24, 2011 12:06 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 24, 2011 12:29 pm
Reply with quote

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
View user's profile Send private message
nightbuzzz

New User


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

PostPosted: Wed Aug 24, 2011 12:32 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 24, 2011 12:47 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Aug 24, 2011 10:58 pm
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
Search our Forums:

Back to Top