Calling IKJEFT01 in COBOL?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Calling IKJEFT01 in COBOL?

Postby rickscott661309 » Sat Aug 08, 2009 7:26 am

Hi,

I need to invoke utility IKJEFT01 in COBOL program so that some DB2 status could be showed. But I was wondering if it is possible...

Since it is a utility, I think I need to use dynamic call. But I'm confused by how to put the parameters. For example, the IKJEFT01 input usually looks like:

DSN SYSTEM(DB2)
......
END

So, I was wondering if I could pass the paramters like this:

MOVE 'IKJEFT01' TO WK-IKJEFT01
CALL WK-IKJEFT01 USING WK-SYSTEM
WK-MESSAGE
WK-END.

But, that is based on IKJEFT01 can be invoked in COLOL program...
Could anyone please give some suggestions? Thank you!
rickscott661309
 
Posts: 4
Joined: Sat Aug 08, 2009 6:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling IKJEFT01 in COBOL?

 

Re: Calling IKJEFT01 in COBOL?

Postby dick scherrer » Sat Aug 08, 2009 7:38 am

Hello and welcome to the forum,

Since it is a utility, I think I need to use dynamic call
Umm, well, no - not really a "utility". . .

IKJEFT01 is batch TSO or TMP (Terminal Monitor Program).

I have never seen IKJEFT01 invoked as a callable utility.

