DB2 UDB for iSeries: Using CPYTOIMPF to trim blanks
110 pts.
0
Q:
DB2 UDB for iSeries: Using CPYTOIMPF to trim blanks
Mark is looking for an alternative to trimming blanks from the end of a record. He writes:

"I would like to use the CPYTOIMPF command only if I can Trim Blanks from end of Record. I found out how to do this in FTP, but would really like to stay on this path and avoid FTP using Override Inputs. I have a 60 byte alpha field and I need the last record to be EOF <CRLF> not EOF BLANK Blank ect..<CRLF>"

Do you have any suggestions?


Michelle Davidson
Editor
Search400.com
ASKED: Aug 16 2005  10:34 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
8025 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
We recently got this suggestion from a reader:

"You could try explicitly specifying: RCDDLM(*CRLF)
in your CpyToImpF command. It works for me we're running OS/400 V5R2."

-- Michelle

=====================================================

If the field being transferred is a CHAR field, then trailing spaces is correct and they should not be truncated. If the field is VARCHAR, then the trailing spaces shouldn't exist to be truncated.

If the field is CHAR and you want to convert it to VARCHAR, then you need to tell the system that that's what you want to do. One good way of doing that is with SQL DDL, since that's the language designed to communicate data formatting info to the database.

Create a VIEW that does the conversion and use the VIEW for input to CPYTOIMPF:

CREATE VIEW mylib/myview
(VCol1) AS
SELECT varchar(trim(CharCol1)) as VCol1
FROM mylib/mytable

That view converts column CharCol1 from the base table into VCol1 in the view. You can use iSeries Navigator or RUNSQLSTM to execute SQL if you don't have interactive SQL available.

Tom
Last Answered: Nov 1 2009  9:19 AM GMT by TomLiotta   8025 pts.
Latest Contributors: MichelleDavidson   110 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0