Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Batch cobol program writes out to MQ

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pahiker

New User


Joined: 10 Aug 2012
Posts: 28
Location: USA

PostPosted: Fri May 02, 2014 6:53 pm    Post subject: Batch cobol program writes out to MQ
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

Moderator


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

PostPosted: Fri May 02, 2014 8:12 pm    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Fri May 02, 2014 8:41 pm    Post subject:
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: 28
Location: USA

PostPosted: Fri May 02, 2014 8:46 pm    Post subject:
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: 28
Location: USA

PostPosted: Fri May 02, 2014 8:47 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat May 03, 2014 3:34 am    Post subject: Reply to: Where am I running?
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: 1219
Location: Israel

PostPosted: Sat May 03, 2014 1:24 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
This topic is locked: you cannot edit posts or make replies. MIPS reduction for Batch job Virendra Shambharkar All Other Mainframe Topics 8 Mon Nov 07, 2016 4:02 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us