8 Testing Your Applications and Custom Modules

This chapter describes tools for interacting with the Oracle Communications Billing and Revenue Management (BRM) server and testing custom applications and modules:

  • Opcode Workbench, a GUI application that is part of Developer Center

  • testnap, a command-line utility

Using Opcode Workbench

Opcode Workbench, part of Developer Center, is a graphic user interface (GUI) application that you use to test a BRM implementation by executing opcodes. It includes all the functionality of testnap, including the following tasks:

  • Creating input flists.

  • Saving input and output flists.

  • Executing opcodes.

  • Viewing return flists.

  • Creating, viewing, modifying, and deleting objects and their fields.

  • Opening, committing, and aborting transactions.

In addition, Opcode Workshop includes a number of enhancements not available in testnap:

  • Interactive editing of input flists.

  • Viewing flist data in text or tree view.

  • Cutting and pasting data to and from other text sources.

For more information on Opcode Workbench, see the Opcode Workbench Help system. For more information about Developer Center, see "About Developer Center".

Starting Opcode Workbench

To start Opcode Workbench:

  1. Start Developer Center and log in to the database you want to use.

    See "About Developer Center" for instructions.

  2. Click the Opcode Workbench toolbar button or choose Tools - Opcode Workbench.

Executing an Opcode

The most basic operation in Opcode Workbench is executing an opcode. By executing opcodes, you can accomplish many other tasks, such as creating objects, modifying objects, and searching the BRM database. For detailed instructions, see the Opcode Workbench Help.

Every opcode has specifications for the contents of its input flist. You can find these specifications in BRM Developer's Reference. See "Opcode Input and Output Specifications" for information about flist syntax.

To execute an opcode in Opcode Workbench:

  1. Enter the opcode to execute in the Opcode field in one of the following ways:

    • Type or paste the opcode name directly into the Opcode field.

    • Choose the opcode name from the Opcode field's pull-down list. The pull-down list includes all default opcodes and might contain some obsolete opcodes. It might also contain custom opcodes. See "Defining the Content of the Opcode Field".

    • Enter the opcode number into the Opcode field. Opcode numbers are listed in the pcm_ops.h file in BRM_Home/include directory, where BRM_Home is the directory in which you installed BRM components. Entering the opcode number is required for custom opcodes.

  2. If necessary, enter an opcode flag in the Flag field.

  3. Enter an input flist in one of the following ways:

    • Type it into the Input Flist area while Opcode Workbench is in Text View.

    • Create it by choosing fields and entering field data while Opcode Workbench is in Tree View.

    • Paste an flist into the Input Flist area from another source.

    • Open a saved input flist file.

  4. Click the Run Opcode button.

Defining the Content of the Opcode Field

The opcodes listed in the Opcode field are determined by the opcode.properties file, located in the Developer Center installation directory. This file contains a list of opcode names and corresponding opcode numbers.

You can edit the file to remove obsolete opcodes or to include custom opcodes. To include a custom opcode, enter its name and number following the pattern for the other entries in the file. For example, if you have a custom opcode called PCM_OP_CUST_CUSTOM with an opcode number of 19999, add this entry to the file:

PCM_OP_CUST_CUSTOM = 19999
  

After saving the file, restart Developer Center.

Opcodes Not Supported in Opcode Workbench

For technical reasons, the following opcodes related to transactions are not supported in this release of Opcode Workbench: PCM_OP_TRANS_ABORT, PCM_OP_TRANS_COMMIT, PCM_OP_TRANS_OPEN, PCM_OP_TRANS_POL_ABORT, PCM_OP_TRANS_POL_COMMIT, PCM_OP_TRANS_POL_OPEN, and PCM_OP_TRANS_POL_PREP_COMMIT.

Using testnap

testnap is a command-line utility that you can use to test your application and interact with the server by establishing a PCM connection with the Connection Manager (CM) and executing PCM opcodes using that connection. With testnap, you can perform the following tasks:

  • Create, view, modify, and delete objects and their fields.

  • Create input flists.

  • Save input and output flists.

  • Execute opcodes.

  • View return flists.

  • Open, commit, and abort transactions.

See "testnap" for a complete list of commands and options.

testnap relies on POID logins and types to identify the specific account or storable class to modify. A POID database number is required as a placeholder only.

Creating Objects

To create an object, you need to create an flist in a text file or as a here document in a testnap script. The following procedures show two ways to create an object using testnap.

For required fields of the objects, see the storable class definitions in "Storable Class Definitions" in BRM Developer's Reference.

Using a Text File to Create an Object

To use a text file to create an object:

  1. Create an flist using a text editor with at least the required fields of the object by using the following example:

    0 PIN_FLD_POID              POID [0] 0.0.0.1 /data 0 0
    0 PIN_FLD_NAME              STR [0] "example new data object creation"
    0 PIN_FLD_BUFFER            BUF [0] flag/size/offset 0x0 0 0 NULL data ptr
    0 PIN_FLD_HEADER_NUM        INT [0] 1234
    0 PIN_FLD_HEADER_STR        STR [0] "Some sample info in the example"
    0 PIN_FLD_PARENT            POID [0] 0.0.0.0  0 0
      
    
  2. Save the file.

    In this example, the file is called new_data_flist

  3. Start testnap.

    pin@demo5-661> testnap
    ===> database 0.0.0.1 from pin.conf "userid"
      
    
  4. Read the file into a buffer.

    r new_data_flist 1
      
    
  5. Create an object using that buffer.

    create 1 
    poid created was: 0.0.0.1 /data 8830 0
      
    

    The POID of the object created is returned.

Using a Here Document to Create an Object

This procedure enables you to combine data and commands in one file:

  1. Create a testnap script to read an object from a here document:

    #
    # A testnap script to create a new data object
    #
    # Read an flist into buffer 1 using a "here" document
    # Note the space between "<<" and the "here" token.
    # Note use of $DB_NO in poid database - takes current database number.
    r << XXX 1
    0 PIN_FLD_POID           POID [0] $DB_NO /data 0 0
    0 PIN_FLD_NAME            STR [0] "example new data object creation"
    0 PIN_FLD_BUFFER          BUF [0] flag/size/offset 0x0 0 0 NULL data ptr
    0 PIN_FLD_HEADER_NUM      INT [0] 1234
    0 PIN_FLD_HEADER_STR      STR [0] "Some sample info in the example"
    0 PIN_FLD_PARENT         POID [0] 0.0.0.0  0 0     XXX
    #
    # Create the object
    #
      create 1 poid
    #
    # Write the new poid id (from the "in" buffer)
    # into a file "new_data_poid.<pid_of_this_process>"
    #
    w in new_data_poid.$$
    #
      
    
  2. Save the script.

    In this example the script is saved as new_data_script.

  3. Run the script.

    You can either run testnap with the script name as the argument, as shown in this example, or use the < command in testnap.

    See testnap for details.

    ./testnap new_data_script
      
    poid created was: 0.0.0.1 /data 9854 0
      
    ls new_data_poid*
      
    new_data_poid.3881
      
    
  4. Display the contents of the file to verify that the output file is created.

    cat new_data_poid.3881
      
    # number of field entries allocated 1, used 1
    0 PIN_FLD_POID        POID [0] 0.0.0.1 /data 9854 0
    

