Ed

Ed

  • NA
  • 1
  • 0

parse a string into a structure

Dec 7 2009 1:28 PM
hello all, I want to take a file-record string (chars and numbers) and parse it into a structure. I can do this in COBOL, how to do it in VB.NET? The file records are fixed lengths and do not change. COBOL Example: file-record pic x(150) rec-specs redefines file-record rec-id pic 99 pro-date pc x(8) submitter pic x(50) process-time pic 9999 etc. (28 fields total) VB Example: structure rec-specs rec-id as integer pro-date as string submitter as string process-time as integer etc. (28 fields total) end structure This is a seq. file. One line will be read and processed, this way I can reference the individual elements directly. the problem is how do I define the length of the strings or integers within the structure? rec-id is always integer length 2 (max # is 99) pro-date is always string length 8 etc. Is there an easy way to do this? Thanks

Answers (1)