Getting length of a field in characters within a structure
Posted: Tue Jun 05, 2007 2:53 pm
Hello folks.
I am having a problem and would be grateful for any help on this issue.
I have a structure of fixed length strings that I am putting inside an array. My problem is that I cannot find a way to get the length of a specific field within the structure once it has been created.
I am trying to create a random access file of records and I am using LSET to 'padd out' the data to make it uniform if a string is shorter than the definition within the structure.
Here is a little code to help explain things....
The last line shows the maximum length in characters (30) that the Fornames.s field should be padded out to with the LSET command. Obviously, I dont want to use the 30 at all and would just like to retrieve the previously defined lenght and put it in its place.
I have had a good look around and can't seem to find a command to get the length in characters of a specific field. I can get the length of the whole structure but not a specific field.
Any help on this would be great.
Many thanks, Prof.
I am having a problem and would be grateful for any help on this issue.
I have a structure of fixed length strings that I am putting inside an array. My problem is that I cannot find a way to get the length of a specific field within the structure once it has been created.
I am trying to create a random access file of records and I am using LSET to 'padd out' the data to make it uniform if a string is shorter than the definition within the structure.
Here is a little code to help explain things....
Code: Select all
Structure Student
Fornames.s{30}
Surname.s{25}
DOB_DD.s{2}
DOB_MM.s{2}
DOB_YY.s{2}
EndStructure
Dim Student_Array.Student(100)
Student_Array(0)\Fornames.s = "Andrew"+LSet(Student_Array(0)\Fornames.s,30)
I have had a good look around and can't seem to find a command to get the length in characters of a specific field. I can get the length of the whole structure but not a specific field.
Any help on this would be great.
Many thanks, Prof.