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

How to trim blanks between fields?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Wed Jul 01, 2009 7:23 pm
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
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

Moderator Emeritus


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

PostPosted: Thu Jul 02, 2009 8:43 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Delete file row if blanks in the firs... DFSORT/ICETOOL 5
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
Search our Forums:

Back to Top