Posted: Tue Aug 07, 2018 12:31 pm Post subject: Identify (not replace) spaces within a string.
Good day,
please let me know how to accomplish the following using DFSort.
Have an FB dataset, LRECL=80, where a 40 bytes product name field can have extra (>1) spaces between values.
There could be trailing spaces, but not leading.
I don't need to squeeze or shirt those values, just identify records with extra spaces in the product name and copy them to output.
Thanks.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Aug 07, 2018 1:25 pm Post subject:
ramy2016,
You can use INCLUDE COND=(35,40,SS,EQ,C' ') to include the records with 2 spaces , however this would also bring the records that have trailing spaces. So you need to pad the trailing spaces with some thing other than a space and then use the INCLUDE. So we use JFY to pad the trailing spaces with $ and put it at the end of the record and then use INCLUDE on the new field to find the records with 2 spaces.
So here is a sample.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAZZ12300000111...................METRIC UNIT CONVERTER
BBZZ12300000111...................CHART CONVERTER Z100DL
CCZZ12300000111...................FORCE
DDZZ12300000111...................ANGULAR ACCELERATOR
TEST RECORD WITH ALL SPACES
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:35,40,JFY=(SHIFT=LEFT,LENGTH=40,
TRAIL=C'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'))
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum