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
 
Convert a negative numeric field to positive using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Tue Oct 10, 2006 5:47 pm    Post subject: Convert a negative numeric field to positive using SORT
Reply with quote

Can anyone let me know how to convert a negative numeric field to positive using SORT.

i.e., I have a flat file in which one column (AMOUNT) is having values like 100.00, -200.00, 450.00

I want the output like 100.00, 200.00, 450.00.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Oct 10, 2006 8:39 pm    Post subject:
Reply with quote

You can use INREC, OUTREC or OUTFIL with something like

(...,p,7,UFF,EDIT=(TTT.TT),...)

where p is the starting position of the input field. DFSORT's UFF format will extract the digits and ignore the sign. If you want more specific help, you need to give more details such as the starting position and length of the input field and the starting position and length of the output field and what you want the output field to look like (e.g. leading zeros? no leading zeros?).
Back to top
View user's profile Send private message
chinnielr

New User


Joined: 11 Jul 2005
Posts: 87

PostPosted: Wed Oct 11, 2006 1:36 pm    Post subject: Re: Convert a negative numeric field to positive using SORT
Reply with quote

Hi Frank,

Thanks for your reply.

But my Amount fields are of PD format and I want to remove the negative sign. The output format should have PD format.


starting poistion of input field = 21
length of input field = 8

starting position of output field = 21
length of output field = 8

both input and output positions and length are same I just want to remove the sign and the output should ahve the same format as input.

Thanks in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Oct 11, 2006 8:18 pm    Post subject:
Reply with quote

Quote:
But my Amount fields are of PD format and I want to remove the negative sign. The output format should have PD format.


Was I supposed to guess that or just read your mind? Please try to give all of the relevant information in the future.

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(21,8,PD,LT,+0),
    OVERLAY=(21:21,8,PD,MUL,-1,TO=PD,LENGTH=8))
/*

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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 4 Sat Aug 19, 2017 2:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 5 Sat Aug 19, 2017 1:51 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


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