Below is a command file that sets a job/session variable
call _SPOOLFILEID.
I suppose it could be used programmatically using
HPCICOMMAND. Then Use HPCIGETVAR to retrieve
the value of the variable.
HPCICOMMAND(cmdstr, e1, e2, msg_level)
HPCIGETVAR (varname, status, keyword, keyvalue)
Or you could use HPCICOMMAND to execute the SPOOLF
command below, and read the output from within your
program, and extract the spoolfile id as I did in this command file.
Keep in mind jobs can have more than one output file, but
only one $STDLIST and $STDIN.
------------------------------------------------
JLIST COMMAND FILE:
Parm jobnum ldev='00'
Setvar _jobnum !jobnum
Setvar _tempmsg 'stdmsg'
Setvar hpcierr 0
Spoolf o@;seleq=[(jobnum=j!_jobnum) and (filedes=$stdlist)];show > $null
If hpcierr > 0
Echo !hpcierrmsg
return
Endif
Purge !_tempmsg,temp > $null
Build !_tempmsg;rec=-80,1,f,ascii;temp;msg
File !_tempmsg=!_tempmsg,oldtemp
Spoolf o@;seleq=[jobnum=j!_jobnum];show > *!_tempmsg
Input _stdmsgrec < *!_tempmsg
Setvar _spfname str(_stdmsgrec,21,8)
Setvar _numrecs Finfo('*!_tempmsg','EOF')
While _numrecs > 0
Input _stdmsgrec < *!_tempmsg
Setvar _spfname str(_stdmsgrec,21,8)
Setvar _numrecs (_numrecs-1)
#
# I want the DFID of the $STDLIST
#
If _spfname = '$STDLIST'
Setvar _numrecs 0
Endif
Endwhile
If _spfname <> '$STDLIST'
echo Standard list for job #J!_jobnum doesn't exist!
SETVAR _SPOOLFILEID ' '
return
Endif
Setvar _ilen pos(' ',_stdmsgrec,1)-2
Echo !_ilen
setvar _dfid str(_stdmsgrec,2,_ilen)
setvar _SPOOLFILEID '!_dfid'+'.out.hpspool'
_________________________________
Michael Anderson
Student Services Programmer/Analyst
Spring Independent School District, Houston, Texas, 77090
281.586.1105
|