Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need urgent suggestion on DFSORT subratarec DFSORT/ICETOOL 6 Wed Mar 21, 2018 8:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us