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

Trailing space needs to be removed.


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

New User


Joined: 05 Jul 2005
Posts: 31
Location: India

PostPosted: Wed May 03, 2006 10:50 am
Reply with quote

Hi,

My input file is having trailing spaces in all the fields and it needs to be removed. Can anyone help me in this?

My sample input file is,

Code:

----+----1----+----2----+----3----+----4----+----5--
********************************* Top of Data ******
0001595636 ,Swartzer                      ,JimmyJohn
0001612340 ,Elliott                       ,JimmyJohn
0001825645 ,Ontko                         ,JimmyJohn


My required output is,

Code:

0001595636,Swartzer,JimmyJohn
0001612340,Elliott,JimmyJohn
0001825645,Ontko,JimmyJohn


Can anyone help me in getting this output using sort or Eztrieve program?
Back to top
View user's profile Send private message
Ayyappan

New User


Joined: 05 Jul 2005
Posts: 31
Location: India

PostPosted: Wed May 03, 2006 11:04 am
Reply with quote

The input file is a fixed length file and the layout is,

Fieldname Position
E_num 1-11
filler 12-12
Last_name 13-42 (If the last name field is having say 10 characters, then remaining 20 characters are having spaces and I want to remove them.)
filler 43-43
Fist_name 44-80

When I posted the input sample, the spaces got removed. Hence I am giving the layout.

The required output should not have any trailing spaces.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed May 03, 2006 8:17 pm
Reply with quote

You can use the new SQZ function available with z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to do this quite easily. If you don't have the April, 2006 DFSORT PTF installed, ask your System Programmer to install it. Here's the DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))
/*


For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Ayyappan

New User


Joined: 05 Jul 2005
Posts: 31
Location: India

PostPosted: Thu May 04, 2006 10:01 am
Reply with quote

Hi Frank,

Thanks for your reply. But in my shop I have only syncsort not dfsort. Hence I am getting syntax error if I use BUILD command. So, I used the following Eztrieve.

FILE INPUT
REC-IN 01 132 A
IN-EMPLID 01 11 A
IN-LAST-NAME 12 31 A
IN-FIRST-NAME 43 31 A

DEFINE WHOLE-THING W 134 A
DEFINE SECOND-PART W 134 A
DEFINE CONCAT-HOLD W 134 A
DEFINE CONCAT-SCAN CONCAT-HOLD 1 A INDEX CONCAT-NDX
DEFINE CONCAT-LENGTH W 2 P 0

JOB INPUT (INPUT)

WHOLE-THING = IN-EMPLID
SECOND-PART = IN-LAST-NAME
PERFORM CONCAT-NOSPACE
SECOND-PART = IN-FIRST-NAME
PERFORM CONCAT-NOSPACE
DISPLAY WHOLE-THING

CONCAT-NOSPACE. PROC
CONCAT-NDX = 133
CONCAT-HOLD = WHOLE-THING
DO WHILE CONCAT-SCAN EQ ' ' AND CONCAT-NDX GE 0
CONCAT-NDX = CONCAT-NDX - 1
END-DO
CONCAT-NDX = CONCAT-NDX + 1
CONCAT-LENGTH = 133 - CONCAT-NDX
MOVE SECOND-PART TO CONCAT-SCAN CONCAT-LENGTH
WHOLE-THING = CONCAT-HOLD
END-PROC
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu May 04, 2006 9:27 pm
Reply with quote

Quote:
in my shop I have only syncsort not dfsort. Hence I am getting syntax error if I use BUILD command


My job works fine with DFSORT. Syncsort does NOT support BUILD (although it does support the alias FIELDS) or SQZ.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts split a name based on space in ASM PL/I & Assembler 9
Search our Forums:

Back to Top