View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I wonder if I had state myself clearly enough? |
I now much better understand the requirement - thanks for the clarification
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" |
|
Back to top |
|
|
|