Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups 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
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 268
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
References
Skolusu

DFSORT Developer


Joined: 07 Dec 2007
Posts: 944
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: 268
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: 268
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

Global Moderator


Joined: 23 Nov 2006
Posts: 13554
Location: 221 B Baker St

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: 268
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

Global Moderator


Joined: 23 Nov 2006
Posts: 13554
Location: 221 B Baker St

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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1