Custom sperform not using DBCENTURY
Posted in 2000
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01BF5951.539D0C4C Content-Type: text/plain; charset="iso-8859-1" I have a few customized sperform c programs that are not seeing my DBCENTURY variable. All users use a UNIX shell script at logon and I have set DBCENTURY=C and export it in that script. Any forms that run using sperform will put current dates entered with the two digit 00 as year 2000, but my custome performs enter 1900. Do I need to set this in my c programs or in onconfig? We have HP-UX 10.2 and Informix 7.2. The c programs basically pick out screen information to get a travel order number, sequence number or generate some $ amount we require. I am not a c programmer, but they seem pretty simple. Two are attached. Thanks for your help Deb Nicke <<tripperf.c>> <<toperf.c>> ------_=_NextPart_000_01BF5951.539D0C4C Content-Type: application/octet-stream; name="tripperf.c" Content-Disposition: attachment; filename="tripperf.c" /** toperf.c **/ #include <stdio.h> #include "ctools.h" extern perfvalue gettrip(); extern long ltoa(); struct ufunc userfuncs[] = { "gettrip",gettrip, 0,0 }; /******************************** GETTRIP ***********************************/ perfvalue gettrip() { long seconds, time(); struct tm *timerec, *localtime(); int fy,seq, mon, i,j; static char s1[] = "TA-"; char cseq[4], tnum[7], amon; FILE *infile, *outfile; seconds = time( (long *) 0); timerec = localtime(&seconds); pf_getval("fy", &fy, CINTTYPE,0); if (fy == 1997) { infile = fopen("tripseq97", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tripseq97", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(cseq, CCHARTYPE, "f010"); } else if (fy == 1998) { infile = fopen("tripseq98", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tripseq98", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(cseq, CCHARTYPE, "f010"); } else if (fy == 1999) { infile = fopen("tripseq99", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tripseq99", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(cseq, CCHARTYPE, "f010"); } else if (fy == 2000) { infile = fopen("tripseq00", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tripseq00", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(cseq, CCHARTYPE, "f010"); } } /***************************** ITOA ***************************************** Internal routine -- converts long to ascii */ itoa(n,s) int n; char s[]; { int i, sign, x; if ((sign = n) < 0) n = -n; i=0; if (n < 10) { x = (n % 10) + 48; s[i++] = x ; } else do { x = (n % 10) + 48; s[i] = x ; ++i; } while ((n /= 10) > 0); if (sign < 0) s[++i] = '-'; s[i] = '\\0'; reverse(s); } reverse(s) /* Internal routine -- called by itoa // reverses a string */ char s[]; { int c, i, j; for (i=0, j = strlen(s) -1; i < j; i++, j--) { c = s[i]; s[i] = s[j]; s[j] = c; } } /***************************** LTOA ***************************************** Internal routine -- converts long to ascii */ long ltoa(n,s) long n; char s[]; { long i, sign, x; if ((sign = n) < 0) n = -n; i=0; if (n < 10) { x = (n % 10) + 48; s[i++] = x ; } else do { x = (n % 10) + 48; s[i] = x ; ++i; } while ((n /= 10) > 0); if (sign < 0) s[++i] = '-'; s[i] = '\\0'; reverse(s); } ------_=_NextPart_000_01BF5951.539D0C4C Content-Type: application/octet-stream; name="toperf.c" Content-Disposition: attachment; filename="toperf.c" /** toperf.c **/ #include <stdio.h> #include "ctools.h" extern perfvalue gettano(); extern long ltoa(); struct ufunc userfuncs[] = { "gettano",gettano, 0,0 }; /******************************** GETTONO ***********************************/ perfvalue gettano() { long seconds, time(); struct tm *timerec, *localtime(); int fy,seq, mon, i,j; static char s1[] = "TA-"; char cseq[4], tnum[7], amon; FILE *infile, *outfile; seconds = time( (long *) 0); timerec = localtime(&seconds); pf_getval("fy", &fy, CINTTYPE,0); if (fy == 1997) { infile = fopen("tvlnoseq97", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tvlnoseq97", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(tnum, CCHARTYPE, "f3"); } else if (fy == 1998) { infile = fopen("tvlnoseq98", "r"); fscanf(infile, "%d", &seq); fclose(infile); ++seq; outfile = fopen("tvlnoseq98", "w"); fprintf(outfile,"%d",seq); fclose(outfile); itoa(seq,cseq); for (j=0; s1[j] != '\\0'; ++j) tnum[j] = s1[j]; tnum[j] = '\\0'; for (i=0; i<3-strlen(cseq);++i) strcat(tnum, "0"); strcat(tnum,cseq); pf_putval(tnum, CCHART