Card to replace a range of coulmns with another range of col



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

Card to replace a range of coulmns with another range of col

Postby ghosts » Fri Mar 22, 2013 5:18 pm

Hi

I want to a card to replace a range of coulmns with another range of columns

My Challenge is to replace SPACES over a range of cols in a PS with another range of columns in the same record. I want to achieve this using sort. please help me

Example:(input record)
...... ....aaa

Expected o/p: (replaced spaces with 'aaa' belonging to same record)
......aaa....aaa
ghosts
 
Posts: 12
Joined: Fri Mar 22, 2013 5:11 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Card to replace a range of coulmns with another range of col

 

Re: Card to replace a range of coulmns with another range of

Postby enrico-sorichetti » Fri Mar 22, 2013 5:25 pm

search the forum for the OVERLAY dfsort keyword
( Or the dfsort manuals )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Card to replace a range of coulmns with another range of

Postby skolusu » Fri Mar 22, 2013 10:40 pm

ghosts,

The following DFSORT JCL will give you the desired results
//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
UPDATE VALUES1                                                       
UPDATE VALUES2                DON'T REPLACE ME                       
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  INREC OVERLAY=(31:1,30)
//*


The above will replace the contents at pos 31 for a length of 30 bytes with whatever you have in position 1 for 30 bytes.

However if your intention is to replace only if the contents are all spaces then you need to use IFTHEN to check for spaces and then replace. something like this
INREC IFTHEN=(WHEN=(31,30,CH,EQ,C' '),OVERLAY=(31:1,30))   
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
ghosts (Mon Mar 25, 2013 9:29 am)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Card to replace a range of coulmns with another range of

Postby ghosts » Mon Mar 25, 2013 8:51 am

Thanks skolusu, it worked for me.

this is my card, just for others

OPTION COPY                                             
INREC IFTHEN=(WHEN=(55,15,CH,EQ,C' '),OVERLAY=(55:75,15))


What can I do if I want to remove the old column (which was used for replace) from the PS file in the output....here....my file is a RECFM=VB and has a length of 85....

example of requirement:
input:
... ...aaa


expected o/p:
...aaa...
ghosts
 
Posts: 12
Joined: Fri Mar 22, 2013 5:11 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Card to replace a range of coulmns with another range of

Postby BillyBoyo » Mon Mar 25, 2013 1:04 pm

Use BUILD instead of OVERLAY.
  BUILD=(1,length-of-first-part,next-position-you-want,length-of-second-part)


So,

  BUILD=(1,10,21,20)


Will get bytes one for a length of 10 and 21 for a length of 20. Anything else on the input record "disappears".
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post