View previous topic :: View next topic
|
Author |
Message |
pahiker
New User
Joined: 10 Aug 2012 Posts: 51 Location: USA
|
|
|
|
Here's an interesting problem:
I am running a batch cobol program that writes out to MQ. Depending on where we are running (session ID, TSO1 or TSO2, in our company) I want to write out to a different queue manager (MQA1, MQA2, respectively). In CICS this is easy as I can us APPLID to determine where I am executing.
Is there something similar in batch? Reserved word, system variable, etc? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
How do you take care in running a normal batch jobs? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Why not just pass a parameter to the program? |
|
Back to top |
|
|
pahiker
New User
Joined: 10 Aug 2012 Posts: 51 Location: USA
|
|
|
|
Pandora-Box wrote: |
How do you take care in running a normal batch jobs? |
??? |
|
Back to top |
|
|
pahiker
New User
Joined: 10 Aug 2012 Posts: 51 Location: USA
|
|
|
|
Robert Sample wrote: |
Why not just pass a parameter to the program? |
I can do that, but I would rather do it automatically, to eliminate human error. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Take a look at the LE Callable Service routine "CEE3INF", introduced with z/OS 1.9. It returns lots of information.
In the below example, WS-CEE3INF-IO-FWORD (Sys/Subsys) is the first argument of the parmlist passed to CEE3INF.
To keep your own sanity and for ease of use in COBOL, convert the 32-Bit Fullword to a 32-Byte "Byte" Map, consisting of '0's and '1's (method known as BIT2BYTE) -
Code: |
03 WS-BYTE-MAP PIC X(32).
03 WS-SUB PIC 9(08) BINARY.
03 WS-FWORD PIC 9(08) BINARY.
03 WS-FWORD-X REDEFINES WS-FWORD
PIC X(04)
03 WS-CEE3INF-IO-FWORD PIC 9(08) BINARY.
03 WS-CEE3INF-IO-FWORD-X
REDEFINES WS-CEE3INF-IO-FWORD
PIC X(04).
*
MOVE ZERO TO WS-BYTE-MAP.
MOVE WS-CEE3INF-IO-FWORD-X TO WS-FWORD-X.
*
**** PERFORM A PSEUDO "SHIFT-LEFT LOGICAL" IN COBOL
*
PERFORM VARYING WS-SUB FROM 1 BY 1
UNTIL WS-SUB > LENGTH OF WS-BYTE-MAP
IF WS-FWORD-X (1:1) > X'7F'
MOVE '1' TO WS-BYTE-MAP (WS-SUB:1)
END-IF
ADD WS-FWORD TO WS-FWORD
END-PERFORM.
|
IF Byte-01 of WS-BYTE-MAP (Bit 00 of FULLWORD) equals '1', then the run-environment is CICS.
If Byte-05 of WS-BYTE-MAP (Bit 04 of FULLWORD) equals '1', then the run-environment is TSO.
If Byte-06 of WS-BYTE-MAP (Bit 05 of FULLWORD) equals '1', then the run-environment is BATCH.
Note above: In the IBM documentation, the BITS of the Fullword are referred to as 00-31, whereas, the BYTES of the Byte-Map are referred to here as 01-32, so keep this in mind.
CEE3INF can be used in both Batch and CICS.
CEE3INF Link <=== You can find example usage here as well although IBM has a different method to test bits, such as LE Callable Service routine CEESITST.
HTH.... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Hopefully it is for testing purpose, in production you should as much as possible use the default queue manager. |
|
Back to top |
|
|
|