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
 

 

Subtract a constant from a numeric field using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Oct 11, 2006 7:04 pm    Post subject: Subtract a constant from a numeric field using DFSORT
Reply with quote

Hi,

I need to Subtract 1000 from a numeric field in the file.

e.g.

File Layout

ABCD1234
ADGH2345....

my output should be
ABCD0234
ADGH1345

how can i do this using DFSORT.
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:38 pm    Post subject:
Reply with quote

You didn't say what format you wanted for the output, so I'll assume it's ZD. Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD *                                       
ABCD1234                                             
ADGH2345                                             
/*
//SORTOUT DD SYSOUT=*                               
//SYSIN    DD    *                                   
  OPTION COPY                                       
  INREC OVERLAY=(5:5,4,ZD,SUB,+1000,TO=ZD,LENGTH=4) 
/*
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Thu Oct 12, 2006 8:58 pm    Post subject:
Reply with quote

Thanks Frank, but the output is coming as

ABCD023D
DEFR134E

whereas it should be...
ABCD0234
ADGH1345

how to format it
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: Thu Oct 12, 2006 9:58 pm    Post subject:
Reply with quote

The job gives the correct output with DFSORT since DFSORT uses an F sign for TO=ZD or TO=ZDF and a C sign for TO=ZDC. So you must be using Syncsort which gives a C sign for TO=ZD. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Sat Oct 14, 2006 1:37 am    Post subject:
Reply with quote

Thanks Frank, sorry for raising the question in the wrong forum, but your replies did help me get the result using some syncsort formatting.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Sat Oct 14, 2006 1:39 am    Post subject:
Reply with quote

i used M11 formatting

//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1:1,4,5:5,4,ZD,SUB,+1000,M11,LENGTH=4)
/*
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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