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
 
How to trim blanks between fields?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Jun 29, 2009 5:25 pm    Post subject: How to trim blanks between fields?
Reply with quote

hi, I want to connect two fields without the blanks with them.

For the following input:
Code:

  コマンド  ===>                 
----+----1----+----2----+----3----
*********************************
    AB  CD E    FGH I J   KL M N 
   1AB 2CD    EFFGH I J   KL M N 
*********************************


field one is between column 1 and 15 (including the 15th column)
field two is between column 16 and 34

the output will be like this:
Code:

----+----1----+----2----+----3---
*********************************
AB  CD EFGH I J   KL M N         
1AB 2CD    EFFGH I J   KL M N   
*********************************


The requirement is:
1. blanks on the head or between two fields is moved, and the two fields is merged.
2. blanks in a specific fields is not moved.

In other words,
Blanks that on the two sides of a field is trimmed.
other blanks is not touched.

Can anybody help to realize this?

Thanks in advance.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 29, 2009 9:21 pm    Post subject:
Reply with quote

dejunzhu,

I assumed that your input is FB RECFM and 80 bytes in length and the field to be squeezed together starts in position 12.

Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
----+----1----+----2----+----3----+----4---
    AB  CD E    FGH I J   KL M N           
   1AB 2CD    EFFGH I J   KL M N           
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  INREC IFTHEN=(WHEN=(12,1,CH,GT,C' '),   
  OVERLAY=(13:13,68,JFY=(SHIFT=LEFT)))     
  OUTREC OVERLAY=(1:1,80,JFY=(SHIFT=LEFT))
/*
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Jun 30, 2009 7:14 am    Post subject:
Reply with quote

HI,Skolusu
I'm sorry, but I'm afraid that I did not state my requirement clearly.

in the above example, we cannot determine from which column blanks start.
(You assume blanks start from column 12...)

that's to say, input file can be like this:
Code:

----+----1----+----2----+----3----+----4---     
    AB  CD E    FGH I J   KL M N               
   AB  CD E    FGH I J   KL M N                 
  AB  CD E       FGH I J   KL M N               
   1AB 2CD    EFFGH I J   KL M N               
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Jul 01, 2009 10:23 am    Post subject:
Reply with quote

It seems that DFsort does not have the ability to produce the following result for the above input.
Code:

----+----1----+----2----+----3----+----4---     
AB  CD EFGH I J   KL M N               
AB  CD EFGH I J   KL M N                 
AB  CD EFGH I J   KL M N               
1AB 2CD    EFFGH I J   KL M N     
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 Jul 01, 2009 7:23 pm    Post subject:
Reply with quote

Hello,

Quote:
It seems that DFsort does not have the ability

Suggest you not blame the product . . . Especially when you don't provide a proper definition of the requirement.

You say you want to "trim blanks between field" but your "solution" has multiple embedded blanks.

I suspect you are a programmer. . . . Someone who should already know the importance of such details. . .
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Jul 02, 2009 7:00 am    Post subject: Re: How to trim blanks between fields?
Reply with quote

hi, I want to connect two fields without the blanks with them.

For the following input:
Code:

----+----1----+----2----+----3----+----4---     
    AB  CD E    FGH I J   KL M N               
   AB  CD E    FGH I J   KL M N                 
  AB  CD E       FGH I J   KL M N               
   1AB 2CD    EFFGH I J   KL M N     


field one is between column 1 and 15 (including the 15th column)
field two is between column 16 and 34

the output will be like this:
Code:



----+----1----+----2----+----3----+----4---     
AB  CD EFGH I J   KL M N               
AB  CD EFGH I J   KL M N                 
AB  CD EFGH I J   KL M N               
1AB 2CD    EFFGH I J   KL M N     


The requirement is:
1. blanks on the head or between two fields is moved, and the two fields is merged.
==>field one is between column 1 and 15, and that is why there is no blank before 'A' and, between 'E' and 'F' in the output.
2. blanks in a specific fields is not moved.
==>That's why blanks from 'A' to 'E' is not removed.

In other words,
Blanks that on the two sides of a field is trimmed.
other blanks is not touched.


I wonder if I had state myself clearly enough?
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: Thu Jul 02, 2009 8:43 am    Post subject:
Reply with quote

Hello,

Quote:
I wonder if I had state myself clearly enough?
I now much better understand the requirement - thanks for the clarification icon_smile.gif

We'll see what suggestions are posted.

FWIW - in the future, it will probably be helpful if the sample data is something people can relate to instead of "alphabet soup" icon_wink.gif
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm

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