Reading an Object and Fields

You can use testnap to read objects or fields in an object and write its contents to a file.

Reading Fields in an Object

To read fields from an object, each field or row in the field list must be in valid flist format, but the actual values for the last two fields need not be valid.

For example, you have to include " " for STR fields and some number for the TSTAMP field. If a field is blank, the system returns an error. Be sure to include the header line in all flists.

  1. Print the flist to ensure that the format is correct and all the fields are filled.

    # number of field entries allocated 36, used 36
      
    cat fldlist
      
    # number of field entries allocated 36, used 36
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 1
    0 PIN_FLD_NAME            STR [0] ""
    0 PIN_FLD_CREATED_T    TSTAMP [0] (8) 
    0 PIN_FLD_MOD_T        TSTAMP [0] (8)
    0 PIN_FLD_AAC_ACCESS      STR [0] ""
      
    
  2. Start testnap.

    testnap
      
    ===> database 0.0.0.1 from pin.conf "userid"
      
    
  3. Read the fields.

    r fldlist 1
    rflds 1
      
    

    Results:

    # number of field entries allocated 5, used 5
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 1
    0 PIN_FLD_NAME            STR [0] "top account obj"
    0 PIN_FLD_CREATED_T    TSTAMP [0] (854062698) Thu May 7 15:38:18 1999
    0 PIN_FLD_MOD_T        TSTAMP [0] (854062698) Thu May 7 15:38:18 1999
    0 PIN_FLD_AAC_ACCESS      STR [0] ""
    

Reading an Object and Writing Its Contents to a File

This example reads the contents of the /account object and writes it in to a file called root.account.

  1. Start testnap.

    testnap 
    ===> database 0.0.0.1 from pin.conf "userid"
      
    
  2. Read the object you want.

    This example reads the /account object.

    testnap 
      
        ===> database 0.0.0.1 from pin.conf "userid"
      
    robj - $DB /account 1
      
        # number of field entries allocated 36, used 36
        0 PIN_FLD_POID              POID [0] 0.0.0.1 /account 1 1
        0 PIN_FLD_NAME               STR [0] "top account obj"
        0 PIN_FLD_CREATED_T       TSTAMP [0] (854062698) Thu Jan 23 15:38:18 1999
        0 PIN_FLD_MOD_T           TSTAMP [0] (854062698) Thu Jan 23 15:38:18 1999
        0 PIN_FLD_AAC_ACCESS         STR [0] ""
        0 PIN_FLD_AAC_SOURCE         STR [0] ""
        0 PIN_FLD_AAC_VENDOR         STR [0] ""
        0 PIN_FLD_AAC_PACKAGE        STR [0] ""
        0 PIN_FLD_AAC_PROMO_CODE     STR [0] ""
        0 PIN_FLD_AAC_SERIAL_NUM     STR [0] ""
        0 PIN_FLD_STATUS            ENUM [0] 10100
        0 PIN_FLD_STATUS_FLAGS     INT [0] 0
        0 PIN_FLD_LAST_STATUS_T   TSTAMP [0] (0) <null>
        0 PIN_FLD_CLOSE_WHEN_T    TSTAMP [0] (0) <null>
        0 PIN_FLD_LASTSTAT_CMNT      STR [0] ""
        0 PIN_FLD_ACCOUNT_NO         STR [0] ""
        0 PIN_FLD_MERCHANT           STR [0] ""
        0 PIN_FLD_BILL_MODE          STR [0] ""
        0 PIN_FLD_BILL_TYPE         ENUM [0] 0
        0 PIN_FLD_PARENT            POID [0] 0.0.0.1 /account 1 0
        0 PIN_FLD_GROUP_OBJ         POID [0] 0.0.0.0  0 0
        0 PIN_FLD_NEXT_BILL_T     TSTAMP [0] (0) <null>
        0 PIN_FLD_LAST_BILL_T     TSTAMP [0] (0) <null>
        0 PIN_FLD_LAST_BILL_OBJ     POID [0] 0.0.0.0  0 0
        0 PIN_FLD_PENDING_RECV       NUM [0] 0.000000
        0 PIN_FLD_CURRENCY         INT [0] 0
        0 PIN_FLD_BILL_WHEN        INT [0] 0
        0 PIN_FLD_DEBIT_NUM          STR [0] ""
        0 PIN_FLD_DEBIT_EXP_ABA      STR [0] ""
        0 PIN_FLD_INV_PO             STR [0] ""
        0 PIN_FLD_INV_TERMS         ENUM [0] 0
        0 PIN_FLD_INV_FORMAT        POID [0] 0.0.0.0  0 0
        0 PIN_FLD_INV_INSTR          STR [0] ""
        0 PIN_FLD_ACCESS_CODE1       STR [0] ""
        0 PIN_FLD_ACCESS_CODE2       STR [0] ""
        0 PIN_FLD_INTERNAL_NOTES   BUF [0] flag/size/offset 0x0 0 0 NULL data ptr
      
    
  3. Save output in buffer 1.

    s 1
      
    
  4. Write the contents on buffer 1 into a file, and quit.

    This example writes the contents into a file called root.account.

    w 1 root.account
    q
      
    
  5. Print the contents of the file (root.account in the example) to verify that the file contains the contents of the /account object.

    cat root.account
      
        # number of field entries allocated 36, used 36
        0 PIN_FLD_POID                  POID [0] 0.0.0.1 /account 1 1
        0 PIN_FLD_NAME                   STR [0] "top account obj"
        0 PIN_FLD_CREATED_T           TSTAMP [0] (854062698) Thu Jan 23 15:38:18 1997
        0 PIN_FLD_MOD_T               TSTAMP [0] (854062698) Thu Jan 23 15:38:18 1997
        0 PIN_FLD_AAC_ACCESS             STR [0] ""
        0 PIN_FLD_AAC_SOURCE             STR [0] ""
        0 PIN_FLD_AAC_VENDOR             STR [0] ""
    0 PIN_FLD_AAC_PACKAGE                STR [0] ""
    0 PIN_FLD_AAC_PROMO_CODE             STR [0] ""
    0 PIN_FLD_AAC_SERIAL_NUM             STR [0] ""
    0 PIN_FLD_STATUS                    ENUM [0] 10100
    0 PIN_FLD_STATUS_FLAGS             INT [0] 0
    0 PIN_FLD_LAST_STATUS_T           TSTAMP [0] (0) <null>
    0 PIN_FLD_CLOSE_WHEN_T            TSTAMP [0] (0) <null>
    0 PIN_FLD_LASTSTAT_CMNT              STR [0] ""
    0 PIN_FLD_ACCOUNT_NO                 STR [0] ""
    0 PIN_FLD_MERCHANT                   STR [0] ""
    0 PIN_FLD_BILL_MODE                  STR [0] ""
    0 PIN_FLD_BILL_TYPE                 ENUM [0] 0
    0 PIN_FLD_PARENT                    POID [0] 0.0.0.1 /account 1 0
    0 PIN_FLD_GROUP_OBJ                 POID [0] 0.0.0.0  0 0
    0 PIN_FLD_NEXT_BILL_T             TSTAMP [0] (0) <null>
    0 PIN_FLD_LAST_BILL_T             TSTAMP [0] (0) <null>
    0 PIN_FLD_LAST_BILL_OBJ             POID [0] 0.0.0.0  0 0
    0 PIN_FLD_PENDING_RECV               NUM [0] 0.000000
    0 PIN_FLD_CURRENCY                 INT [0] 0
    0 PIN_FLD_BILL_WHEN                INT [0] 0
    0 PIN_FLD_DEBIT_NUM                  STR [0] ""
    0 PIN_FLD_DEBIT_EXP_ABA              STR [0] ""
    0 PIN_FLD_INV_PO                     STR [0] ""
    0 PIN_FLD_INV_TERMS                 ENUM [0] 0
    0 PIN_FLD_INV_FORMAT                POID [0] 0.0.0.0  0 0
    0 PIN_FLD_INV_INSTR                  STR [0] ""
    0 PIN_FLD_ACCESS_CODE1               STR [0] ""
    0 PIN_FLD_ACCESS_CODE2               STR [0] ""
    0 PIN_FLD_INTERNAL_NOTES             BUF [0] flag/size/offset 0x0 0 0 NULL data ptr
    

