entry points (cont)
i/o redirection specific approach:
PARM p1 … # no “entry” parm defined
if HPSTDIN = “$STDIN” then
… (“main” entry -- initialize etc…)
xeq !HPFILE !p1, … <somefile
… (cleanup etc…)
return
else # no elseif since only 1 alternate
# execute the entry to read “somefile”
setvar eof FINFO(hpstdin, “eof”)
…
return
endif
Notes:
- Note: the HPSTDIN = “$STDLIST” test above could be replaced with: if HPINTERACTIVE then…
- This approach to alternate entry points works fine for its limited uses. It does not handle multiple alternate entries and requires I/O redirection for the single alternate entry.
- In a job you must use the HPSTDLIST test since HPINTERACTIVE is always FALSE.
- If the script itself is run with I/O redirected then both tests (HPSTDIN and HPINTERACTIVE will be inaccurate, and the generic approach must be used.