I have a use case to extract a varying length string where I need to add both 
prefix and suffix constants to the selected string.

The SORT PARSE operand doesn't seem to do the trick because the FIXLEN 
parameter to PARSE is required and the selected strings will be blank-padded to 
the FIXLEN length.

Is there any way to use SORT for this job or should I be looking at another 
utility?  I know I can also do the job using a simple awk script, but I wanted 
to see if SORT could do the job too.

The strings at issue happen to be classic dataset names, PDS.NAME(MBRNAME) 
format.  Input and output files are both RECFM=VB.

Example input:

SOME OTHER DATA HERE:DATA.NAME1(MBR001)
SOME OTHER DATA HERE:OTHER.DATA.NAME2(MBR002)
SOME OTHER DATA HERE:REALLY.LONG.PDS.DATASET.NAME(MBR003)

Sort control cards that I tried:

SORT FIELDS=(26,52,CH,A)
 SUM FIELDS=NONE
 OUTREC PARSE=(%00=(ABSPOS=26,ENDBEFR=BLANKS,FIXLEN=52)),
        BUILD=(1,4,C'PREFIX DATA:',%00,C':SUFFIX DATA')

Output looks like this:

PREFIX DATA:DATA.NAME1(MBR001)                                  :SUFFIX DATA
PREFIX DATA:OTHER.DATA.NAME2(MBR002)                            :SUFFIX DATA
PREFIX DATA:REALLY.LONG.PDS.DATASET.NAME(MBR003)                :SUFFIX DATA

Desired output would look like this:

PREFIX DATA:DATA.NAME1(MBR001):SUFFIX DATA
PREFIX DATA:OTHER.DATA.NAME2(MBR002):SUFFIX DATA
PREFIX DATA:REALLY.LONG.PDS.DATASET.NAME(MBR003):SUFFIX DATA

TIA for any advice you can offer.

Peter
--


This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to