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
 

 

Sort to subtract constant from variable in file/replace

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

New User


Joined: 07 Jan 2006
Posts: 7

PostPosted: Wed Oct 21, 2015 1:08 am    Post subject: Sort to subtract constant from variable in file/replace
Reply with quote

Input record something like:

211x T 78989999 czt

I want to sort/subtract 78989999 from 99999999 to rebuild the record on output to have this:

211x T 20060101 czt

is that possible or should I use rexx?
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Oct 21, 2015 1:39 am    Post subject:
Reply with quote

Quote:
is that possible or should I use rexx?

Yes, possible with sort. How did you come to 20060101 when it should be 21010000?
Back to top
View user's profile Send private message
drarem

New User


Joined: 07 Jan 2006
Posts: 7

PostPosted: Wed Oct 21, 2015 2:16 am    Post subject:
Reply with quote

Transposed wrong number, I was guessing for a 9comps date.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed Oct 21, 2015 2:55 am    Post subject: Reply to: Sort to subtract constant from variable in file/replace
Reply with quote

Yes, you use INREC OVERLAY, starting with column of the field you want to change. You have your constant, you have SUB, you define your source-field and give a LENGTH= (same as input) for your result.
Back to top
View user's profile Send private message
drarem

New User


Joined: 07 Jan 2006
Posts: 7

PostPosted: Wed Oct 21, 2015 5:11 am    Post subject:
Reply with quote

ack.. but now I see I need to do it to the packed field (comp3)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed Oct 21, 2015 11:37 am    Post subject: Reply to: Sort to subtract constant from variable in file/replace
Reply with quote

No problem, just use PD in the field definition. Just try a simple example.
Back to top
View user's profile Send private message
drarem

New User


Joined: 07 Jan 2006
Posts: 7

PostPosted: Wed Oct 21, 2015 11:04 pm    Post subject:
Reply with quote

I tried this and runs ok but data is wrong.

OPTION COPY
INREC OVERLAY=(25:30,5,PD,SUB,-99999999,TO=PD,LENGTH=5)

date should be 19930101 in the same comp field output file.

Input file hex display of 9comp date in column 25.
-2----+----
-F----+----
-2----+----
-----------

FFFFFF00688
FFFFFF8099C

Output file results:

FFF10081
FFF2002C
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Oct 21, 2015 11:27 pm    Post subject:
Reply with quote

Bill has aready provided you a solution but you are not using correct offset it seems . Try,assuming you have 20 bytes input data in your original post. I leave it up to you to convert to PD (as you have changed your mind later) and use correct offset atleast and make a run.
Code:
OUTREC BUILD=(1,7,+99999999,SUB,8,8,ZD,EDIT=(TTTTTTTT),16,4)
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu Oct 22, 2015 1:27 am    Post subject: Reply to: Sort to subtract constant from variable in file/replace
Reply with quote

I think you don't understand what you are trying to do.

1. You are SUBTRACTING a NEGATIVE 99999999 which effectively means you are adding.

2. Even if you make those 9's positive (+), keep in mind, You are subtracting 99999999 From a value WHEREAS you should have subtracted the Value From 99999999

3. And Obviously, your compliments date doesn't start from column 30 and that is why you are not getting the desired result.

And the data is NOT wrong. It's your lack of ability to understand what you are doing.
Code:

INREC OVERLAY=(25:+99999999,SUB,30,5,PD,TO=PD,LENGTH=5)

.
Back to top
View user's profile Send private message
drarem

New User


Joined: 07 Jan 2006
Posts: 7

PostPosted: Thu Oct 22, 2015 1:44 am    Post subject:
Reply with quote

Wow, thanks. yes, I have no idea what I'm doing. You're right, I shouldn't beat up on the data, it's my results. I was wondering if I had it in the SUB/constant in the wrong place, and now I see what I did.


Using this I get the expected results, many thanks. Now I can get back to my 'normal' pile.

OPTION COPY
INREC OVERLAY=(25:+99999999,SUB,25,5,PD,TO=PD,LENGTH=5)
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 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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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