From: Hudson R. <hud...@so...> - 2002-08-13 15:56:01
|
Hi Boris! > I don't understand what you want here. Do you want the routines translated > into COBOL or an explanation of how to use them from COBOL? I would like an explanation of how to use them from COBOL, what kind of variable, which parameters are necessary to pass to C routine and which parameters return to COBOL program. I tried to look test.code examples, but I DO not understand how to pass and receive parameters from COBOL to C and from C to COBOL. :( I don't know C, but I know some commands(as printf, if, return), and, trying to know if the parameters passed by COBOL are received by C routine, I modified the cgi-util.c file, putting a printf before the return(to show the values returned from C routine in screen), see: ex: cgi_getcookie routine --------------------- printf(cookie_name); printf(cookieval); return(cookieval); cgi_goodemailaddress routine ---------------------------- printf("0"); return 0; printf("1"); return 1; I notice that the values have been passed through C routine and they are showed in the screen in output form, but I don't know how to receive this values from C routines passing through COBOL. How could I get the return value of C routines from a COBOL program? I believe that it's something like the examples below(to routines cgi_goodemailaddress and cgi_getcookie), but it isn't working. :( cgi_goodemailaddress routine. ----------------------------- data division. working-storage section. 77 wsEmail pic x(040) value spaces. 77 wsEndOfString pic x(001) value low-values. 77 wsParameter pic x(045) value spaces. 01 wsReturn pic 9(001) value zeros. 88 InvalidEmail value 0. 88 ValidEmail value 1. procedure division. string wsEmail wsEndOfString into wsParameter call "cgi_goodemailaddress" using wsParameter wsReturn evaluate true when InvalidEmail display "Uh.. Invalid Email" when ValidEmail display "Yes! Valid Email" when other display "error calling cgi_goodemailaddress routine" end-evaluate stop run cgi_getcookie routine --------------------- data division. working-storage section. 77 wsCookieName pic x(015) value "TinyCOBOLCookie". 77 wsCookieValue pic x(200) value spaces. 77 wsEndOfString pic x(001) value low-values. 77 wsParameter pic x(035) value spaces. procedure division. string wsCookieName wsEndOfString into wsParameter call "cgi_getcookie" using wsParameter wsCookieValue display wsCookieValue stop run What do you think? Could you help me? Thanks Hudson |