View previous topic :: View next topic
|
Author |
Message |
deepak.kec
New User
Joined: 26 Feb 2007 Posts: 71 Location: bangalore
|
|
|
|
Please let me know how it is possible to find out the length of the records present in the flat file.
I have tried using LENGTH condition but couldn't reach to solution. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Can we presume that you're NOT looking to determine the dataset's LRECL? If so, what do you consider to be the "length of records"? The REXX LENGTH function would return the length of a given string. If that string was an entire record, then using that function should work for you. |
|
Back to top |
|
|
deepak.kec
New User
Joined: 26 Feb 2007 Posts: 71 Location: bangalore
|
|
|
|
I want to know know the number of characters of the record not the LRECL.
For example: a dataset whose LRECL is 80 and have records present in it is "ABCD".
So i want to know the number of character of record which is 4.
It would be helpful to me if you can give an example for using the LENGTH condition for the problem stated.
Thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
in the manual, look at the STRIP function. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I can see no reason why the length function does not give you what you want.
I have used it myself in the past for the very same reason and experienced no problems. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
expat,
length will give him the 80.
he wants to remove trailing spaces, and only count char (> space)
(yes, his wording was characteristic of this site,
thus making his requirement rather difficult to understand).
that's why i suggested that he incorporate the STRIP function.
otherwise, I have no idea what the TS wants - (other than the code). |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
dbz,
Mmmmmmmm, another case of further posts added while I was
a) typing my reply
b) interupted from (a) by work |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
You are both right! Use LENGTH and STRIP.
Code: |
rec_length = length(strip(record.a))
|
|
|
Back to top |
|
|
|