Example 1
- Last UpdatedJan 05, 2024
- 3 minute read
The FORTRAN 77 code for the application program is as follows:
|
PROGRAM EXMPL1 |
||
|
C |
Application main program |
|
|
C |
Essential type declarations |
|
|
CHARACTER*50 SPCREF, CATREF |
||
|
C |
Can declare CD3MSG CHAR*1 if not using it |
|
|
CHARACTER*1 CD3MSG |
||
|
CHARACTER*6 CD3WOR, WORDS(100) |
||
|
REAL PARAMS(100) |
||
|
C |
Optional EXTERNAL declarations |
|
|
EXTERNAL D3INIT, D3MMDB, D3MNAM, D3MNUM, D3MREL, D3RNAM |
||
|
EXTERNAL D3RRA, D3RWA, D3EMSG, D3FIN, D3FEND, D3UMON, D3UDEH |
||
|
C |
Optional type declarations |
|
|
INTEGER ID3ERR, ID3NOU, I |
||
|
INTRINSIC INT |
||
|
C |
||
|
C |
Project entry |
|
|
CALL D3INIT( 'DAR', 'SYSTEM', 'XXXXXX', 'FULL', ' ', ID3ERR ) |
||
|
IF ( ID3ERR .NE. 0 ) GOTO 12345 |
||
|
C |
Select MDB |
|
|
CALL D3MMDB( 'DESIGN/PLANT', ' ', ID3ERR ) |
||
|
IF ( ID3ERR .NE. 0 ) GOTO 12345 |
||
|
C |
Move to a pipe component |
|
|
CALL D3MNAM( '/100-B-1', ID3ERR ) |
||
|
CALL D3MNUM( 'BRAN', 1, ID3ERR ) |
||
|
CALL D3MREL( 'LAST', 'FLAN', ID3ERR ) |
||
|
C |
Get spec ref and goto it |
|
|
CALL D3RNAM( 'SPRE', SPCREF, ID3ERR ) |
||
|
CALL D3MNAM( SPCREF, ID3ERR ) |
||
|
C |
Get cat ref and goto it |
|
|
CALL D3RNAM( 'CATR', CATREF, ID3ERR ) |
||
|
CALL D3MNAM( CATREF, ID3ERR ) |
||
|
C |
Get parameters of component and dehash conn types |
|
|
C |
Cancel monitor and construct own PRINT statements |
|
|
CALL D3UMON('NONE') |
||
|
PRINT*,'Getting elements with D3RRA' |
||
|
CALL D3RRA( 'PARA', 100, PARAMS, ID3NOU, ID3ERR ) |
||
|
PRINT*,'Number of elements found:',ID3NOU |
||
|
DO 100 I=1, ID3NOU |
||
|
CD3WOR = ' ' |
||
|
C |
If possibly a word, dehash |
|
|
IF ( PARAMS(I) .GE. 531442. ) THEN |
||
|
CALL D3UDEH( INT(PARAMS(I)), CD3WOR ) |
||
|
ENDIF |
||
|
IF (CD3WOR.EQ.' ') THEN |
||
|
C |
Not a word; print real value |
|
|
PRINT*,'Element', I, PARAMS(I) |
||
|
ELSE |
||
|
C |
Valid word; print word |
|
|
PRINT*,'Element', I, ' ', CD3WOR |
||
|
ENDIF |
||
|
100 |
CONTINUE |
|
|
C |
Alternatively, use D3RWA directly (non-words don't give error) |
|
|
PRINT*,'Getting elements with D3RWA' |
||
|
CALL D3RWA( 'WPAR', 100, WORDS, ID3NOU, ID3ERR ) |
||
|
DO 200 I=1, ID3NOU |
||
|
IF (WORDS(I).NE.' ') PRINT*, 'Element', I, ' ', WORDS(I) |
||
|
200 |
CONTINUE |
|
|
C |
||
|
12345 |
CONTINUE |
|
|
C |
Cancel monitor and output message |
|
|
CALL D3UMON('NONE') |
||
|
CALL D3EMSG( ID3ERR, .TRUE., CD3MSG ) |
||
|
C |
Exit project |
|
|
CALL D3FIN( ID3ERR ) |
||
|
C |
Exit DARs |
|
|
CALL D3FEND |
||
|
END |
||
Compilation, loading and running instructions are detailed in Running Examples.
The program output first illustrated is for the situation where the project DAR does not exist. The program therefore returns from D3INIT with an error status, which is trapped by the program. The output, with monitor level in D3INIT set to 'FULL', is as follows:
|
PDMS DARs <version details> |
||||
|
<copyright statement> |
||||
|
<site data> |
||||
|
Entering subroutine D3INIT |
||||
|
Input arguments: |
||||
|
Project name |
DAR |
|||
|
Username |
SYSTEM |
|||
|
Password |
XXXXXX |
|||
|
Monitoring level |
FULL |
|||
|
Read/Write key |
||||
|
Exiting subroutine D3INIT |
||||
|
Output arguments: |
||||
|
Error code |
108 |
|||
|
Project not found |
||||
|
Project not found |
||||
The first 'Project not found' message arises from monitor output from D3INIT. The second message is output by D3EMSG. With monitor set to 'NONE', the output is as follows:
|
PDMS DARs <version details> |
|
|
<copyright statement> |
|
|
<site data> |
|
|
Project not found |
A second possible error situation, where the MDB does not exist, gives the following output, with monitor level in D3INIT set to 'FULL':
|
PDMS DARs <version details> |
|||||||||||
|
<copyright statement> |
|||||||||||
|
<site data> |
|||||||||||
|
Entering subroutine D3INIT |
|||||||||||
|
Input arguments: |
|||||||||||
|
Project name |
DAR |
||||||||||
|
Username |
SYSTEM |
||||||||||
|
Password |
XXXXXX |
||||||||||
|
Monitoring level |
FULL |
||||||||||
|
Read/Write key |
|||||||||||
|
Exiting subroutine D3INIT |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MMDB |
|||||||||||
|
Input arguments: |
|||||||||||
|
MDB name |
DESIGN/PLANT |
||||||||||
|
Read/Write key |
|||||||||||
|
Opening databases |
|||||||||||
|
Mode |
Type |
Name |
|||||||||
|
---- |
---- |
---- |
|||||||||
|
Read |
DESI |
STRUC/S |
|||||||||
|
Read |
DESI |
||||||||||
|
PIPE/MAXDBLENGTH31AFTERTHESLASH |
|||||||||||
|
Read |
CATA |
CATAL/C |
|||||||||
|
Read |
PROP |
PIPE/PROP |
|||||||||
|
Read |
DESI |
PIPE/DR |
|||||||||
|
Read |
DICT |
PIPE/DR |
|||||||||
|
Default database type: DESI |
|||||||||||
|
Exiting subroutine D3MMDB |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MNAM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Element name/ref |
/100-B-1 |
||||||||||
|
Exiting subroutine D3MNAM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MNUM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Element type |
BRAN |
||||||||||
|
List position |
1 |
||||||||||
|
Exiting subroutine D3MNUM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MREL |
|||||||||||
|
Input arguments: |
|||||||||||
|
Relative position |
LAST |
||||||||||
|
Element type |
FLAN |
||||||||||
|
Exiting subroutine D3MREL |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3RNAM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Attribute required |
SPRE |
||||||||||
|
Exiting subroutine D3RNAM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Name/Reference |
/A3B/100F1 |
||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MNAM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Element name/ref |
/A3B/100F1 |
||||||||||
|
Exiting subroutine D3MNAM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3RNAM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Attribute required |
CATR |
||||||||||
|
Exiting subroutine D3RNAM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Name/Reference |
/FUAAPAMM |
||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3MNAM |
|||||||||||
|
Input arguments: |
|||||||||||
|
Element name/ref |
/FUAAPAMM |
||||||||||
|
Exiting subroutine D3MNAM |
|||||||||||
|
Output arguments: |
|||||||||||
|
Error code |
0 |
||||||||||
|
Entering subroutine D3UMON |
|||||||||||
|
Input arguments: |
|||||||||||
|
Monitoring level |
NONE |
||||||||||
|
Getting elements with D3RRA |
|||||||||||
|
Number of elements found: |
|||||||||||
|
Element 1 |
100.0000 |
||||||||||
|
Element 2 |
254.0000 |
||||||||||
|
Element 3 |
31.80000 |
||||||||||
|
Element 4 |
54.10000 |
||||||||||
|
Element 5 |
25.00000 |
||||||||||
|
Element 6 |
114.3000 |
||||||||||
|
Element 7 |
BWD |
||||||||||
|
Element 8 |
FGD |
||||||||||
|
Getting elements with D3RWA |
|||||||||||
|
Element 7 |
BWD |
||||||||||
|
Element 8 |
FGD |
||||||||||
|
Success |
|||||||||||