lynda.com
April 2nd, 2009, 08:56 PM
I need to return a set of values that will be used in a mainframe application. I am using C#. I have a set of record definitions like this:
Header record:
TranCode - 2 bytes - ASCII 00
Filler - 1 byte ASCII SPACE (0x20)
TranName - 26 bytes - ASCII value - Left justified - Pad with ASCII 0x20
DataRecord:
DataTypeVal - 2 bytes - ASCII 00 thru 28
DataValue - 18 bytes - ASCII numeric values
RecordDelimiter - 4 bytes - ASCII "END."
Well, you get the idea. There will also be a trailing record to finish things up and the data records can be more than one. Ultimately this will be written to a file that is transmitted to the mainframe and then digested there.
Just to clarify, all of the data will be static except for data record elements (and their supporting records). The goal is to produce a sealed class library that the consumer can instantiate, then iterate through some DB records and calling an ADD method and finally an Execute method. The class library would then build the record data, write it to a file, zip it and then send it to the destination via secure FTP.
I need a reccomended approach to representing this data structure that is byte position specific in C#.
Framework is .NET 2
Thanks in advance!
Header record:
TranCode - 2 bytes - ASCII 00
Filler - 1 byte ASCII SPACE (0x20)
TranName - 26 bytes - ASCII value - Left justified - Pad with ASCII 0x20
DataRecord:
DataTypeVal - 2 bytes - ASCII 00 thru 28
DataValue - 18 bytes - ASCII numeric values
RecordDelimiter - 4 bytes - ASCII "END."
Well, you get the idea. There will also be a trailing record to finish things up and the data records can be more than one. Ultimately this will be written to a file that is transmitted to the mainframe and then digested there.
Just to clarify, all of the data will be static except for data record elements (and their supporting records). The goal is to produce a sealed class library that the consumer can instantiate, then iterate through some DB records and calling an ADD method and finally an Execute method. The class library would then build the record data, write it to a file, zip it and then send it to the destination via secure FTP.
I need a reccomended approach to representing this data structure that is byte position specific in C#.
Framework is .NET 2
Thanks in advance!