IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Batch cobol program writes out to MQ


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pahiker

New User


Joined: 10 Aug 2012
Posts: 51
Location: USA

PostPosted: Fri May 02, 2014 6:53 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1586
Location: Andromeda Galaxy

PostPosted: Fri May 02, 2014 8:12 pm
Reply with quote

How do you take care in running a normal batch jobs?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Fri May 02, 2014 8:41 pm
Reply with quote

Why not just pass a parameter to the program?
Back to top
View user's profile Send private message
pahiker

New User


Joined: 10 Aug 2012
Posts: 51
Location: USA

PostPosted: Fri May 02, 2014 8:46 pm
Reply with quote

Pandora-Box wrote:
How do you take care in running a normal batch jobs?


???
Back to top
View user's profile Send private message
pahiker

New User


Joined: 10 Aug 2012
Posts: 51
Location: USA

PostPosted: Fri May 02, 2014 8:47 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat May 03, 2014 3:34 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Sat May 03, 2014 1:24 pm
Reply with quote

Hopefully it is for testing purpose, in production you should as much as possible use the default queue manager.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Cobol-db2 : SQL query is running for ... DB2 4
No new posts How to Parameterize Eazytrive program All Other Mainframe Topics 2
No new posts COBOL/CICS Emulators CICS 4
No new posts linking an ALC program to a Relationa... PL/I & Assembler 1
No new posts File-aid batch how to repeat a line... Compuware & Other Tools 2
Search our Forums:

Back to Top