Adapt the following code - it gets the relevant MPE variables back into
the application.
There is both a "WHO" and "JOBINFO" intrinsic - but from memory you need
to call the JOBINFO intrinsic twice - first to ask for the "session"
information and if that reports an error you know you're running a job
and therefore can call the same intrinsic to get the "job" information.
1 WSAB-DATA.
5 WSAB-VAR-NAME PIC X(10).
5 WSAB-STATUS.
7 WSAB-STATUS-1 PIC 9(4) COMP SYNC.
7 WSAB-STATUS-2 PIC 9(4) COMP SYNC.
5 WSAB-HPJOBNAME PIC X(8).
5 WSAB-HPJOBTYPE PIC X.
5 WSAB-HPJOBNUM PIC 9(9) COMP SYNC.
5 WSAB-USER PIC X(8).
5 WSAB-ACCOUNT PIC X(8).
5 WSAB-GROUP PIC X(8).
5 WSAB-SW-MACHINE PIC X(8).
/
/
MDINFO-AB-INITIALISE SECTION.
*
* This section is performed the first time that this
* subroutine is called in order to determine the users
* logon information and which machine they are logged onto
*
INFO-AB-ENTER.
*
* Jobname
*
MOVE " " TO WSAB-HPJOBNAME.
MOVE "HPJOBNAME" TO WSAB-VAR-NAME.
CALL INTRINSIC "HPCIGETVAR" USING WSAB-VAR-NAME,
WSAB-STATUS,
2, WSAB-HPJOBNAME.
*
IF WSAB-STATUS-1 <> 0
OR WSAB-STATUS-2 <> 0
DISPLAY "Unable to get job info "
upon console.
*
* Jobtype (will be S or J)
*
MOVE " " TO WSAB-HPJOBTYPE.
MOVE "HPJOBTYPE" TO WSAB-VAR-NAME.
CALL INTRINSIC "HPCIGETVAR" USING WSAB-VAR-NAME,
WSAB-STATUS,
2, WSAB-HPJOBTYPE.
*
IF WSAB-STATUS-1 <> 0
OR WSAB-STATUS-2 <> 0
DISPLAY "Unable to get job type "
upon console.
*
* Job Number
*
MOVE 0 TO WSAB-HPJOBNUM.
MOVE "HPJOBNUM" TO WSAB-VAR-NAME.
CALL INTRINSIC "HPCIGETVAR" USING WSAB-VAR-NAME,
WSAB-STATUS,
1 , WSAB-HPJOBNUM.
*
<clip>
-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On
Behalf Of Ashvin Patel
Sent: 14 March 2007 12:32
To: [log in to unmask]
Subject: [HP3000-L] job vs. session
All,
I have a question - I have a need to know if the program is being run
from a session or from a batch job within a COBOL program. Is there an
intrinsic that I can call to find out whether the program is running
from a session or from a batch job.
Thanks!
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
The contents of this email are confidential to the intended recipient and may not be disclosed. Although it is believed that this email and any attachments are virus free, it is the responsibility of the recipient to confirm this.
Details of Smith & Williamson group companies and Nexia Smith & Williamson Audit Limited and their regulators (where applicable), can be found at this URL
http://www.smith.williamson.co.uk/disclosure
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|