Manipulating External Buffer Fields

You can use testnap to manipulate the external buffer fields, for example, to read data in a buffer to a file.

Reading Data in a Buffer to a File

The procedure in this section shows how to set the root account object's (/account 1) PIN_FLD_INTERNAL_NOTES field, which is an external buffer field in the /account storable class.

In the input flist in the example, the 0x1 flag indicates that the contents of the file are to be written to the object. The size parameter (37), which is required, is the number of bytes in the file. The contents of this file is to be read into the external buffer field.

The offset field, if non-zero, indicates the number of bytes to be skipped in the file before reading size bytes from the file and placing them in the INTERNAL_NOTES field.

  1. Set up an input flist that specifies that the contents of the file xbuf.out be placed into the INTERNAL_NOTES field of the root account object when the Write Fields opcode is executed.

  2. Setup an input flist that will read the INTERNAL_NOTES field of the root account object when the Read Fields opcode is executed. The 0x3 flag indicates that the contents of the file are to be read from the object.

  3. Perform the Read Fields opcode. The contents of the INTERNAL_NOTES field are written to the newly created file xbuf.in.

    Example:

    file xbuf.out
      
    this is test of xbuf to account 1
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 0
    0 PIN_FLD_INTERNAL_NOTES  BUF [0] flag/size/offset/xbuf_file 0x1 37 0 xbuf.out 
      
    xbuf.write 
      
    # number of field entries allocated 45, used 45
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 0
    0 PIN_FLD_INTERNAL_NOTES  BUF [0] flag/size/offset/xbuf_file 0x1 37 0 xbuf.out
      
    buf.tst
    # number of field entries allocated 45, used 45
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 0
    0 PIN_FLD_INTERNAL_NOTES  BUF [0] flag/size/offset/xbuf_file 0x3 0 0 xbuf.in
      
    testnap
    r xbuf.write 1
    wflds 1
    r xbuf.tst 2
    rflds 2
    q
    

Using Buffers to Concatenate Flists

You can use testnap to concatenate flists. This example shows you how to:

  1. Read the contents of two different files into two different buffers (buffer 1 and buffer 2).

  2. Write the contents of buffer 1 to a file.

  3. Append the contents of buffer 2 to the same file.

    Example:

    cat bill
      
    0 PIN_FLD_POID POID [0] 0.0.0.1 /bill 1451 0
      
    cat deal
    0 PIN_FLD_POID                    POID [0] 0.0.0.1 /deal 1123 0
      
    testnap
      
    ===> database 0.0.0.1 from pin.conf "userid"
      
    r bill 1
    r deal 2
    w 1 billdeal
    w+ 2 billdeal
    q
    cat billdeal
      
    # number of field entries allocated 20, used 1
    0 PIN_FLD_POID                     POID [0] 0.0.0.1 /bill 1451 0
    # number of field entries allocated 20, used 1
    0 PIN_FLD_POID                     POID [0] 0.0.0.1 /deal 1123 0
    

Setting up Buffers and Displaying the List of Buffers

You can use testnap to display a list of all the buffers on your system.

In this example, the flists in two different files (bill and deal) are read into two different buffers. Then the list of all objects in all the buffers are displayed:

cat bill
  
0 PIN_FLD_POID               POID [0] 0.0.0.1 /bill 1451 0
  
cat deal
  
0 PIN_FLD_POID               POID [0] 0.0.0.1 /deal 1123 0
pin@demo5-511> testnap
===> database 0.0.0.1 from pin.conf "userid"
  
r bill 1
r deal 2
l
  
[1] type /bill, poid 1451
[2] type /deal, poid 1123

Creating and Displaying the Contents of a Buffer

To create and display the contents of a buffer:

  1. Read the contents of the file called bill into buffer 1.

    r bill 1
      
    
  2. Display the contents of buffer 1.

    d 1
      
    # number of field entries allocated 20, used 1
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /bill 1451 0
    

Executing Opcodes

To execute opcodes using testnap, use the xop command. You can execute any opcode by using the xop command.

The examples in this section show the following opcodes executed with a flag value of 0:

  • 107: PCM_OP_SUBSCRIPTION_PURCHASE_PRODUCT

  • 113: PCM_OP_PYMT_COLLECT

  • 115: PCM_OP_PYMT_VALIDATE

