Troubleshooting
Problem
This is an example of how to connect to a data area using DDM over IP and how to use it in a simple CL program.
Resolving The Problem
This is an example of how to connect to a data area using DDM over IP and how to use it in a simple CL program.
Step 1: Create a data area on the target system. In this case, an initial value of 'ddm data area test data' is also being set.
CRTDTAARA DTAARA(V2KEA24/TESTDB) TYPE(*CHAR) VALUE('ddm data area test data')
Step 2: Determine what credentials are required to make a DDM connection to the target system over TCP/IP. Type the command CHGDDMTCPA and prompt it with the F4 key (there is no display command). Note the value for the lowest authentication method. You can put your cursor on this field and press the F1 key to see all the possible values and their meanings. Unless the value for this field is *NO, *USRID or *VLDONLY, you will need to create a server authentication entry on the source system so that it can send a password to the target when the connection is established.
Step 3: Use the WRKRDBDIRE command to verify that a relational database directory exists on the source system to define the target system. If it does not already exist, you should add a relational database entry on the source system for the target system. This is required to be able to specify the target when creating the DDM data area. In this example, the RDB TESTDA is named and is pointed at the IP address of the target system. You should replace x.x.x.x with the actual IP address of the target system. You can also use the host name of the system as long as the source system can resolve it to an IP address. The database name for this directory entry must be the name of the local database name on the target system. If you are not sure what that database name is, you should run the command DSPRDBDIRE on the target system; it is the entry with the remote location of *LOCAL.
ADDRDBDIRE RDB(TESTDA) RMTLOCNAME('x.x.x.x' *IP)
Step 4: Create the DDM data area on the source system. Note that for the remote location, you must specify *RDB and also provide the relational database name from Step 3 and the target data area created in Step 1.
CRTDTAARA DTAARA(TESTDB) TYPE(*DDM) RMTDTAARA(V2KEA24/TESTDB) RMTLOCNAME(*RDB) RDB(TESTDA)
Step 5: This step is only required if the target system is set up to require a password be sent. You must create a server authentication entry for the user profile (or group profile) that will be used to access the DDM data area. For this example, you could just use your own user profile by setting the User profile value to *CURRENT; however, this will only work for you. If you create it for your group profile, DDMSUPPORT, then all others that use this group profile can use the same authentication entry, and you do not need to create dozens of entries. Here is the command used to create the server authentication entry:
ADDSVRAUTE USRPRF(DDMSUPPORT) SERVER(TESTDA) USRID(V2KEA24) PASSWORD(mypassword)
Note that the USRPRF is the group profile on the source system; the SERVER is the relation database entry, and the USRID and PASSWORD are the user ID and password that will be sent to the target machine (the QRWTSRVR server job will be using this ID as the active profile for the connection).
Step 6: You are now ready to access the target data area. Let's test it out first using the DSPDTAARA command. A common mistake here is to miss the fact that there is a parameter on the command to display the local or remote data area. It is an 'Additional Parameter' so it does not display it when you simply prompt the command; you must press F9 or F10 to see this parameter.
DSPDTAARA DTAARA(TESTDB) SYSTEM(*RMT)
If SYSTEM(*RMT) had not been specified, the command would have shown the local data area which simply contains the definition for that data area. It would look like the following:
Data area . . . . . . . : TESTDB
Library . . . . . . . : V2KEA24
Type . . . . . . . . . : *DDM
Length . . . . . . . . : 62
Text . . . . . . . . . :
Value
Offset *...+....1....+....2....+....3....+....4....+....5
0 'TESTDA TESTDB '
50 ' V2KEA24 '
Following is a simple CL program that will use the RTVDTAARA command to retrieve the data from the target data area and output it as an escape message CPF9898:
/********************************************************************/
DCL VAR(&OUTDA) TYPE(*CHAR) LEN(2000)
/********************************************************************/
RTVDTAARA DTAARA(V2KEA24/TESTDB) RTNVAR(&OUTDA)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&OUTDA) +
TOPGMQ(*PRV) MSGTYPE(*ESCAPE)
GOTO CMDLBL(EXIT)
/********************************************************************/
/* EXIT THE PROGRAM. */
/********************************************************************/
EXIT: ENDPGM
Step 7: Compile and run the CL program on the source system. You will see output at the bottom of the screen similar to the following. Note that, in this case, you are returned the content of the data area created in Step 1 'ddm data area test data'.
Selection or command
===> call v2kea24/ddmdara
F3=Exit F4=Prompt F9=Retrie
F23=Set initial menu
ddm data area test data.
And, the message details looks similar to the following:
Message ID . . . . . . : CPF9898 Severity . . . . . . . : 40
Message type . . . . . : Diagnostic
Date sent . . . . . . : 11/27/07 Time sent . . . . . . : 14:49:26
Message . . . . : ddm data area test data.
Cause . . . . . : This message is used by application programs as a general
escape message.
Retrieving the remote Data Area value using DDM
To see the value of the Data Area on the target (remote) system, specify the *RMT for the System parameter, otherwise it will default to *LCL and display the contents of the Data Area on the source (local) system. An example for displaying the Data Area of the target system follows:
DSPDTAARA DTAARA(V2KEA24/TESTDB) SYSTEM(*RMT)
Historical Number
470640177
Was this topic helpful?
Document Information
Modified date:
11 November 2019
UID
nas8N1013980