Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Removing leading and trailing spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Removing leading and trailing spaces
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: 6970
Location: porcelain throne

PostPosted: Wed May 25, 2011 12:55 pm    Post subject:
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: 1532
Location: Chennai

PostPosted: Wed May 25, 2011 1:34 pm    Post subject:
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    Post subject:
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: 1532
Location: Chennai

PostPosted: Wed May 25, 2011 5:07 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 25, 2011 9:16 pm    Post subject:
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    Post subject: Reply to: Removing leading and trailing spaces
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us