Page 1 of 1

Can we capture JOBNAME through the COBOL program?

Posted: Wed Jan 21, 2015 9:50 pm
by Sunny Malhotra
Hi,

There is one COBOL program which is exeuting multiple times in a day. But it gets executed in different JCLs. If there is a problem, every time I have to identify in which JCL it is getting executed. I want to tweak the code in a way that I can get the Job name from the program itself. Is there any way can I achieve this?

Thanks in advance.

Re: Can we capture JOBNAME through the COBOL program?

Posted: Wed Jan 21, 2015 10:28 pm
by Robert Sample
Yes, you can read the MVS control blocks in COBOL to retrieve the job name. A Google search of cobol z/os job name returns about 110,000 results and one of them on the first page has this IBM program:

Code: Select all

IDENTIFICATION DIVISION.    

PROGRAM-ID. JOBNAME.  
ENVIRONMENT DIVISION.
DATA DIVISION.  
LOCAL-STORAGE SECTION.
77 PSAAOLD-PTR        USAGE POINTER.
77 PSAAOLD-ADDR       REDEFINES PSAAOLD-PTR PIC S9(9) BINARY.
77 ASCB-PTR           USAGE POINTER.
77 ASCB-ADDR          REDEFINES ASCB-PTR    PIC S9(9) BINARY.
77 JOBNAME-PTR        USAGE POINTER.
77 JOBNAME-ADDR       REDEFINES JOBNAME-PTR PIC S9(9) BINARY.
LINKAGE SECTION.  
77 A-PTR              USAGE POINTER.
77 JOBNAME-CHARS      PIC X(8).    
PROCEDURE DIVISION.
*    GET OUR ASCB ADDRESS FROM THE PSA    
    MOVE 548 TO PSAAOLD-ADDR.    
    SET ADDRESS OF A-PTR TO PSAAOLD-PTR.
    SET ASCB-PTR TO A-PTR.  
*    ASCBJBNI  
    COMPUTE JOBNAME-ADDR = ASCB-ADDR + 172.
    SET ADDRESS OF A-PTR TO JOBNAME-PTR.  
    SET JOBNAME-PTR TO A-PTR.    
    IF JOBNAME-PTR IS NOT EQUAL NULL THEN
        SET ADDRESS OF JOBNAME-CHARS TO JOBNAME-PTR          
        DISPLAY "INITIATED JOBNAME IS " JOBNAME-CHARS        
    END-IF.                                                  
*    ASCBJBNS    
    COMPUTE JOBNAME-ADDR = ASCB-ADDR + 176.
    SET ADDRESS OF A-PTR TO JOBNAME-PTR.  
    SET JOBNAME-PTR TO A-PTR.  
    IF JOBNAME-PTR IS NOT EQUAL NULL THEN                    
        SET ADDRESS OF JOBNAME-CHARS TO JOBNAME-PTR          
        DISPLAY "START/MOUNT/LOGON JOBNAME IS " JOBNAME-CHARS
    END-IF.
    GOBACK. 

Re: Can we capture JOBNAME through the COBOL program?

Posted: Thu Feb 19, 2015 1:40 pm
by Sunny Malhotra
Thanks Robert.

Re: Can we capture JOBNAME through the COBOL program?

Posted: Mon Mar 02, 2015 2:08 pm
by jjourneyy22
Mate, who is in Australia, the rsgpfast servers are in Russia and EU. Please tell me other game with "great netcode" wich allow you to play normal with 400 ping?This reminds me of the time when our community had BF servers. So many times there was people from US who FIFA 15 PC Coins joined there, and the servers was located in Stuttgart. So they play round or two on EU server (they have filters and know...or dont know may be...where they join) and start to moan: This server is laggy! And so on...