If I understand things correctly, you could use Squeeze (SQZ) to eliminate the 
embedded blanks.
Something like SQZ=(SHIFT=LEFT).
Maybe you will need another SORT step to squeeze the entire record?

Thanks,

.......Cameron

From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Farley, Peter x23353
Sent: Saturday, April 2, 2022 3:45 PM
To: [email protected]
Subject: [External] SORT question: Extract varying length string adding suffix 
after string?

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<https://isolate.menlosecurity.com/1/3735928037/http:/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<https://isolate.menlosecurity.com/1/3735928037/http:/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<https://isolate.menlosecurity.com/1/3735928037/http:/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<https://isolate.menlosecurity.com/1/3735928037/http:/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]<mailto:[email protected]> with 
the message: INFO IBM-MAIN
________________________________
American Express made the following annotations
________________________________
This e-mail was sent to you by a representative of Amex Bank of Canada, P.O. 
Box 3204, Station "F", Toronto, ON, M1W 3W7, www.americanexpress.ca. If you no 
longer wish to receive these e-mails, please notify the sender by reply e-mail.

This e-mail is solely for the intended recipient and may contain confidential 
or privileged information. If you are not the intended recipient, any 
disclosure, copying, use, or distribution of the information included in this 
e-mail is prohibited. If you have received this e-mail in error, please notify 
the sender by reply e-mail and immediately and permanently delete this e-mail 
and any attachments. Thank you.

American Express a fait les remarques suivantes
Ce courriel vous a ?t? envoy? par un repr?sentant de la Banque Amex du Canada, 
C.P. 3204, succursale F, Toronto (Ontario) M1W 3W7, www.americanexpress.ca. Si, 
par la suite, vous ne souhaitez plus recevoir ces courriels, veuillez en aviser 
les exp?diteurs par courriel.

Ce courriel est r?serv? au seul destinataire indiqu? et peut renfermer des 
renseignements confidentiels et privil?gi?s. Si vous n'?tes pas le destinataire 
pr?vu, toute divulgation, duplication, utilisation ou distribution du courriel 
est interdite. Si vous avez re?u ce courriel par erreur, veuillez en aviser 
l'exp?diteur par courriel et d?truire imm?diatement le courriel et toute pi?ce 
jointe. Merci.

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

Reply via email to