View previous topic :: View next topic
Author
Message
sreedharkonduru New User Joined: 25 May 2011Posts: 7 Location: India
Hi Everybody,
I have a file with LRECL=2165 and Record Format is FB which contains records. Each field is separated by " | " in a record. I have leading and trailing spaces for few fields. Please see the data below.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2----+----3
18900001|02/28/2005 |STEEL SURCHARGE | 00600 |CICP |Other Miscellaneous |200 Industrail BLVD|...... data continues
My requirement is to remove the leading and trailing spaces in each field but should retain spaces in between. The data should appear like below.
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+-
18900001|02/28/2005|STEEL SURCHARGE|00600|CICP|Other Miscellaneous|200 Industrail BLVD|..... data continues
I went through this forum tried SORT in order to perform this but I am unable to. Please see my code below.
Code:
//TWR000BS JOB (TWR1,,,999),'SPCREMVL1',NOTIFY=&SYSUID,
// CLASS=M,MSGCLASS=V
//*
//SORT1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TWR.INFILE.DT0524,DISP=SHR
//SORTOUT DD DSN=TWR.OUTFILE.DT0524.SORT,DISP=SHR
//SYSIN DD *
OPTION COPY
OUTREC FINDREP=(IN=C' ',OUT=C''),
FINDREP=(IN=C' |',OUT=C'|'),
FINDREP=(IN=C'| ',OUT=C'|')
/*
//
But the above job is abending with S000 U0016. Please see the sysout below.
Code:
SYSIN :
OPTION COPY
OUTREC FINDREP=(IN=C' ',OUT=C''),
*
FINDREP=(IN=C' |',OUT=C'|'),
FINDREP=(IN=C'| ',OUT=C'|')
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Output file also should have LRECL=2165.
Please give me a solution for this. I apprecite any help. Thanks.
Back to top
dbzTHEdinosauer Global Moderator Joined: 20 Oct 2006Posts: 6966 Location: porcelain throne
Quote:
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hello,
I believe that your SYNCSORT product is not up to date and does not support FINDREP operator
Back to top
sreedharkonduru New User Joined: 25 May 2011Posts: 7 Location: India
Mates,
The version that we have is SYNCSORT FOR Z/OS 1.2.3.1N
Is there any alterantive solution apart form using FIDNREP?
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hello,
I am not sure what latest version of SYNCSORT you would need for FINDREP,
We have SYNCSORT FOR Z/OS 1.3.2.1R and FINDREP works fine,
One more thing,
Quote:
OUTREC FINDREP=(IN=C' ',OUT=C''),
FINDREP=(IN=C' |',OUT=C'|'),
FINDREP=(IN=C'| ',OUT=C'|')
is incorrect syntax.
Correct syntax is,
Code:
OUTREC FINDREP=(INOUT=(C' ',C'',C' |',C'|',C'| ',C'|'))
Tested Working.
I guess this can be done using PARSE, but I doubt your syncsort version may not supprot parse :S
If its a small file, you could use REXX or edit macros with Change all commands.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
Is there any alterantive solution apart form using FIDNREP?
If this is needed quickly, it would be a small bit of code to do what you want. . .
Back to top
nareshdacha New User Joined: 12 Jan 2010Posts: 66 Location: US
Sreedhar,
If all the fields are of fixed length then use the below code and Change it as per your requirement..
Hope this helps...
Code:
//STEP2 EXEC PGM=SORT
//SORTIN DD *
20100901021430|TEST|1234567890123456789|TEST1|A
20100901031531|TESTING|1234567890123456789|TEST|B
20100901031531|TESTING123|1234567453444534577|TEST2|C
20100901031531|TESTING|9876543210987654321|TEST4|G
//SORTOUT DD DSN=xxxxx.NARTEST.XXX,
// DISP=(NEW,CATLG),DCB=(RECFM=FB,LRECL=80),
// SPACE=(CYL,(10,10))
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,PARSE=(%1=(ENDBEFR=C'|',FIXLEN=14),
%2=(ENDBEFR=C'|',FIXLEN=20),
%3=(ENDBEFR=C'|',FIXLEN=20),
%4=(ENDBEFR=C'|',FIXLEN=05),
%5=(ENDBEFR=C'|',FIXLEN=01)),
BUILD=(%1,%2,%3,%4,%5))
Back to top
Please enable JavaScript!