Can a CA IDMS COBOL program determine the specific IDMS CV it's running on?

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

Can a CA IDMS COBOL program determine the specific CA IDMS CV it's running on?

The answer to this question will depend on whether the program is running in a batch or online IDMS environment. However, it is valid for all operating systems and all supported releases of CA IDMS.

The ability to retrieve run-time task-related information from a COBOL program depends on the mode of the program.


You can use the ACCEPT verb in COBOL statements to get information about many things related to the program's run-time environment: task code, task id, lterm & pterm, etc. Included in that list are two system-related pieces of information that a COBOL program can retrieve at run-time using the ACCEPT verb: the system version & the system ID. Here's how the DML Reference for COBOL describes these parameters of the ACCEPT statement: 

Retrieves the version of the current CA IDMS system. The version number is an integer in the range 0 through 9999 stored in a PIC S9(4) COMP (halfword) field. 

Specifies the 8 character name (nodename) by which the DC/UCF system is known to other nodes in the DC/UCF communications network." 

The syntax of the ACCEPT verb is 
ACCEPT <parameter> INTO return-location 
In this syntax, 'return location' represents the symbolic name of a user-defined field; the picture and usage of this field must be compatible with the picture and usage of the requested data, as noted in the above description of the two relevant parameters. 

The ACCEPT for task-related info, as noted above, is for IDMS-DC programs only. It's not a valid verb for batch programs. The call formats are different between the ACCEPT for DB-related information (which is translated by IDMSDMLC as a call to IDBMSCOM with verb #15) and the ACCEPT for task info (which is translated by IDMSDMLC as a call to DCBMSCOM with verb #48). The ACCEPT for DB-related info is valid in any COBOL program regardless of the protocol; the ACCEPT for task-related information is valid only for DC programs. 

There is no way in a COBOL batch program to get the system identity of the system in which it's running. 
However, for a batch program running through CV, the JCL will have a SYSCTL file defined which the system will read and manage. If you define an FD for that SYSCTL file in your program, you can read the record in the file & it will have some info. However, there are some caveats: 

1- You won't be able to read the SYSCTL in a COBOL program; you'd have to call an Assembler subroutine to do it.  

2- The SYSCTL contains the SVC number and the CVNUMBER from the sysgen.  It is not the system number of the system id.  It is a relative number identifying a 'slot' in the SVC.  For example we have 1 SVC which we use for all of our CVs.  The SVC can specify up to 255 slots.  Our test system TECHDC70 has a CVNUMBER of 57 although its system id is TECHDC70 and a system number of 700.  The TECHDC70 SYSCTL would contain the SVC number and the CVNUMBER of 57.  If you wanted to take this approach, you would have to know how to correlate that number and it probably would not be the same number an ACCEPT SYSTEM ID would return.