How to call RHDCMT00 from a COBOL/DC program?

Document ID : KB000023289
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction: 

You can invoke DCMT commands from application programs. Your program invokes the DCMT command by linking to the same program that is invoked when the command is entered from a terminal. Unless the program is changed on site by the database administrator, its name is RHDCMT00. This program can be used to invoke all DISPLAY and VARY DCMT commands.

Background:  

The CA-IDMS Callable Services Guide contains an example of an ASSEMBLER program to call RHDCMT00. However, the guide contains no example about how to do this from within a COBOL program.

 Environment:  

This program can be used within an IDMS Central Version which runs on a z/OS, z/VSE and z/VM platform.

Instructions:

1. Create a Cobol program like the one shown hereafter. 

*RETRIEVAL                                                                
       ID DIVISION.                                                             
       PROGRAM-ID. DCOBMT00.                                                    
       ENVIRONMENT DIVISION.                                                    
      *---------------------                                                    
       IDMS-CONTROL SECTION.                                                    
       PROTOCOL.   MODE IS IDMS-DC DEBUG                                        
       DATA DIVISION.                                                           
      *-------------                                                            
       WORKING-STORAGE SECTION.                                                 
           COPY IDMS SUBSCHEMA-CTRL.                                            
       01  BEGIN-REC.                                                           
           02  BEGIN-FIELD1 PIC X(50)                                           
                      VALUE '** Enter DCMT command to be processed **'.         
           02  END-FIELD1   PIC X.                                              
           02  BEGIN-FIELD2 PIC X(50)                                           
               VALUE '****   Return code from RHDCMT00= '.                      
           02  RC-FIELD PIC 9(4).                                               
           02  END-FIELD2   PIC X.                                              
      **************************************************                        
      *       Input parameters for RHDCMT00 calls      *                        
      **************************************************                        
       01  PARMIN.                                                              
           03  INLEN        PIC S9(4) COMP.                                     
           03  INDATA       PIC X(70).                                          
      **************************************************                        
      *      Output parameters for RHDCMT00 calls      *                        
      **************************************************                        
       01  PARMOUT.                                                             
           03  OUTAREALEN   PIC S9(8) COMP.                                     
           03  OUTRETCD     PIC S9(4) COMP.                                     
           03  OUTINDIC     PIC S9(4) COMP.                                     
           03  OUTLENREQ    PIC S9(8) COMP.                                     
           03  OUTLENUSED   PIC S9(8) COMP.                                     
           03  OUTDATA      PIC X(2048).                                        
       01  FILLERX          PIC X.                                              
       PROCEDURE DIVISION.                                                      
      *------------------                                                       
       START-PROG.                                                              
           WRITE LINE TO TERMINAL WAIT                                          
                      FROM BEGIN-FIELD1 TO END-FIELD1.                          
      *          Move spaces to input syntax field to avoid RC = 04             
      *          which is a SYNTAX ERROR                                        
           MOVE SPACES TO INDATA.                                               
           READ LINE FROM TERMINAL                                              
                      INTO INDATA MAX LENGTH 70.                                
       CALL-DCMT.                                                               
           MOVE   70  TO  INLEN.                                                
           MOVE 2048  TO  OUTAREALEN.                                           
           MOVE    0  TO  OUTINDIC.                                             
      *          Call RHDCMT00                                                  
           TRANSFER CONTROL TO 'RHDCMT00' RETURN                                
                               USING PARMIN PARMOUT.                            
      *          Write (snap) output to DCLOG                                   
           SNAP FROM PARMOUT TO FILLERX  .                                      
      *                                                                         
      *          Write return code to terminal                                  
           MOVE OUTRETCD    TO RC-FIELD.                   
       RETURN-FROM-DCMT.                                                        
           WRITE LINE TO TERMINAL WAIT                                          
                      FROM BEGIN-FIELD2 TO END-FIELD2.                          
       END-PROG.                                                                
           DC RETURN.                                                           
           COPY IDMS IDMS-STATUS.                                               
       IDMS-ABORT SECTION.                                                      
       IDMS-ABRT.                                                               
            EXIT.    

This program source is attached to this document as DCOBMT00.txt. 

2. Compile and link edit the program.

3. In order to execute this program within a CA-IDMS Central Version, the following definitions are required:

  1. dynamically (and temporarily) through DCMT commands:
    DCMT VARY DYNAMIC PROGRAM DCOBMT00 COBOL REENTRANT NONOVERLAYABLE. 
    DCMT VARY DYNAMIC TASK <your taskcode> INVOKES DCOBMT00 NOMAP NOINPUT.
        
  2. permanent via SYSGEN definitions :
     SIGNON DICT SYSTEM.
          MODIFY SYSTEM <your system>.
          ADD PROGRAM DCOBMT00 
             LANGUAGE IS COBOL
             PROGRAM
    NONOVERLAYABLE REENTRANT. ADD TASK <your taskcode> INVOKES PROGRAM DCOBMT00 NOMAP NOINPUT LOCATION ANY.