The input flist is read from a file into buffer 1, which is passed to xop, on the xop command line.

For more information, see "testnap".

For opcode numbers, see the opcode header files in BRM_Home/include/ops.

xop
  
0 PIN_FLD_POID   POID [0] 0.0.0.1 /event/billing/charge 1926 1
1     PIN_FLD_RESULT ENUM [0] 1
1     PIN_FLD_TYPE            ENUM [0] 0
1     PIN_FLD_DESCR           STR  [0] "authorization successful"
  
xop107
  
0 PIN_FLD_POID                        POID [0] 0.0.0.1 /account 1115 0 
0 PIN_FLD_PROGRAM_NAME             STR [0] "testnap"
0 PIN_FLD_END_T                 TSTAMP [0] (863480996) 
0 PIN_FLD_START_T               TSTAMP [0] (863480996) 
0 PIN_FLD_PRODUCTS               ARRAY [0] 
1     PIN_FLD_PRODUCT_OBJ         POID [0] 0.0.0.1 /product 1015 0
1     PIN_FLD_QUANTITY             NUM [0] 1.000000
1     PIN_FLD_PURCHASE_START_T  TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T    TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT    NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T     TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_END_T       TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT       NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T     TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T       TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT       NUM [0] 0.000000
1     PIN_FLD_DEAL_OBJ            POID [0] <null>
1     PIN_FLD_PLAN_OBJ            POID [0] <null>
  
xop 111
0 PIN_FLD_POID                      POID [0] 0.0.0.1 /account 1129 
0 PIN_FLD_START_T             TSTAMP [0] (now)
0 PIN_FLD_END_T               TSTAMP [0] (now)
0 PIN_FLD_PROGRAM_NAME           STR [0] "whatever"
0 PIN_FLD_INVOICE_INFO     SUBSTRUCT [0] 
1 PIN_FLD_TYPE                  ENUM [0] 277
1 PIN_FLD_INV_FORMAT            POID [0] 0.0.0.1 /config/invoice 100
1 PIN_FLD_BILL_OBJ              POID [0] 0.0.0.1 /bill 1131
  
xop 115
0 PIN_FLD_POID                      POID [0] 0.0.0.1 /account -1 0
0 PIN_FLD_PROGRAM_NAME               STR [0] "testnap"
0 PIN_FLD_END_T                   TSTAMP [0] (863481004) 
0 PIN_FLD_START_T                 TSTAMP [0] (863481004) 
0 PIN_FLD_CHARGES                  ARRAY [0] 
1     PIN_FLD_ACCOUNT_OBJ           POID [0] 0.0.0.1 /account 1 0
1     PIN_FLD_COMMAND               ENUM [0] 1
1     PIN_FLD_MERCHANT               STR [0] "Portal"
1     PIN_FLD_BILL_TYPE             ENUM [0] 10003
1     PIN_FLD_CURRENCY             INT [0] 840
1     PIN_FLD_DEBIT_NUM              STR [0] "4101000000000000"
1     PIN_FLD_DEBIT_EXP_ABA          STR [0] "0999"
1     PIN_FLD_FIRST_CANON            STR [0] ""
1     PIN_FLD_MIDDLE_CANON           STR [0] "" 
1     PIN_FLD_LAST_CANON         STR [0] "saver3"
1     PIN_FLD_ADDRESS            STR [0] "I hope this works"
1     PIN_FLD_CITY               STR [0] "x"
1     PIN_FLD_STATE              STR [0] "CA"
1     PIN_FLD_ZIP                STR [0] "44444"
1     PIN_FLD_COUNTRY         STR [0] ""

Retrieving Objects

You can use testnap to search for objects and retrieve the contents of the objects, of specific objects, or the Portal object IDs (POIDs) of the objects.

Retrieving the Contents of the First Object Found

This example shows how to perform a search and retrieve the contents of the first object found by that search.

cat search
  
0 PIN_FLD_POID                     POID [0] 0.0.0.1 /search 201
0 PIN_FLD_ARGS                    ARRAY [1]
1     PIN_FLD_POID                 POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_RESULTS                 ARRAY [0]
  
testnap
  
===> database 0.0.0.1 from pin.conf "userid"
  
r search 1
search 1
  
# number of field entries allocated 2, used 2
0 PIN_FLD_POID                     POID [0] 0.0.0.1 /search 201 0
0 PIN_FLD_RESULTS                 ARRAY [0] allocated 36, used 36
1     PIN_FLD_POID                 POID [0] 0.0.0.1 /account 1 1
1     PIN_FLD_NAME                  STR [0] "top account obj"
1     PIN_FLD_CREATED_T          TSTAMP [0] (855794203) Wed Feb 12 16:36:43 1999
1     PIN_FLD_MOD_T          TSTAMP [0] (855794203) Wed Feb 12 16:36:43 1999
1     PIN_FLD_AAC_ACCESS        STR [0] ""
1     PIN_FLD_AAC_SOURCE        STR [0] ""
1     PIN_FLD_AAC_VENDOR        STR [0] ""
1     PIN_FLD_AAC_PACKAGE       STR [0] ""
1     PIN_FLD_AAC_PROMO_CODE    STR [0] ""
1     PIN_FLD_AAC_SERIAL_NUM    STR [0] ""
1     PIN_FLD_STATUS           ENUM [0] 10100
1     PIN_FLD_STATUS_FLAGS    INT [0] 0
1     PIN_FLD_LAST_STATUS_T  TSTAMP [0] (0) <null>
1     PIN_FLD_CLOSE_WHEN_T   TSTAMP [0] (0) <null>
1     PIN_FLD_LASTSTAT_CMNT     STR [0] ""
1     PIN_FLD_ACCOUNT_NO        STR [0] ""
1     PIN_FLD_MERCHANT              STR [0] ""
1     PIN_FLD_BILL_MODE             STR [0] ""
1     PIN_FLD_BILL_TYPE            ENUM [0] 0
1     PIN_FLD_PARENT               POID [0] 0.0.0.1 /account 1 0
1     PIN_FLD_GROUP_OBJ            POID [0] 0.0.0.0  0 0
1     PIN_FLD_NEXT_BILL_T        TSTAMP [0] (0) <null>
1     PIN_FLD_LAST_BILL_T        TSTAMP [0] (0) <null>
1     PIN_FLD_LAST_BILL_OBJ        POID [0] 0.0.0.0  0 0
1     PIN_FLD_PENDING_RECV          NUM [0] 0.000000
1     PIN_FLD_CURRENCY            INT [0] 0
1     PIN_FLD_BILL_WHEN           INT [0] 0
1     PIN_FLD_DEBIT_NUM         STR [0] ""
1     PIN_FLD_DEBIT_EXP_ABA     STR [0] ""
1     PIN_FLD_INV_PO            STR [0] ""
1     PIN_FLD_INV_TERMS        ENUM [0] 0
1     PIN_FLD_INV_FORMAT       POID [0] 0.0.0.0  0 0
1     PIN_FLD_INV_INSTR         STR [0] ""
1     PIN_FLD_ACCESS_CODE1      STR [0] ""
1     PIN_FLD_ACCESS_CODE2      STR [0] ""
1     PIN_FLD_INTERNAL_NOTES    BUF [0] flag/size/offset 0x0 0 0 NULL data ptr

