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
 
How to reverse a string using DFSORT?

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

New User


Joined: 15 Mar 2012
Posts: 5
Location: India

PostPosted: Wed Jan 22, 2014 6:07 pm    Post subject: How to reverse a string using DFSORT?
Reply with quote

Hello All,

How to reverse a string for ex: "STUDENTS into STNEDUTS" using DFSORT?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Wed Jan 22, 2014 6:15 pm    Post subject: Reply to: How to reverse a string using DFSORT?
Reply with quote

pretty boring, but ...
use BUILD/OVERLAY moving byte per byte in reverse order
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jan 22, 2014 6:42 pm    Post subject: Reply to: How to reverse a string using DFSORT?
Reply with quote

You have to code the reverse. It is a rare need, so don't expect any built-in way to do it.

OVERLAY would be more exciting, because you'd need an extra byte.

BUILD creates a new current record, so no extra byte needed.

Examples with Fixed-length records:

Code:
BUILD=(3,1,2,1,1,1)


Would make ABC into CBA

Code:
OVERLAY=(3,1,2,1,1,1)


And bearing in mind the default start position for OVERLAY of 1 (for F, 5 for V) would make ABC into CBC, because by the time it gets to 1,1, that position has already been replaced by 3,1.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1542
Location: Andromeda Galaxy

PostPosted: Wed Jan 22, 2014 8:35 pm    Post subject:
Reply with quote

If you have the cusion of using COBOL (FUNCTION REVERSE ) would be handy...
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 683
Location: Pennsylvania

PostPosted: Wed Jan 22, 2014 8:42 pm    Post subject:
Reply with quote

If the data is not too large, you could write a small Rexx exec.

This would help with different length fields and eliminate trailing spaces becoming leading spaces (with a Strip function).

You could run it in batch.

I guess more complete requirements would help (as usual).
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

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