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
 

 

Reversing signed integer value in file

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

New User


Joined: 11 Nov 2008
Posts: 27
Location: Canada

PostPosted: Thu Mar 21, 2013 12:27 am    Post subject: Reversing signed integer value in file
Reply with quote

00LCA2013031241096B
01LCA01010117160000476754010431512220130227 IV00000005CAALCAI4767540104
01LCA01010117160000476754010431512220130227 LCA 000053CAALCAI4767540104
01LCA01010146110000476754011347536220130227 IV00000023GAALCAI4767540113
01LCA01010146110000476754011347536220130227 LCA 000593GAALCAI4767540113
01LCA01010152790000476754014432947120130227 LCA 000001FAALCAI4767540144
99VSC03271F03271F00000{03271F00000{00000{00000A03271E00000{



Above file has got data records with "01" types(See the first two digits).
It has signed integer value in position (58,64).

I want to reverse these values from positive to negative, and negative to positive and it should stay in the same format and in same order.

for example 000005C should get converted to 000005L.

Can anyone please help me here?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Thu Mar 21, 2013 12:31 am    Post subject: Reply to: Reversing signed integer value in file
Reply with quote

the issue has been discussed quite a few times
hints OVERLAY, MUL, -1
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Thu Mar 21, 2013 1:07 am    Post subject: Reply to: Reversing signed integer value in file
Reply with quote

OVERLAY,+0,SUB :-)
Back to top
View user's profile Send private message
skgupta81

New User


Joined: 11 Nov 2008
Posts: 27
Location: Canada

PostPosted: Thu Mar 21, 2013 3:41 am    Post subject: Below code worked but still.....
Reply with quote

Hi Below code worked for positive values but not for negative values in a way I want the output.

This code converts the last byte from positive to negative, i mean J to A, K to B and so on..
but does not convert negative to positive the same way.. I mean it converts J to 1, K to 2 but not in A or B.

I need the last byte as sing byte.. I mean if its positive.. 1-9 should be replaced by A to I.

Let me know if you need more information.


Code:
OPTION COPY                                                         
   INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),                           
                      OVERLAY=(58:58,7,ZD,MUL,-1,TO=ZD,LENGTH=7))   
END


Code'd
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Thu Mar 21, 2013 4:08 am    Post subject: Reply to: Reversing signed integer value in file
Reply with quote

You can try this:

Code:
     OPTION COPY
                                             
   INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),
                  OVERLAY=(58:+0,
                            SUB,
                              58,7,ZD,
                            TO=ZDC,LENGTH=7))
   END



The key thing is the TO=ZDC, which will also make your existing code work.

If you look at the data-types in the DFSORT manuals, you'll find out why your existing code does what it does.
Back to top
View user's profile Send private message
skgupta81

New User


Joined: 11 Nov 2008
Posts: 27
Location: Canada

PostPosted: Thu Mar 21, 2013 5:01 am    Post subject: Bingo
Reply with quote

Perfect.. Thanks a million....
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 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


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