Retrieving the POID Field of the Objects Found

This example shows how to search for objects and retrieve only the POID field of each object found.

cat search.all_acct
  
0 PIN_FLD_POID                   POID [0] 0.0.0.1 /search 201
0 PIN_FLD_ARGS                  ARRAY [1]
1     PIN_FLD_POID               POID [0] 0.0.0.1 /account -1 1
0 PIN_FLD_RESULTS               ARRAY [0]
1     PIN_FLD_POID               POID [0] 0.0.0.1 /account 0 0
  
testnap     
  
===> database 0.0.0.1 from pin.conf "userid"
  
r search.all_acct 2
search 2
  
# number of field entries allocated 14, used 14
0 PIN_FLD_POID              POID [0] 0.0.0.1 /search 201 0
0 PIN_FLD_RESULTS          ARRAY [0] allocated 1, used 1
1     PIN_FLD_POID          POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_RESULTS          ARRAY [1] allocated 1, used 1
1     PIN_FLD_POID          POID [0] 0.0.0.1 /account 1046 13
0 PIN_FLD_RESULTS          ARRAY [2] allocated 1, used 1
1     PIN_FLD_POID          POID [0] 0.0.0.1 /account 1097 14
0 PIN_FLD_RESULTS          ARRAY [3] allocated 1, used 1
1     PIN_FLD_POID          POID [0] 0.0.0.1 /account 1111 13
0 PIN_FLD_RESULTS          ARRAY [4] allocated 1, used 1
1     PIN_FLD_POID          POID [0] 0.0.0.1 /account 1127 16

Creating a New Search Object

You can create a new search object, load it in the database, and use it as a template for your searches.

The following example shows you how to create a new search template.This template can be used in programs to search for search objects in the database.

  1. Read an existing search object and save it as a template:

    testnap
      
    ===> database 0.0.0.1 from pin.conf "userid"
      
    robj - $DB /search 222
      
    # number of field entries allocated 6, used 6
    0 PIN_FLD_POID              POID [0] 0.0.0.1 /search 222 1
    0 PIN_FLD_NAME               STR [0] "1 result: sum, 6 arg =, >=, <, =, like, > special search in /event/usage"
    0 PIN_FLD_CREATED_T       TSTAMP [0] (857152638) Fri Feb 28 09:57:18 1997
    0 PIN_FLD_MOD_T           TSTAMP [0] (857152638) Fri Feb 28 09:57:18 1997
    0 PIN_FLD_FLAGS              INT [0] 1
    0 PIN_FLD_TEMPLATE           STR [0] "select sum( F1 ) from /event/usage where
                                          event_total_t.rec_id = 1
                                          and F2 = V2 and F3 >= V3 and F4 < V4 
                                          and F5 = V5 and F6 like V6 and F7 > V7"
    s 1
      
    saved input in buffer 1
      
    w 1 search.template
    q
      
    
  2. Edit the template file to suit your needs.

  3. Start testnap.

  4. Create the new search template, that is, a new search object with the number 977, as shown in the following example:

    cat search.template
      
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /search 977
    0 PIN_FLD_NAME            STR [0] "1 arg = search for /search/$1"
    0 PIN_FLD_FLAGS           INT [0] 1
    0 PIN_FLD_TEMPLATE        STR [0] "select X from /search/$1 where F1 = V1 "
      
    testnap
      
    ===> database 0.0.0.1 from pin.conf "userid"
    # Read the search template in to buffer 1
      
    r search.template 1
      
    # Create an object using the contents of buffer 1
      
    create 1 poid
       poid created was: 0.0.0.1 /search 977 0
      
    # Verify that the search object was created
      
    robj - $DB /search 977
      
    # number of field entries allocated 6, used 6
    0 PIN_FLD_POID          POID [0] 0.0.0.1 /search 977 0
    0 PIN_FLD_NAME           STR [0] "1 arg = search for /search/$1"
    0 PIN_FLD_CREATED_T   TSTAMP [0] (857521039) Tue Mar  4 16:17:19 1997
    0 PIN_FLD_MOD_T       TSTAMP [0] (857521039) Tue Mar  4 16:17:19 1997
    0 PIN_FLD_FLAGS         INT [0] 1
    0 PIN_FLD_TEMPLATE       STR [0] "select X from /search/$1 where F1 = V1 "
      
    

testnap displays /search object 977 from the database.

Retrieving Objects One at a Time

You can use testnap to do a step search. This example shows how to retrieve objects found in a step search one at a time:

t_flist2
  
0 PIN_FLD_POID          POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_ARGS         ARRAY [1]
1       PIN_FLD_PASSWD   STR [0] "md5|%"
0 PIN_FLD_RESULTS      ARRAY [1]
1       PIN_FLD_POID    POID [0] 0.0.0.0 / 0 0
1       PIN_FLD_LOGIN    STR [0] ""
1       PIN_FLD_PASSWD   STR [0] ""
  
testnap
  
===> database 0.0.0.1 from pin.conf "userid"
  
r t_flist2 1
ssrch 1
  
# number of field entries allocated 2, used 2
0 PIN_FLD_POID             POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_RESULTS         ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID         POID [0] 0.0.0.1 /service/pcm_client 1 1
1     PIN_FLD_LOGIN         STR [0] "root.0.0.0.1"
1     PIN_FLD_PASSWD        STR [0] "md5|5f4dcc3b5aa765d61d8327deb882cf99"
  
snext
  
buffer: 1
# number of field entries allocated 2, used 2
0 PIN_FLD_POID             POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_RESULTS         ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID         POID [0] 0.0.0.1 /service/admin_client 2 1
1     PIN_FLD_LOGIN         STR [0] "root.0.0.0.1"
1     PIN_FLD_PASSWD     STR [0] "md5|5f4dcc3b5aa765d61d8327deb882cf99"
  
send
  