If you explain what you want to accomplish (rather than how you'd like to do it), someone may have a suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Calling IKJEFT01 in COBOL?

Postby rickscott661309 » Sun Aug 09, 2009 2:28 pm

Thank you.

There are some commands of IKJEFT01 that can show the DB2 table status. I'm trying to invoke IKJEFT01 under some situations in COBOL program. Do you mean IKJEFT01 can not be invoked in COBOL program?
rickscott661309
 
Posts: 4
Joined: Sat Aug 08, 2009 6:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling IKJEFT01 in COBOL?

Postby dick scherrer » Mon Aug 10, 2009 1:59 am

Hello,

Do you mean IKJEFT01 can not be invoked in COBOL program?
I don't know if this is possible or not. I do know that no one on any of the more than 100 systems i've supported has ever wanted/needed to do so.

I suspect that what you want to do has been done by many others without "calling" the TMP from a cobol program.

If you explain just what you want do to, someone may have a suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Calling IKJEFT01 in COBOL?

Postby MrSpock » Tue Aug 11, 2009 12:55 am

You can define a TSO address space and issue TSO commands by calling the IKJTSOEV and IKJEFTSR programs. Something like this:

       IDENTIFICATION DIVISION.                                       
       PROGRAM-ID. TSO                                                 
       ENVIRONMENT DIVISION.                                           
       INPUT-OUTPUT SECTION.                                           
                                                                       
       DATA DIVISION.                                                 
       FILE SECTION.                                                   
                                                                       
       WORKING-STORAGE SECTION.                                       
       01 FILLER.                                                     
          05  WS-DUMMY                 PIC S9(8) COMP.                 
          05  WS-RETURN-CODE           PIC S9(8) COMP.                 
          05  WS-REASON-CODE           PIC S9(8) COMP.                 
          05  WS-INFO-CODE             PIC S9(8) COMP.                 
          05  WS-CPPL-ADDRESS          PIC S9(8) COMP.                 
          05  WS-FLAGS                 PIC X(4) VALUE X'00010001'.     
          05  WS-BUFFER                PIC X(256).                     
          05  WS-LENGTH                PIC S9(8) COMP VALUE 256.       
                                                                       
       PROCEDURE DIVISION.                                             
           CALL 'IKJTSOEV' USING WS-DUMMY WS-RETURN-CODE WS-REASON-CODE
             WS-INFO-CODE WS-CPPL-ADDRESS.                             
           IF WS-RETURN-CODE > 0                                       
             DISPLAY 'IKJTSOEV FAILED, RETURN-CODE=' WS-RETURN-CODE   
               ' REASON-CODE=' WS-REASON-CODE 'INFO-CODE=' WS-INFO-CODE
             UPON CONSOLE                                             
             MOVE WS-RETURN-CODE TO RETURN-CODE                       
             STOP RUN.                                                 
           MOVE SPACES TO WS-BUFFER.                                   
           MOVE 'PROFILE' TO WS-BUFFER.                               
           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH         
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.                   
           DISPLAY WS-BUFFER UPON CONSOLE.                             
           IF WS-RETURN-CODE > 0                                       
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE   
               ' REASON-CODE=' WS-REASON-CODE                         
             UPON CONSOLE                                             
             MOVE WS-RETURN-CODE TO RETURN-CODE                       
             STOP RUN.               
           MOVE 0 TO RETURN-CODE.   
           STOP RUN.                 
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Calling IKJEFT01 in COBOL?

Postby rickscott661309 » Thu Aug 13, 2009 2:07 pm

Thank you for your Help. I will test the above code. Here is the purpose of my task:

IKJEFT01 has a function likes bellow:
DSN SYSTEM(DSN)
-DIS DB(DSNDB06) SPACENAM(SYSDBASE)
END

I want to excute these command in a COBOL program. But I don't know if it is possible or not......

And I had another thought. I could invoke a batch job which will excute IKJEFT01 in COBOL program when I need. I think this method is better than the above one. So, could you please give some suggestion on how to invoke a batch job in COBOL? Thank you.
rickscott661309
 
Posts: 4
Joined: Sat Aug 08, 2009 6:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: Calling IKJEFT01 in COBOL?

Postby GuyC » Thu Aug 13, 2009 2:30 pm

There is a system supplied Stored procedure to execute a DB2 command : ADMIN_COMMAND_DB2
Documentation for V9 but it also exists in V8 : http://publib.boulder.ibm.com/infocente ... anddsn.htm

this code works in qmf for windows , If you want it in a cobol program you need to know how stored procs are used. Explaining this would lead too far.

 CALL "SYSPROC".ADMIN_COMMAND_DB2(
'-DIS DB(DSNDB06) SPACENAM(SYSDBASE)' , -- DB2_CMD             In     LONG VARCHAR(32704)
35                       , -- LEN_CMD             In     INTEGER(4)
'TS'                       , -- PARSE_TYPE          In     VARCHAR(3)
NULL                       , -- DB2_MEMBER          In     VARCHAR(8)
0                       , -- CMD_EXEC            Out    INTEGER(4)
0                       , -- IFCA_RET            Out    INTEGER(4)
0                       , -- IFCA_RES            Out    INTEGER(4)
0                       , -- XS_BYTES            Out    INTEGER(4)
0                       , -- IFCA_GRES           Out    INTEGER(4)
0                       , -- GXS_BYTES           Out    INTEGER(4)
0                       , -- RETURN_CODE         Out    INTEGER(4)
'X'                       ) -- MSG                 Out    LONG VARCHAR(1331)
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: Calling IKJEFT01 in COBOL?

Postby rickscott661309 » Thu Aug 20, 2009 9:39 am

Thank you for your kindly help. I have fixed this problem by invoking a job from COBOL program. And this job would execute IKJEFT01. Here is the example code I learned from others:

[color=#008000]====================================COBOL程序================================
 IDENTIFICATION        DIVISION.       
 PROGRAM-ID.           TEST04.         
 AUTHOR.               INDER.           
 DATE-WRITTEN.         2009/08/15.     
*                                       
 ENVIRONMENT           DIVISION.       
 CONFIGURATION         SECTION.         
 SOURCE-COMPUTER.      IBM-390.         
 OBJECT-COMPUTER.      IBM-390.         
 INPUT-OUTPUT          SECTION.         
 FILE-CONTROL.                         
     SELECT  SUBMIT  ASSIGN  TO  SUBMIT.
*                                       
 DATA                  DIVISION.       
 FILE                  SECTION.         
 FD  SUBMIT                             
     BLOCK   CONTAINS  0    RECORDS     
     RECORD  CONTAINS  80   CHARACTERS       
     LABEL   RECORD    IS   STANDARD         
     RECORDING  MODE   IS   F               
     DATA    RECORD    IS   SUBMIT-REC.     
 01  SUBMIT-REC                   PIC  X(80).
*                                           
 WORKING-STORAGE SECTION.                   
 01 SUBMIT-AREA.                             
     03 SUBMIT-RECORD         PIC  X(80).   
*                                           
 PROCEDURE             DIVISION.
                                                             
 U2000                 SECTION.                               
     MOVE                                                     
     '//ST098CR JOB ,INDER,CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),'
     TO SUBMIT-RECORD                                         
     WRITE SUBMIT-REC FROM SUBMIT-RECORD                       
     MOVE                                                     
     '//  NOTIFY=&SYSUID' TO SUBMIT-RECORD                     
     WRITE SUBMIT-REC FROM SUBMIT-RECORD                       
     MOVE                                                     
     '//STEP1     EXEC PGM=IDCAMS' 


。。。。。。。


     MOVE                                 
     '             SHAREOPTIONS(3)))'     
     TO SUBMIT-RECORD                     
     WRITE SUBMIT-REC FROM SUBMIT-RECORD.
 U2000-EXIT.                             
     EXIT.                               
*                 
+++++++++++++++++++++++++++++++++++++++JCL++++++++++++++++++++++++++++++++++

//ST098R   JOB  1,INDER,CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//          NOTIFY=&SYSUID                               
//STEP1  EXEC  PGM=TEST04                                 
//STEPLIB  DD  DSN=ST098.COBOL.LOAD,DISP=SHR             
//SYSPRINT DD  SYSOUT=*                                   
//SUBMIT   DD  SYSOUT=(A,INTRDR)                         
//SYSOUT   DD  SYSOUT=*                                   
//[/color]


Thank you.
rickscott661309
 
Posts: 4
Joined: Sat Aug 08, 2009 6:55 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post