4. Example of program execution.

Assume <your taskcode> is TCOBMT00.

Data entered at the terminal is displayed in bold; messages written out by the program are displayed in Italic.

V67  ENTER NEXT TASK CODE:      CA IDMS release 19.0 tape GJJ02I node SYSTEM67
TCOBMT00
** Enter DCMT command to be processed ** display segment appldict **** Return code from RHDCMT00= 0000 V67  ENTER NEXT TASK CODE:      CA IDMS release 19.0 tape GJJ02I node SYSTEM67

The IDMS Log contains following SNAP information (PARMOUT storage block):

09:15  3D3A6260  00000800 00000000 0000018A 0000018A  *................*
09:15  3D3A6270  4F606060 60606060 60606040 C1998581  *|---------- Area*
09:15  3D3A6280  40606060 60606060 60606060 404040D3  * -----------   L*
09:15  3D3A6290  96839240 404040D3 9660D781 87854040  *ock    Lo-Page  *
09:15  3D3A62A0  4040C889 60D78187 85407BD9 85A34040  *  Hi-Page #Ret  *
09:15  3D3A62B0  7BE49784 407BE399 85A3407B D5A386A8  *#Upd #Tret #Ntfy*
09:15  3D3A62C0  4FC1D7D7 D3C4C9C3 E34BC4C4 D3C4D4D3  *|APPLDICT.DDLDML*
09:15  3D3A62D0  40404040 40404040 40404040 40404040  *                *
09:15  3D3A62E0  E4978440 40404040 40F6F0F0 F0F14040  *Upd      60001  *
09:15  3D3A62F0  40404040 F6F2F0F0 F0404040 40F04040  *    62000    0  *
09:15  3D3A6300  404040F0 40404040 40F04040 404040F0  *   0     0     0*
09:15  3D3A6310  4A40E2A3 8194977A 40F2F0F0 F360F1F2  *? Stamp: 2003-12*
09:15  3D3A6320  60F1F160 F0F84BF0 F84BF3F9 4BF4F4F5  *-11-08.08.39.445*
09:15  3D3A6330  F5F9F340 40D78740 8799977A 40F04040  *593  Pg grp: 0  *
09:15  3D3A6340  40404040 D596E288 81998540 40D596C9  *    NoShare  NoI*
09:15  3D3A6350  C3E5C940 40D596D7 85999401 404FC1D7  *CVI  NoPerm. |AP*
09:15  3D3A6360  D7D3C4C9 C3E34BC4 C4D3C4C3 D3D6C440  *PLDICT.DDLDCLOD *
09:15  3D3A6370  40404040 40404040 40404040 40E49784  *             Upd*
09:15  3D3A6380  40404040 4040F7F0 F0F0F140 40404040  *      70001     *
09:15  3D3A6390  40F7F0F5 F0F04040 4040F040 40404040  * 70500    0     *
09:15  3D3A63A0  F2404040 4040F040 40404040 F04A40E2  *2     0     0? S*
09:15  3D3A63B0  A3819497 7A40F2F0 F0F360F1 F260F1F1  *tamp: 2003-12-11*
09:15  3D3A63C0  60F0F84B F0F84BF3 F94BF4F5 F7F5F7F0  *-08.08.39.457570*
09:15  3D3A63D0  4040D787 40879997 7A40F040 40404040  *  Pg grp: 0     *
09:15  3D3A63E0  40D596E2 88819985 4040D596 C9C3E5C9  * NoShare  NoICVI*
09:15  3D3A63F0  4040D596 D7859994 01400000 00000000  *  NoPerm. ......*
09:15  3D3A6400  00000000 00000000 00000000 00000000  *................*
09:15  3D3A6410->3D3A6A6F Same as prior line                            
09:15  END OF SNAP                                                 

Description of Snapped Information:

OUTAREALEN : 00000800
OUTRETCD   :     0000
OUTINDIC   :     0000
OUTLENREQ  : 0000018A
OUTLENUSED : 0000018A
OUTDATA    : starts with "4F606060......" (at address 3D3A6270)
             Remark : Each line starts with a 1-byte length indicator (marked in bold)

To compare, this is the output from the same DCMT command executed from Enter Next Taskcode:

DCMT DISPLAY SEGMENT APPLDICT                                                
---------- Area -----------   Lock    Lo-Page    Hi-Page #Ret  #Upd #Tret #Ntfy 
APPLDICT.DDLDML                Upd      60001      62000    0     0     0     0 
 Stamp: 2003-12-11-08.08.39.445593  Pg grp: 0      NoShare  NoICVI  NoPerm      
                                                                                
APPLDICT.DDLDCLOD              Upd      70001      70500    0     2     0     0 
 Stamp: 2003-12-11-08.08.39.457570  Pg grp: 0      NoShare  NoICVI  NoPerm      
File Attachments:
TEC522159.zip