K
KevinD
thank you for your helpful explanations.
In my first note I forgot to mention that my simple flatfile is a text
file with a newline character at the end thus I able to get an entire
record [ie. empid, dept, name and hiredate with one fgets()
statement].
Dave V. - I understand your description but as described above, I get
all 5 data fields in one file read using fgets.
I will try the fopen in binary form and fread as describe.
My COBOL example is from my IBM mainframe days (EBCDIC) and my new C
programming is on a DEC VAX circa 1989. So EBCDIC will not be an
issue.
I thought I should be able to read all 58 bytes + 1 byte (newline)
into a generic string variable then move that data to a structure. I
would have thought that a fixed record layout (i.e. think back to an
old keypunch card) would be a universal file concept but I guessed
wrong.
thanks again
kevin
~~~~~~
......
01 employee-record.
03 emp-id pic 9(5).
03 emp-dept pic x(5).
03 emp-name.
05 emp-name-last pic x(20).
05 emp-name-first pic x(20).
03 emp-hire-date.
05 emp-hire-date-mm pic 9(2).
05 emp-hire-date-dd pic 9(2).
05 emp-hire-date-yy pic 9(4).
read employee-flatfile into employee-record.
In my first note I forgot to mention that my simple flatfile is a text
file with a newline character at the end thus I able to get an entire
record [ie. empid, dept, name and hiredate with one fgets()
statement].
Dave V. - I understand your description but as described above, I get
all 5 data fields in one file read using fgets.
I will try the fopen in binary form and fread as describe.
My COBOL example is from my IBM mainframe days (EBCDIC) and my new C
programming is on a DEC VAX circa 1989. So EBCDIC will not be an
issue.
I thought I should be able to read all 58 bytes + 1 byte (newline)
into a generic string variable then move that data to a structure. I
would have thought that a fixed record layout (i.e. think back to an
old keypunch card) would be a universal file concept but I guessed
wrong.
thanks again
kevin
~~~~~~
......
01 employee-record.
03 emp-id pic 9(5).
03 emp-dept pic x(5).
03 emp-name.
05 emp-name-last pic x(20).
05 emp-name-first pic x(20).
03 emp-hire-date.
05 emp-hire-date-mm pic 9(2).
05 emp-hire-date-dd pic 9(2).
05 emp-hire-date-yy pic 9(4).
read employee-flatfile into employee-record.