Primary keys are called Unique keys in iSeries DDS. The Unique key can be held to two places, on the physical file itself or on a logical file based over that physical file.
To check the physical file, on a command line use the Display File Description command over the physical file; e.g. DSPFD library/file. Page down the displayed information looking for "Access Path Description." If the Access Path is shown as "Arrival" then the physical file is non-keyed and the records are stored by Relative Record Number (row number) sequence. If the Access Path is keyed then the file is keyed, but the key will only be a primary key if the "Unique key values required’ value is showing "Yes." The key fields themselves will be listed on the lines just below this entry.
To check whether there is a logical file with a Unique key use this two step process: First, find the names of all the logical files based over the physical file by using the Display Data Base Relations command, eg DSPDBR library/file. Second use the Display File Description command (DSPFD) for each logical file, as described above, checking the Access Path information as previously described.
Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2009, Vision Solutions, Inc. All rights reserved. Vision Solutions develops and sells iSeries high availability and AIX replication and clustering solutions. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.
8/27/09 How to find the primary key of a file created using DDS (rather than SQL)
8/09/09 Using RUNRMTCMD to tell other systems to perform tasks and run scripts
You can have Linux, UNIX and Windows servers do tasks and runs scripts right from an i5/OS command line or a CL program. If you use CL, your program will even wait until the other sever completes its task before moving to the next instruction.
Use the RUNRMTCMD command and enter the foreign system command in the COMMAND parameter, the IP address or host name in the REMOTE LOCATION parameter, and indicate *IP for Type. Of course, you’ll also need a user name and password for the remote server.
The RUNRMTCMD will end and the next CL statement will execute when the command completes on the target system. If you want things to happen "asynchronously," use the COMMAND parameter to run a script on the foreign system that submits another job or spawns off another process. Just remember, whatever process you invoke on the target system has to finish before control returns to your CL. If the target system gets stuck, so does your program.
Using this command can also be a handy way to automatically perform functions when switching servers using the your high availability automation; you can trigger scripts that automatically change DNS, clear DNS cache, alter software configurations, and more.
Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2009, Vision Solutions, Inc. All rights reserved. Vision Solutions develops and sells iSeries high availability and AIX replication and clustering solutions. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.