buffer: 1
# number of field entries allocated 3, used 3
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_ARGS          ARRAY [1] allocated 1, used 1
1     PIN_FLD_PASSWD      STR [0] "md5|%"
0 PIN_FLD_RESULTS       ARRAY [1] allocated 3, used 3
1     PIN_FLD_POID       POID [0] 0.0.0.0 / 0 0
1     PIN_FLD_LOGIN       STR [0] ""
1     PIN_FLD_PASSWD      STR [0] ""

Retrieving a Specific Number of Objects at a Time

You can change the number of elements in the PIN_FLD_RESULTS ARRAY specification to specify the number of objects you want to retrieve at a time.

This example shows retrieving three objects each time:

cat t_flist_arr
  
0 PIN_FLD_POID          POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_ARGS         ARRAY [1]
1       PIN_FLD_PASSWD   STR [0] "md5|%"
0 PIN_FLD_RESULTS      ARRAY [3]
1       PIN_FLD_POID    POID [0] 0.0.0.0 / 0 0
1       PIN_FLD_LOGIN    STR [0] ""
1       PIN_FLD_PASSWD   STR [0] ""
  
testnap
===> database 0.0.0.1 from pin.conf "userid"
  
r t_flist_arr 1
ssrch 1
  
# number of field entries allocated 4, used 4
0 PIN_FLD_POID              POID [0] 0.0.0.1 /search 236 0
0 PIN_FLD_RESULTS          ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID          POID [0] 0.0.0.1 /service/pcm_client 1 1
1     PIN_FLD_LOGIN          STR [0] "root.0.0.0.1"
1     PIN_FLD_PASSWD         STR [0] "md5|5f4dcc3b5aa765d61d8327deb882cf99"
0 PIN_FLD_RESULTS          ARRAY [1] allocated 3, used 3
1     PIN_FLD_POID          POID [0] 0.0.0.1 /service/admin_client 2 1
1     PIN_FLD_LOGIN          STR [0] "root.0.0.0.1"
1     PIN_FLD_PASSWD         STR [0] "md5|5f4dcc3b5aa765d61d8327deb882cf99"
0 PIN_FLD_RESULTS          ARRAY [2] allocated 3, used 3
1     PIN_FLD_POID          POID [0] 0.0.0.1 /service/email 1061 3
1     PIN_FLD_LOGIN          STR [0] "kim@csi.com"
1     PIN_FLD_PASSWD         STR [0] "md5|ae2b1fca515949e5d54fb22b8ed95575"
  
q

Modifying Objects

You can use testnap to add and replace fields in /config objects. See "Using testnap to Modify /config Objects".

Sorting an Flist

On UNIX by using the sort option in testnap, you can sort the contents of a buffer.

See "testnap" for details.

This example shows how to read an flist into the buffer and sort it:

cat products
  
0 PIN_FLD_PRODUCTS                  ARRAY [1] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ            POID [0] 0.0.0.1 /product 1012 0
1     PIN_FLD_QUANTITY                NUM [0] 11.000000
1     PIN_FLD_DEAL_OBJ               POID [0] 0.0.0.1 /deal 3033 0
1     PIN_FLD_PLAN_OBJ               POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ            POID [0] 0.0.0.1 /service/ip 1048 0
1     PIN_FLD_CREATED_T            TSTAMP [0] (855613770) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T     TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T       TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT       NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T        TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_END_T          TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT          NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T        TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T          TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT          NUM [0] 0.000000
0 PIN_FLD_PRODUCTS                  ARRAY [2] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ            POID [0] 0.0.0.1 /product 1014 0
1     PIN_FLD_QUANTITY                NUM [0] 1.000000
1     PIN_FLD_DEAL_OBJ               POID [0] 0.0.0.1 /deal 1035 0
1     PIN_FLD_PLAN_OBJ               POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ            POID [0] 0.0.0.1 /service/ip 1048 0
1     PIN_FLD_CREATED_T            TSTAMP [0] (855613770) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T     TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T       TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT       NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T        TSTAMP [0] (857341770) Fri May 7  14:29:30 1999
1     PIN_FLD_CYCLE_END_T          TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT          NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T        TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T          TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT          NUM [0] 0.000000
0 PIN_FLD_PRODUCTS                  ARRAY [3] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ            POID [0] 0.0.0.1 /product 1009 0
1     PIN_FLD_QUANTITY                NUM [0] 77.000000
1     PIN_FLD_DEAL_OBJ           POID [0] 0.0.0.1 /deal 2034 0
1     PIN_FLD_PLAN_OBJ           POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ        POID [0] 0.0.0.1 /service/email 1053 0
1     PIN_FLD_CREATED_T        TSTAMP [0] (855613777) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T   TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT   NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T    TSTAMP [0] (863389777) Fri May 7  14:29:30 1999
1     PIN_FLD_CYCLE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT      NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T    TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT      NUM [0] 0.000000
  
cat products.sort
  
0 PIN_FLD_PRODUCTS                   ARRAY [0] allocated 20, used 1
1     PIN_FLD_QUANTITY                 NUM [0] 1.000000
  
testnap
  
===> database 0.0.0.1 from pin.conf "userid"
  
r products 2
r products.sort 1
sort 2 1
  
# number of field entries allocated 20, used 3
0 PIN_FLD_PRODUCTS                  ARRAY [2] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ            POID [0] 0.0.0.1 /product 1014 0
1     PIN_FLD_QUANTITY                NUM [0] 1.000000
1     PIN_FLD_DEAL_OBJ               POID [0] 0.0.0.1 /deal 1035 0
1     PIN_FLD_PLAN_OBJ               POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ            POID [0] 0.0.0.1 /service/ip 1048 0
1     PIN_FLD_CREATED_T            TSTAMP [0] (855613770) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T     TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T       TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT       NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T        TSTAMP [0] (857341770) Fri May 7  14:29:30 1999
1     PIN_FLD_CYCLE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT      NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T    TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT      NUM [0] 0.000000
0 PIN_FLD_PRODUCTS              ARRAY [1] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ        POID [0] 0.0.0.1 /product 1012 0
1     PIN_FLD_QUANTITY            NUM [0] 11.000000
1     PIN_FLD_DEAL_OBJ           POID [0] 0.0.0.1 /deal 3033 0
1     PIN_FLD_PLAN_OBJ           POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ        POID [0] 0.0.0.1 /service/ip 1048 0
1     PIN_FLD_CREATED_T        TSTAMP [0] (855613770) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T   TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT   NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T    TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT      NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T    TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT      NUM [0] 0.000000
0 PIN_FLD_PRODUCTS              ARRAY [3] allocated 20, used 15
1     PIN_FLD_PRODUCT_OBJ        POID [0] 0.0.0.1 /product 1009 0
1     PIN_FLD_QUANTITY            NUM [0] 77.000000
1     PIN_FLD_DEAL_OBJ           POID [0] 0.0.0.1 /deal 2034 0
1     PIN_FLD_PLAN_OBJ           POID [0] 0.0.0.1 /plan 1036 0
1     PIN_FLD_SERVICE_OBJ        POID [0] 0.0.0.1 /service/email 1053 0
1     PIN_FLD_CREATED_T        TSTAMP [0] (855613777) Fri May 7  14:29:30 1999
1     PIN_FLD_PURCHASE_START_T TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_END_T   TSTAMP [0] (0) <null>
1     PIN_FLD_PURCHASE_DISCOUNT   NUM [0] 0.000000
1     PIN_FLD_CYCLE_START_T    TSTAMP [0] (863389777) Fri May 7  14:29:30 1999
1     PIN_FLD_CYCLE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_CYCLE_DISCOUNT      NUM [0] 0.000000
1     PIN_FLD_USAGE_START_T    TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_END_T      TSTAMP [0] (0) <null>
1     PIN_FLD_USAGE_DISCOUNT      NUM [0] 0.000000
  
