My test exec
/* rexx */
parse arg report_name
'cgiutils -status 200 -ct text/html'
say ' ' /* blank line to make sure */
say '<html>' /* start html */
path="/it/syoy/reports/servers/reports/billing/res/"
fullpath=path||report_name
file_exists=listdsi(fullpath)
if file_exists = 0 then
do
say 'Report exists'
end
else
do
say 'Report has not been created for the target date'
say 'Please check back for the report at a later time'
end
I've tried setting the environment via address mvs and address tso -
nothing seems to work. Is there magic thing to do existance detection of a
dataset in an HFS and report back if it exists.
On the other hand, if you are asking if you can check for a file in an HFS
from the OS/390 side then, I've done this with a simple "ls -l filename" and
testing the return code.
Here is a snippet/subroutine:
/* REXX */
parse arg filename
"BPXBATCH SH ls -l" filename
BPXRC = RC / 256
if BPXRC = 0 then
say 'Found file:' filename
else
say 'File:' filename 'not found RC='BPXRC
exit(BPXRC)
Hope this helps,
Robert Zenuk
Robert Zenuk
<Robzenuk@AOL. To: TSO-...@VM.MARIST.EDU
COM> cc:
Sent by: TSO Subject: Re: Is it possible to call TSO/E functions in REXX execs being
REXX used as a CGI?
Discussion
List
<TSO-REXX@VM.M
ARIST.EDU>
02/13/01 03:48
PM
Please respond
to TSO REXX
Discussion
List
TSO tso -- Run a TSO/E command from the shell
Subtopics
2.TSO.1 Format
2.TSO.2 Description
2.TSO.3 Options
2.TSO.4 Examples
2.TSO.5 Environment Variables
2.TSO.6 Messages
2.TSO.1 Format
tso [-o] [-t] TSO_command
2.TSO.2 Description
tso runs a TSO/E command from the shell using the TSO/E service routine or
the OMVS interface.
2.TSO.3 Options
-o Specifies that the command be issued through the OMVS interface.
-t Specifies that the command be issued through the TSO/E service routine.
If a mini-TSO/E environment is to be established, use environment
variables to specify the allocations that you need.
If you do not specify an option, the following rules determine how to run the
TSO/E command:
If stdout is not a tty, the TSO/E service routine is used because it is
possible that the command output will be redirected to a file or piped to
another command.
If the controlling tty supports 3270 passthrough mode, the OMVS interface
is used.
If neither of the above is applicable, then the TSO/E service routine is
used.
It looks like it will be a mini-TSO environment, so it may not handle what
you want to do anyway. I still don't believe the LISTDSI service will give
you any data for HFS files (I get RC=16 when I try on the OS/390 side). I
have used the "ls -l filename" technique in native UNIX (AIX, Solaris, Linux)
Bourne Shell, Korn Shell and Perl scripts. If you want to launch a script
and test the RC the -a filename test will also test for existence.
Sample USS REXX
/* rexx */
parse arg filename
"ls -l" filename
LSRC = RC
if LSRC = 0 then
say filename 'found'
else
say filename 'not found'
exit(LSRC)
Sample Bourne Shell script
#!/bin/sh
filename=$1
if [[ -a $filename ]]; then
echo File: $filename found
exit 0
else
echo File: $filename is missing
exit 1
fi
Hope this helps, if not, I'm out of ideas,
Robert Zenuk
robz...@aol.com
Javascript call:
set up URL in a variable using some other stuff. The important thing is the
cgi-preifx which is the path to the CGI-BIN directory in question.
For us, we have a seprate cgi-bin other than the one SMP/E maintains so it
doesn't get clobbered.
var cgiprefix = "/hccgi-bin/spit_billing.sh/";
var parmchar = "?";
var URL = (cgiprefix)+ (parmchar)+ (Resource)+ (uscore)+ (cal_year)+
(uscore)+ (monthtrend2)+ (formsuffix);
The rest of the stuff past the parmchar string is shop specific and you
guys probably don't care whats in the strings.
The javascript call to the cgi routine is handled like this:
.{whatever logic you need to determine valid query}
.
.
parent.frames[2].location = URL}}}}
The key here is (since I use frames) is to call the CGI using the URL
string - which I had previously specified as an http:// type request to a
specific web page to point to the program and pass the resource datra as a
parm.
The rexx exec looks like:
/* rexx */
parse arg report_name
'cgiutils -status 200 -ct text/html'
path="/it/syoy/reports/servers/reports/billing/res/"
errorpath="/it/syoy/reports/servers/billing/Report_Error.htm"
fullpath=path||report_name
"ls -l" fullpath ">/dev/null"
LSRC = RC
say ' ' /* blank line to make sure */
say '<html>' /* start html */
if LSRC = 0 then
DO
call syscalls 'ON'
Read = o_rdonly
address syscall
"open" fullpath Read
reportDD = retval
address MVS "EXECIO * DISKR" reportDD "(STEM Rept. FINIS)"
"close" reportDD
say '<PRE>'
say report_name
say '</PRE>'
if Rept.0 > 0 then
do
do H = 1 to Rept.0
say Rept.h
end
end
end
else
DO
call syscalls 'ON'
Read = o_rdonly
address syscall
"open" errorpath Read
errorDD = retval
address MVS "EXECIO * DISKR" errorDD "(STEM err. FINIS)"
"close" errorDD
say '<PRE>'
say report_name
say '</PRE>'
if err.0 > 0 then
do
do H = 1 to err.0
say err.h
end
end
end
The practical upshot of all of this is that we can now publish a report at
any given date in the month, not have to have a dummy HTML page for each
report published on the web site, and not get a 404 file not found error -
instead presenting the end user with a nice message that explains that the
file is not there but will be soon. Could easily be tailored to give a
specific message for each report name being queried etc, or other
functionality.
I know this is a rather long message and I apologize - just thought it
would be helpful.