Replace a character by variable number of spaces



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Replace a character by variable number of spaces

Postby ankushgattani » Thu Jul 03, 2014 2:33 pm

Hi,

I have a requirement and i wanted to know if anyone has any suggestions on how to go about it.

I have to search for a hex value (X'5F') in position (2,19). (there can be multiple occurences of this value, we've to process them all)
If this is found, I have to look at the next column hexadecimal value (it will be number, for ex x'10'). This number tells us how many SPACES are to be introduced.
So,
I have to replace
>(X'5F10') by 10 SPACES.
>(X'5F04') by 4 SPACES.
>(X'5F19') by 19 SPACES.

EXAMPLE:

Input record:
----+----1----+----2
DBERG¬.10206¬.OVER C
CCCDC51FFFFF50DECD4C
42597F010206F4655903


The output will be
---+----1----+----2----+----3-
DBERG          10206    OVER C
CCCDC4444444444FFFFF4444DECD4C
425970000000000102060000655903


Note : Along with this I had some 30 different conditions, which I was able to code with ICETOOL.
So if there are more than one ways to do it, I'd prefer ICETOOL :)

Thanks for your help in advance.
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Replace a character by variable number of spaces

 

Re: Replace a character by variable number of spaces

Postby BillyBoyo » Thu Jul 03, 2014 3:07 pm

Can you post what you have already then? Difficult to fit it into something we haven't seen :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Replace a character by variable number of spaces

Postby ankushgattani » Thu Jul 03, 2014 3:59 pm

actaully for every condition,I am reading the input file and applying the condition.
So all the steps are independent of each other.

I just wanted to use ICETOOL, so that I dont have to code a new step.
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post