Re: output section
Posted in 1994
Pholks, I see so many questions out there about how to handle ace that I'm sending this out to y'all as well. Obviously there are some routines that we call that are sort of standard to any tool kit and I haven't reproduced them here. j. } } > } > } > Fellow sqler's and 4gler's, } > } > If this is a trivial question forgive me but.... } > } > Is there a way to "variablize" the report to statement so a user can input } > the destination, in either 4gl or ace reports. So far the only solution I } > was given was to have separate reports for separate destinations all } > hardcoded in the reports. This makes for many of the same reports all } > going to different printers or files. I'd like to cut down on duplicate } > reports. I have many. } > } > Thanks in advance } } Brian, } } Note this is a clip and as you can see there are a couple of other variables } we set first. } } Accept outdev } LPDEST=fgl_getenv("LPDEST") } file_name is also a 'got' variable } } CASE outdev } WHEN 0 } START REPORT report_name } WHEN 1 } LET rpt_pipe="lp -t`logname` -d", LPDEST CLIPPED } START REPORT report_name TO pipe rpt_pipe } WHEN 2 } START REPORT report_name TO filename } END CASE } } ----- } } All of our reports are run from a single 'report menu' 4gl pgm which does } a number of things including reading some options set up for that report } accepting others and generally figuring out how to handle the report. } This is a clip of the relevant section to deal with ace reports. } } One of our variables which is set for ace reports is RPT_DEST="LOCAL". } For programs which handle their own output we set it to "PROGRAM". This } way the report driver program knows if it has to handle the output or not. } } } LET tmp_fname = get_tmp_fname("") } LET run_cmd = "exec ", p_run_string CLIPPED, " ", opt_str clipped, } " > ", tmp_fname CLIPPED } } # where p_run_string in this case would be sacego -q report_name } } RUN run_cmd RETURNING rpt_return } } # rpt_option='o' means output to file, 'd' means display, 'p' means printer } } CASE } WHEN rpt_option = "o" {IF tmp file exists, move it } } CALL check_file(tmp_fname, length(tmp_fname) + 1) RETURNING file_status } IF (file_status = -1) THEN {file exists} } LET cp_cmd = "exec mv -f ",tmp_fname CLIPPED, " ", } rep_fname CLIPPED, " > /dev/null 2>&1 " } LET cp_cmd = cp_cmd CLIPPED } RUN cp_cmd } {check to see IF file was moved correctly by checking to see IF it exists} } CALL check_file(rep_fname) RETURNING file_status } IF (file_status != -1) THEN } DISPLAY "ERROR: Unable to write file: ", rep_fname at 22,1 } DISPLAY "ERROR: You can find your output in ", tmp_fname at 23,1 } END IF } END IF } WHEN rpt_option = "d" AND RPT_DEST = "LOCAL" } LET run_cmd="exec awkscript < ",tmp_fname CLIPPED, " 2>/dev/null|pg" } RUN run_cmd } WHEN rpt_option = "p" AND RPT_DEST = "LOCAL" } IF landscape THEN } LET run_cmd="lp -o landscape -d", LPDEST CLIPPED, " ", } tmp_fname CLIPPED } RUN run_cmd } ELSE } LET run_cmd="lp -d", LPDEST CLIPPED, " ", tmp_fname CLIPPED } RUN run_cmd } END IF } END CASE } } _____________________________________________________________________________ Jack Parker | Hewlett Packard, BSMC Boise, Idaho, USA| "Discover America, jparker@hpbs2561.boi.hp.com | Get lost on a rally." (208) 396-5388 (W) (208) 384-1623 (H) | _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________