No idea about cobol, but it's easy to
[list=1][*]declare a structure to define the format/type of data you want to store.[*]define an array of that structure to store all your data[*]load/save that array in a single operation[/list=1]
This is the 'C' answer.
Code:
#include <stdio.h>
#define MAX_RECORDS 100
struct foo {
char name[30];
char address[100];
char phone[20];
};
typedef struct foo foo_st;
foo_st records[MAX_RECORDS] = {
{ "Fred Flintstone", "Bedrock", "1234-5678" },
};
int main ( ) {
FILE *fp = fopen( "rec.bin", "wb" );
fwrite( records, sizeof(foo_st), MAX_RECORDS, fp );
fclose( fp );
return 0;
}