trim
Moderators: chulett, rschirm, roy
trim
I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
satya
Re: trim
SQL TYPE IS VARCHARsatya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
satya
Re: trim
THERE ARE BOTH VARCHAR TRIED BY USING TRIM(FIELD).satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
NOT RESOLVED
satya
vi the file, press the $ key by holding down the Esc key, does the currsor end up on the last character or after the last character? You might be seeing spaces in the view data but thats just the display definition. There might not be a space.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Re: trim
satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
THERE ARE SPACES COMING UP IN THE FIELD, IF I VIEW IN VI EDITOR THE CURSOR ENDS WHERE IT IS SUPPOSED TO BE.
WHEN I AM USING THE PROPERTY AS FIXED I AM HAVING THIS PROBLEM, HAD IT BEEN UNCHECKED ITS FINE.
satya
First of all, its bad ettiquetes to use all caps as its a sign of shouting.
Second of all, you should have mentioned this before that its a fixed width file. A fixed width file will be loaded with spaces to honor the length of the field. But that is if the type is set as 'char'.
Keep the spaces as it wont harm you. Trim it before loading to a table and you will be fine. Trim it before loading to a delimited flat file and you will be, yet again, fine.
Second of all, you should have mentioned this before that its a fixed width file. A fixed width file will be loaded with spaces to honor the length of the field. But that is if the type is set as 'char'.
Keep the spaces as it wont harm you. Trim it before loading to a table and you will be fine. Trim it before loading to a delimited flat file and you will be, yet again, fine.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Re: trim
Only for readability i have been using caps, I am not aware of this issue, new point i noted today.satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.
WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.
SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.
I TRIED ALL OPTIONS WITH TRIM.
EXAMPLE.
213107850
ANY IDEAS.
THANKS IN ADVANCE.
Thanks.
satya
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Maybe a COBOL programmer!
The data you get from the mainframe is fixed width. That is the basic source of the pad characters (spaces). Look at the imported table definition - choose the Layout tab and select COBOL to see what I mean.
You do need to trim the strings, even though your declared data type is VarChar. "FRED FLINTSTONE . . . " is a valid VarChar even with the trailing space characters.
![Wink :wink:](./images/smilies/icon_wink.gif)
The data you get from the mainframe is fixed width. That is the basic source of the pad characters (spaces). Look at the imported table definition - choose the Layout tab and select COBOL to see what I mean.
You do need to trim the strings, even though your declared data type is VarChar. "FRED FLINTSTONE . . . " is a valid VarChar even with the trailing space characters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.