q

Invoking Shell Commands

On UNIX, you can invoke shell commands from testnap.

This procedure shows how the results of a grep invocation are used to determine what exit code to use.

  1. Search the database to see if /service/ip testterm01 is already created.

    r << XXX 1
      
    0 PIN_FLD_POID           POID [0] $DB_NO /search 236 0
    0 PIN_FLD_PARAMETERS      STR [0] "ip"
    0 PIN_FLD_ARGS          ARRAY [1]
    1     PIN_FLD_LOGIN       STR [0] "testterm01"
    0 PIN_FLD_RESULTS       ARRAY [0]
    1     PIN_FLD_POID       POID [0] 0.0.0.0  0 0
    1     PIN_FLD_LOGIN       STR [0] ""
    XXX
      
    search 1
      
    
  2. Write the results to a file.

    w in out.setup.fm_term.$$/exist.testterm01
    

    Note:

    $$ is substituted for the current process id on UNIX, file names in the r, r+, w, w+, and < commands, and in the arguments to the ! command.
  3. Use a UNIX shell to perform an if-test on the results of a grep invocation, and then set the exit code accordingly.

    ! if grep "testterm01" out.setup.fm_term.$$/exist.testterm01 ; then exit 1; else exit 0 ; fi
    

Testing the CM to DM Connection

You can check the CM to DM connection by using testnap with the noop command. noop takes the database number of a POID and calls the PCM_OP_TEST_LOOPBACK on that database.

  1. Read the contents of the file called foo into buffer 1.

  2. Display the contents of buffer 1.

  3. Enter noop.

    Example:

    r foo 1
    l
      
    [1] type /bill, poid 1451
      
    noop
    buffer: 1
      
    # number of field entries allocated 1, used 1
    0 PIN_FLD_POID           POID [0] 0.0.0.1 /bill 1451 0
    

Displaying and Setting Properties of testnap

You use the p command set to display properties of testnap.

Displaying Property Settings

Use this example:

p
  
cwd = /BRM_Home/sys/data/pricing/example/tom
continue_on_error = off
db_no = 0
display_results = on
xop_results_on_err = off
noclobber = off
async = off
async_callback = off
op_timing = off

Setting or Changing Properties

Use this example. This example displays the properties and then changes logging from 'off' to 'on' and sets the logfile to default.testnaplog.

p
  
        cwd = /BRM_Home/sys/test
        continue_on_error = off
        db_no = 0
        display_results = on
        xop_results_on_err = off
        noclobber = off
        async = off
        async_callback = off
        logging = off
        logfile = <nil>
        echo_script = off
        op_timing = off
        exit_on_shell_status = on
  
p logging on
p
  
        cwd = /BRM_Home/sys/test
        continue_on_error = off
        db_no = 0
        display_results = on
        xop_results_on_err = off
        noclobber = off
        async = off
        async_callback = off
        logging = on
        logfile = default.testnaplog
        echo_script = off
        op_timing = off
        exit_on_shell_status = on

Troubleshooting testnap

The following example shows a successful testnap execution:

testnap
  
===> database 0.0.0.1 from pin.conf "userid"
  
robj - 0.0.0.1 /account 1
  
# number of field entries allocated 36, used 36
0 PIN_FLD_POID           POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_NAME            STR [0] "top account obj"
0 PIN_FLD_CREATED_T    TSTAMP [0] (846729765) Fri May 7 18:42:45 1999
0 PIN_FLD_MOD_T        TSTAMP [0] (846729765) Fri May 7 18:42:45 1999
0 PIN_FLD_AAC_ACCESS      STR [0] ""
0 PIN_FLD_AAC_SOURCE      STR [0] ""
0 PIN_FLD_AAC_VENDOR      STR [0] ""
0 PIN_FLD_AAC_PACKAGE     STR [0] ""
0 PIN_FLD_AAC_PROMO_CODE    STR [0] ""
0 PIN_FLD_AAC_SERIAL_NUM    STR [0] ""
0 PIN_FLD_STATUS         ENUM [0] 10100
0 PIN_FLD_STATUS_FLAGS  INT [0] 0
0 PIN_FLD_LAST_STATUS_T TSTAMP [0] (0) <null>
0 PIN_FLD_CLOSE_WHEN_T TSTAMP [0] (0) <null>
0 PIN_FLD_LASTSTAT_CMNT    STR [0] ""
0 PIN_FLD_ACCOUNT_NO      STR [0] ""
0 PIN_FLD_MERCHANT        STR [0] ""
0 PIN_FLD_BILL_MODE       STR [0] ""
0 PIN_FLD_BILL_TYPE      ENUM [0] 0
0 PIN_FLD_PARENT         POID [0] 0.0.0.1 /account 1 0
0 PIN_FLD_GROUP_OBJ      POID [0] 0.0.0.0  0 0
0 PIN_FLD_NEXT_BILL_T  TSTAMP [0] (0) <null>
0 PIN_FLD_LAST_BILL_T  TSTAMP [0] (0) <null>
0 PIN_FLD_LAST_BILL_OBJ   POID [0] 0.0.0.0  0 0
0 PIN_FLD_PENDING_RECV    NUM [0] 0.000000
0 PIN_FLD_CURRENCY      INT [0] 0
0 PIN_FLD_BILL_WHEN     INT [0] 0
0 PIN_FLD_DEBIT_NUM       STR [0] ""
0 PIN_FLD_DEBIT_EXP_ABA    STR [0] ""
0 PIN_FLD_INV_PO          STR [0] ""
0 PIN_FLD_INV_TERMS      ENUM [0] 0
0 PIN_FLD_INV_FORMAT     POID [0] 0.0.0.0  0 0
0 PIN_FLD_INV_INSTR       STR [0] ""
0 PIN_FLD_ACCESS_CODE1    STR [0] ""
0 PIN_FLD_ACCESS_CODE2    STR [0] ""
0 PIN_FLD_INTERNAL_NOTES    BUF [0] flag/size/offset 0x0 0 0 NULL data ptr
  

