IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Removing leading and trailing spaces


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sreedharkonduru

New User


Joined: 25 May 2011
Posts: 7
Location: India

PostPosted: Wed May 25, 2011 12:49 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 25, 2011 12:55 pm
Reply with quote

Quote:
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed May 25, 2011 1:34 pm
Reply with quote

Hello,

I believe that your SYNCSORT product is not up to date and does not support FINDREP operator icon_sad.gif
Back to top
View user's profile Send private message
sreedharkonduru

New User


Joined: 25 May 2011
Posts: 7
Location: India

PostPosted: Wed May 25, 2011 2:05 pm
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed May 25, 2011 5:07 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed May 25, 2011 9:16 pm
Reply with quote

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
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Wed Jun 01, 2011 2:09 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Cobol program with sequence number ra... COBOL Programming 5
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
Search our Forums:

Back to Top