Posts Tagged ‘PCM_OP_STEP_END’


Searches Continued: Step Searches (PCM_OP_STEP_SEARCH, PCM_OP_STEP_NEXT, and PCM_OP_STEP_END)

March 24th, 2010 by Allan Anderson • No Comments »

Continuing our discussion on BRM searches, lets talk about step searches.

In many cases the number of results to be returned will overwhelm the regular PCM_OP_SEARCH op-code.  This can basically cause your PCM context to become unusable and can cause some problems in your DM.  Therefore, efforts should be made to search using PCM_OP_STEP_SEARCH when the result set may become very large.

PCM_OP_STEP_SEARCH Input FLIST

The input FLIST is the same as the input for PCM_OP_SEARCH op-code, but is done in 3 discrete steps:

1.  Call PCM_OP_STEP_SEARCH to start the step search.  Returns the first result set based on the number specified in the PIN_FLD_RESULTS array element ID.  After this point, no op-codes may be called on this context other than PCM_OP_STEP_NEXT and PCM_OP_STEP_END until after the PCM_OP_STEP_END op-code is called.
2.  Call PCM_OP_STEP_NEXT repeatedly using the same input FLIST until all the desired results have been retrieved.
3.  Call PCM_OP_STEP_END to end the step search, and free the context to be able to call other op-codes.

Step Search Result FLISTs

The results FLISTs returned from PCM_OP_STEP_SEARCH and PCM_OP_STEP_NEXT are identical to that of PCM_OP_SEARCH.  The results from PCM_OP_STEP_NEXT will be the input FLIST from PCM_OP_STEP_SEARCH, and may be safely ignored.

Example:
Note the Rec ID of 5 in the PIN_FLD_RESULTS array will determine the result set ‘chunk’ size.