When testnap doesn't run successfully, you see an error message or the nap prompt doesn't appear. Also, you see error messages in the testnap log file located by default in the BRM_Home/sys/test directory. The error messages include an error number and the location of where the error occurred.

Check the testnap log file as well as the cm.log, cm.pinlog, dm_oracle.log, and dm_oracle.pinlog files for details.

Most problems with starting or running testnap involve incorrect parameters in the testnap configuration file.

If testnap doesn't start, you see the following message:

E Thu May B 13:16:31 1999  db2.corp  :6029 pcm.c(1.40):90
     Connect open failed (4/100) in pcm context open 
E Thu May B 13:22:07 1999  db2.corp  :6033  pcm.c(1.40):90
     Connect open failed (4/101) in pcm context open
  

This section describes the most common problems in starting testnap and how to resolve them.

Error 27: Connection Error

This error is caused by one of the following situations:

  • The maximum number of connections have been exceeded. This is indicated by the following message:

    (10567): pcp_open, bad connect: Connection refused 
    (10567): login failed 27 
    ERROR: testnap: pcm_context_open():: err 27,
             loc 0, pin_errclass 0, field 0/0, rec_id 0, resvd 5
      
    

    You can resolve the problem by increasing the number of connections in the CM pin.conf file and reconfiguring the CM, or by connecting to a different CM.

  • The DM processes did not start when you tried to start testnap, caused by the following sequence of commands:

    pin@demo5-86> pin_ctl start dm_oracle
    pin@demo5-87> pin_ctl start cm
    pin@demo5-88> testnap
    ERROR: testnap: pcm_connect():: err 27,
    loc 2, pin_errclass 1, field 0/0, rec_id 0, resvd 7
      
    

    Wait a few seconds for the DM processes to start after typing pin_ctl start cm before starting testnap.

Error 4: Login Failure

Error 4 in the message indicates that login failed because of an incorrect port or host number or incorrect user ID.

Incorrect port number

A message such as the following indicates that the port number specified by the cm_ports entry in the testnap pin.conf file is incorrect:

testnap 
(8488): bad receive of login response, err 4 
(8488): login failed 4 
ERROR: testnap: pcm_context_open():: err 4,
         loc 0, pin_errclass 0, field 0/0, rec_id 0, resvd 5 
  

To resolve the problem, make sure that the port number in the cm_ports entry in the testnap pin.conf file matches the cm_ports entry in the CM pin.conf file.

Incorrect user ID

The following message indicates that the database number (db_no) in the userid entry of the testnap pin.conf file is incorrect:

testnap 
bad/no "userid" from pin.conf file 
ERROR: testnap: pcm context open():: err 4,
     loc 0, pin errclass 0, field 0/0, rec_id 0, resvd 3
  

To resolve the problem, enter the correct database number in the pin.conf file.

Connection refused

The following message indicates that either the testnap pin.conf file has an incorrect port number or hostname in the cm_ports entry or there is no CM running.

testnap 
(1215): pcp_open, bad connect: Connection refused 
ERROR: testnap: pcm context open():: err 4,
      loc 0, pin_errclass 0, field 0/0, rec_id 0, resvd 4
  

To resolve the problem, make sure that the hostname and port number are correct and that the CM is running.

Incorrect hostname

The following message indicates that the hostname in the testnap pin.conf file is incorrect:

testnap 
(6044): pcp_open(), bad gethostbyname("XXX_HOSTNAME"): Error 0 
ERROR: testnap: pcm_context_open():: err 4,
      loc 0, pin errclass 0, field 0/0, rec_id 0, resvd 3
  

To resolve the problem, enter the correct hostname.

Incorrect Database Number

The following message indicates that testnap could connect to the DM through the CM, but couldn't access the database, since the database number was incorrect:

testnap 
XXX: database 23 from pin.conf "userid" 
ERROR: dd vrfy(): pcm read_flds(): 23 
  

Even though the CMs and DMs successfully came up, this is the first point at which the validity of the database number is checked.

To resolve the problem, correct the database number (db_no) in the userid in testnap pin.conf file. Also, ensure that the testnap, CM, and DM pin.conf files have the same database numbers.

Error 26: DM Not Running

The following messages indicate that there is no DM running.

testnap 
  
XXX: database 2 from pin.conf "userid" 
ERROR: dd vrfy(): pcm read_flds(): 26 
  
robj - 0.0.0.2 /account 1      
  
PCM_OP_READ_OBJ failed: err 26,
           loc 3, pin_errclass I, field 0/16, rec_id 0, resvd 3      
  

To resolve this, start a DM.

Invalid Buffer Index

The following message indicates that there is a parameter missing in the testnap command:

testnap      
  
XXX: database 2 from pin.conf "userid"      
  
robj /account 1      
  
ERROR: invalid buffer index "2"      
no object to use for robj      
  
robj
  

To resolve the problem, be sure to include the "-" in front of the number 0.0.0.2:

robj - 0.0.0.2 /account 1

Error 56: Failed to Connect

If some older DMs started using a different database number are still running and accepting connections from your application, which is trying to use a different database, testnap returns error 56.

In addition, the testnap pinlog file contains the following message:

E Fri May 7 16:14:11 1999 demo5 <no name>:2025 pcm.c(1.46):101
        Connect open failed (56/7) in pcm_context_open
E Fri May 7 16:14:11 1999 demo5 <no name>:2025 pcm_conn.c(1.3):158
        pcm_connect: bad pcm_context_open, err 56
  

The CM pinlog file contains the following message:

E Fri May 7 16:35:46 1999 demo5 cm:2125 fm_utils_trans.c:114
        fm_utils_trans_open error [location=<PIN_ERRLOC_DM:4>
class=<PIN_ERRCLASS_APPLICATION:4> errno=<PIN_ERR_WRONG_DATABASE:31> field
num=<PIN_FLD_POID:7,16> recid=<0> reserved=<0>]
  

To resolve the problem, stop all the DMs and restart them.

Use ps -ef | grep dm to find and stop all DMs.

Note:

testnap also returns error 56 when you re-create the database but do not commit your changes in SQL or in init_tables.sql.hostname.