Re: RUN statement with RETURNING - questions
Posted in 1994
vadim <vadim@mcs.spb.su> writes: >I have questions about RUN statement: >Lines: 24 >There is the only example into Reference Manual - >RUN "date_script" RETURNING error_val >1.Need I DEFINE error_val in 4GL function ? > ^^^^^^^^^ Yes, as a numeric of some type. >2.How I must to pass error_val from "date_script" to 4GL ? > ^^^^^^^^^ >I suppose that is not right such statements: > return(error_val) -- or > return error_val -- or > exit error_val? exit error_val will do for Unix shells, where error_val is a hard-coded value like your example below, or maybe $error_val if it is set within the shell. You can only return 1 value to the RUN command, it can only be numeric, and you have to divide the returned number by 256 to get the real value returned (insert some technobabble about high order bits here). So: DEFINE rtn INTEGER RUN "unixshell" RETURNING rtn LET rtn = rtn / 256 CASE WHEN rtn = 0 MESSAGE "All went well" WHEN rtn = 1 MESSAGE "Standard error from unixshell" WHEN rtn = 2 MESSAGE "Non-standard error from unixshell" END CASE >May be > exit 1 ???? >But where is error_val ? > ^^^^^^^^^ >Regards, >Vadim Ketchashin, St.-Petersburg, Russia