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

Sort to subtract constant from variable in file/replace


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
drarem

New User


Joined: 07 Jan 2006
Posts: 10

PostPosted: Wed Oct 21, 2015 1:08 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Oct 21, 2015 1:39 am
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: 10

PostPosted: Wed Oct 21, 2015 2:16 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 21, 2015 2:55 am
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: 10

PostPosted: Wed Oct 21, 2015 5:11 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 21, 2015 11:37 am
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: 10

PostPosted: Wed Oct 21, 2015 11:04 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Oct 21, 2015 11:27 pm
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: 446
Location: USA

PostPosted: Thu Oct 22, 2015 1:27 am
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: 10

PostPosted: Thu Oct 22, 2015 1:44 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top