nap> d 1
# number of field entries allocated 20, used 5
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
0 PIN_FLD_RESULTS       ARRAY [5] allocated 20, used 3
1     PIN_FLD_POID           POID [0] NULL poid pointer
1     PIN_FLD_CREATED_T    TSTAMP [0] (0)
1     PIN_FLD_NAMEINFO      ARRAY [*] allocated 20, used 2
2         PIN_FLD_LAST_NAME       STR [0] NULL str ptr
2         PIN_FLD_FIRST_NAME      STR [0] NULL str ptr
0 PIN_FLD_ARGS          ARRAY [1] allocated 20, used 1
1     PIN_FLD_NAMEINFO      ARRAY [*] allocated 20, used 1
2         PIN_FLD_FIRST_NAME      STR [0] "%a%"
0 PIN_FLD_TEMPLATE        STR [0] "select X from /account where F1 like V1 "
0 PIN_FLD_FLAGS           INT [0] 0
nap> xop PCM_OP_STEP_SEARCH 0 1
xop: opcode 17, flags 0
# number of field entries allocated 6, used 6
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
0 PIN_FLD_RESULTS       ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 35862893 19
1     PIN_FLD_CREATED_T    TSTAMP [0] (1268321292) 03/11/10 09:28:12
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Fuhes-Monari"
2         PIN_FLD_FIRST_NAME      STR [0] "Debrah"
0 PIN_FLD_RESULTS       ARRAY [1] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 33265410 2065
1     PIN_FLD_CREATED_T    TSTAMP [0] (1238622641) 04/01/09 16:50:41
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Ogrlo"
2         PIN_FLD_FIRST_NAME      STR [0] "Micael"
0 PIN_FLD_RESULTS       ARRAY [2] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 35856912 42
1     PIN_FLD_CREATED_T    TSTAMP [0] (1267800937) 03/05/10 08:55:37
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Christen"
2         PIN_FLD_FIRST_NAME      STR [0] "Beaud"
0 PIN_FLD_RESULTS       ARRAY [3] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 28715619 15211
1     PIN_FLD_CREATED_T    TSTAMP [0] (1187360056) 08/17/07 09:14:16
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Bianc"
2         PIN_FLD_FIRST_NAME      STR [0] "Gin"
0 PIN_FLD_RESULTS       ARRAY [4] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 34456511 191
1     PIN_FLD_CREATED_T    TSTAMP [0] (1252009050) 09/03/09 15:17:30
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Gog"
2         PIN_FLD_FIRST_NAME      STR [0] "Dhub"
nap> xop PCM_OP_STEP_NEXT 0 1
xop: opcode 18, flags 0
# number of field entries allocated 6, used 6
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
0 PIN_FLD_RESULTS       ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 25469857 53148
1     PIN_FLD_CREATED_T    TSTAMP [0] (1139417895) 02/08/06 10:58:15
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Amed"
2         PIN_FLD_FIRST_NAME      STR [0] "Ronaldo"
0 PIN_FLD_RESULTS       ARRAY [1] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 19702828 1543
1     PIN_FLD_CREATED_T    TSTAMP [0] (1054135772) 05/28/03 10:29:32
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Prestoni"
2         PIN_FLD_FIRST_NAME      STR [0] "Markus"
0 PIN_FLD_RESULTS       ARRAY [2] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 11102409 3401
1     PIN_FLD_CREATED_T    TSTAMP [0] (996669081) 08/01/01 07:31:21
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Kulkar"
2         PIN_FLD_FIRST_NAME      STR [0] "Rahu"
0 PIN_FLD_RESULTS       ARRAY [3] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 35624677 146
1     PIN_FLD_CREATED_T    TSTAMP [0] (1265060079) 02/01/10 15:34:39
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Johnson"
2         PIN_FLD_FIRST_NAME      STR [0] "Bryan"
0 PIN_FLD_RESULTS       ARRAY [4] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 29737931 520
1     PIN_FLD_CREATED_T    TSTAMP [0] (1199807442) 01/08/08 09:50:42
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Degad"
2         PIN_FLD_FIRST_NAME      STR [0] "Joaq"
nap> xop PCM_OP_STEP_NEXT 0 1
xop: opcode 18, flags 0
# number of field entries allocated 6, used 6
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
0 PIN_FLD_RESULTS       ARRAY [0] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 30425794 264
1     PIN_FLD_CREATED_T    TSTAMP [0] (1207179142) 04/02/08 18:32:22
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Lena"
2         PIN_FLD_FIRST_NAME      STR [0] "Mich"
0 PIN_FLD_RESULTS       ARRAY [1] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 17981207 1255
1     PIN_FLD_CREATED_T    TSTAMP [0] (1034890106) 10/17/02 16:28:26
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Payable"
2         PIN_FLD_FIRST_NAME      STR [0] "National Accounts"
0 PIN_FLD_RESULTS       ARRAY [2] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 33730335 4148
1     PIN_FLD_CREATED_T    TSTAMP [0] (1244205808) 06/05/09 07:43:28
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Weav"
2         PIN_FLD_FIRST_NAME      STR [0] "Garr"
0 PIN_FLD_RESULTS       ARRAY [3] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 13422861 68934
1     PIN_FLD_CREATED_T    TSTAMP [0] (1008632620) 12/17/01 17:43:40
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Payable"
2         PIN_FLD_FIRST_NAME      STR [0] "In care of Arba - Accounts"
0 PIN_FLD_RESULTS       ARRAY [4] allocated 3, used 3
1     PIN_FLD_POID           POID [0] 0.0.0.1 /account 16507073 3046
1     PIN_FLD_CREATED_T    TSTAMP [0] (1025313455) 06/28/02 20:17:35
1     PIN_FLD_NAMEINFO      ARRAY [1] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] "Bain"
2         PIN_FLD_FIRST_NAME      STR [0] "Satn"
nap> xop PCM_OP_STEP_END 0 1
xop: opcode 19, flags 0
# number of field entries allocated 6, used 6
0 PIN_FLD_POID           POID [0] 0.0.0.1 /search -1 0
0 PIN_FLD_RESULTS       ARRAY [5] allocated 3, used 3
1     PIN_FLD_POID           POID [0] NULL poid pointer
1     PIN_FLD_CREATED_T    TSTAMP [0] (0)
1     PIN_FLD_NAMEINFO      ARRAY [*] allocated 2, used 2
2         PIN_FLD_LAST_NAME       STR [0] NULL str ptr
2         PIN_FLD_FIRST_NAME      STR [0] NULL str ptr
0 PIN_FLD_ARGS          ARRAY [1] allocated 1, used 1
1     PIN_FLD_NAMEINFO      ARRAY [*] allocated 1, used 1
2         PIN_FLD_FIRST_NAME      STR [0] "%a%"
0 PIN_FLD_TEMPLATE        STR [0] "select X from /account where F1 like V1 "
0 PIN_FLD_FLAGS           INT [0] 0
0 PIN_FLD_OP_CORRELATION_ID    STR [0] "1:AANDERSON::7428:6596:19:1269464323:4"

No Comments »