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

Convert a negative numeric field to positive using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Oct 10, 2006 8:39 pm
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
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 Developer


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

PostPosted: Wed Oct 11, 2006 8:18 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top