Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Character validation on mainframe

Status
Not open for further replies.

DiamondDave2005

Programmer
Feb 12, 2002
9
0
0
US
Hi,
I know nothing about C, but we can run C programs on the mainframe here.
I'm trying to find a way to validate characters on an input file. We do this with Cobol, but need a different program for each file length.
With C, I think we could use one program that could handle any length input file, validate each character in a record, and write it out in the same format/length it was received.
Anyone got any ideas?
Thanks,
Dave
 
This should be an easy task. The code would look something like this...

main() {
char *buffer[LINE_MAX];
FILE *fp_r,*fp_w;
fp_r=fopen("filename","r");
fp_w=fopen("destination","w");

while ( fgets(fp_r,LINE_MAX,buffer) != NULL) {
if( validate_output(buffer) != 0) {
fputs(buffer,fp_w);
}
}
fclose(fp_r);
fclose(fp_w);
}

You will have to write the validate_output() function to validate the characters.
amit
crazy_indian@lycos.com

to bug is human to debug devine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top