Querys
Querys
7.4
Database
Performance and Query Optimization
IBM
Note
Before using this information and the product it supports, read the information in “Notices” on page
1313.
This document may contain references to Licensed Internal Code. Licensed Internal Code is Machine Code and is
licensed to you under the terms of the IBM License Agreement for Machine Code.
© Copyright International Business Machines Corporation 1998, 2019.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM Corp.
Contents
iii
Array unnest temporary table scan.......................................................................................... 58
Temporary Indexed List..................................................................................................................58
Temporary Indexed List scan and Index Merge....................................................................... 59
Window............................................................................................................................................61
Window scan............................................................................................................................. 62
Objects processed in parallel...............................................................................................................62
Spreading data automatically.............................................................................................................. 63
Processing queries: Overview................................................................................................................... 63
Query optimizer.................................................................................................................................... 64
Query optimization tips........................................................................................................................ 64
Access plan validation..........................................................................................................................65
Single table optimization......................................................................................................................65
Solid State Drives................................................................................................................................. 66
Memory preference controls................................................................................................................67
Join optimization.................................................................................................................................. 68
Nested loop join.............................................................................................................................. 68
Join optimization............................................................................................................................ 70
Join order optimization...................................................................................................................71
Full outer join.................................................................................................................................. 72
Join cost & index selection............................................................................................................. 73
Transitive closure predicates......................................................................................................... 74
LPG.................................................................................................................................................. 74
CQE Join performance tips............................................................................................................. 75
Multiple join types...........................................................................................................................75
Join performance problems........................................................................................................... 76
Join performance tips.....................................................................................................................77
Distinct optimization............................................................................................................................ 78
Grouping optimization..........................................................................................................................79
Hash grouping................................................................................................................................. 79
Index grouping................................................................................................................................ 80
Whole table COUNT(*) grouping.....................................................................................................82
Eliminate grouping columns........................................................................................................... 83
Add grouping columns.................................................................................................................... 83
Index skip key processing.............................................................................................................. 83
Read trigger considerations............................................................................................................85
Grouping set optimization.............................................................................................................. 85
Ordering optimization...........................................................................................................................86
View implementation........................................................................................................................... 87
View composite...............................................................................................................................88
View materialization....................................................................................................................... 88
MQT optimization................................................................................................................................. 89
MQT supported function................................................................................................................. 90
Using MQTs......................................................................................................................................91
MQT examples................................................................................................................................ 92
MQT matching................................................................................................................................. 94
Determining MQT usage................................................................................................................. 97
MQT recommendations.................................................................................................................. 98
Recursive query optimization.............................................................................................................. 98
Example.......................................................................................................................................... 99
Multiple initialization & iterative fullselects.................................................................................101
Predicate pushing......................................................................................................................... 103
SEARCH considerations................................................................................................................103
CYCLE considerations...................................................................................................................104
SMP & recursive queries...............................................................................................................105
System-period temporal tables......................................................................................................... 108
Adaptive Query Processing................................................................................................................ 109
How AQP works............................................................................................................................ 110
AQP example................................................................................................................................ 110
iv
AQP join order...............................................................................................................................111
Database Monitor additions......................................................................................................... 112
Row and column access control........................................................................................................ 114
Indexing strategy and RCAC.........................................................................................................114
Materialized query tables and RCAC............................................................................................ 117
Tools.........................................................................................................................................................121
Health Center..................................................................................................................................... 121
Navigator view.............................................................................................................................. 121
SQL procedures............................................................................................................................ 121
Health_Database_Overview....................................................................................................121
Health_Activity........................................................................................................................126
Health_Design_Limits.............................................................................................................131
Health_Size_Limits..................................................................................................................134
Health_Environmental_Limits................................................................................................ 138
Reset_Environmental_Limits................................................................................................. 142
Database Monitor............................................................................................................................... 143
Start...............................................................................................................................................144
End................................................................................................................................................ 147
Performance rows.........................................................................................................................149
Examples...................................................................................................................................... 149
Application with table scans...................................................................................................149
Queries with table scans.........................................................................................................150
Table scan detail..................................................................................................................... 151
Additional examples............................................................................................................... 152
Navigator monitors.............................................................................................................................154
Start...............................................................................................................................................154
Analyze data................................................................................................................................. 156
Compare data............................................................................................................................... 157
View statements........................................................................................................................... 158
Import........................................................................................................................................... 158
Index advisor......................................................................................................................................158
Index advice and OR predicates.................................................................................................. 159
Index advice for Encoded Vector Index RRN Probe Plans.......................................................... 161
Display information.......................................................................................................................161
System table............................................................................................................................162
Column descriptions.....................................................................................................................164
Database monitor view.................................................................................................................165
Condense advice...........................................................................................................................166
Visual Explain..................................................................................................................................... 166
Start...............................................................................................................................................166
Information available................................................................................................................... 167
Adaptive Query Processing in VE................................................................................................. 169
SQL Plan Cache.................................................................................................................................. 170
Show Statements..........................................................................................................................171
Column descriptions.....................................................................................................................174
Properties..................................................................................................................................... 175
Creating snapshots....................................................................................................................... 182
Event monitor............................................................................................................................... 184
SQL stored procedures................................................................................................................. 184
Clear SQL plan cache procedure.................................................................................................. 184
Verify performance.............................................................................................................................185
View debug messages........................................................................................................................185
Print SQL Information........................................................................................................................ 186
Tool comparison................................................................................................................................. 187
SQL Error Logging Facility (SELF).......................................................................................................187
Change query attributes.................................................................................................................... 192
QAQQINI....................................................................................................................................... 192
CHGQRYA................................................................................................................................ 194
v
Creating the QAQQINI query options file............................................................................... 194
QAQQINI override support..................................................................................................... 194
File format............................................................................................................................... 195
Update..................................................................................................................................... 195
Authority requirements...........................................................................................................195
System-supplied triggers........................................................................................................196
Query options.......................................................................................................................... 196
SQL_XML_DATA_CCSID option.............................................................................................. 210
Query Supervisor................................................................................................................................211
Using Query Supervisor to monitor query resource usage..........................................................212
Query Supervisor configuration and operation............................................................................212
Managing Query Supervisor activity.............................................................................................213
Using DETECTION_FREQUENCY to protect system resources................................................... 214
Writing a Query Supervisor Exit Program.....................................................................................215
Query Supervisor example exit programs....................................................................................216
Exit program to send message to QSYSOPR.......................................................................... 216
Exit program to end query...................................................................................................... 220
Exit program to dump plan cache information for query....................................................... 223
Exit program to log information using a data queue.............................................................. 226
Predictive Query Governor.................................................................................................................242
How to use.................................................................................................................................... 243
Cancel a query.............................................................................................................................. 244
Control the reply........................................................................................................................... 244
Test performance..........................................................................................................................245
Time limit examples..................................................................................................................... 245
Test temporary storage use..........................................................................................................246
Storage limit examples................................................................................................................. 246
Parallel processing............................................................................................................................. 247
System-wide................................................................................................................................. 247
Job level........................................................................................................................................ 248
Statistics manager..............................................................................................................................249
Automatic collection.....................................................................................................................250
Automatic refresh......................................................................................................................... 251
View requests............................................................................................................................... 251
Indexes and column statistics..................................................................................................... 251
Background collection.................................................................................................................. 253
View column statistics..................................................................................................................253
Manual collection and refresh ..................................................................................................... 253
APIs...............................................................................................................................................255
Display MQT columns.........................................................................................................................255
Check pending constraints................................................................................................................ 257
Limiting temporary storage and CPU used by queries...................................................................... 258
Creating an index strategy.......................................................................................................................259
Binary radix indexes...........................................................................................................................259
Derived key index......................................................................................................................... 259
Sparse indexes..............................................................................................................................259
Optimization............................................................................................................................ 260
Matching algorithm................................................................................................................. 261
Sparse index examples........................................................................................................... 263
Specify PAGESIZE.........................................................................................................................265
Index maintenance.......................................................................................................................266
Encoded vector indexes..................................................................................................................... 266
How the EVI works....................................................................................................................... 267
When to create..............................................................................................................................268
Maintenance................................................................................................................................. 270
Recommendations........................................................................................................................272
Compare radix & EVIs........................................................................................................................ 275
Indexes & the optimizer.....................................................................................................................275
vi
Index not used.............................................................................................................................. 275
Display indexes for a table........................................................................................................... 276
Determine unnecessary indexes.................................................................................................. 280
Reset usage counts.......................................................................................................................280
View index builds..........................................................................................................................281
Manage index rebuilds..................................................................................................................281
Indexing strategy............................................................................................................................... 286
Reactive approach........................................................................................................................ 287
Proactive approach.......................................................................................................................287
Coding for effective indexes...............................................................................................................288
Avoid numeric conversions.......................................................................................................... 288
Avoid arithmetic expressions....................................................................................................... 288
Avoid character string padding.................................................................................................... 289
LIKE considerations......................................................................................................................289
Derived indexes............................................................................................................................ 290
Sparse indexes..............................................................................................................................291
Indexes with sort sequence...............................................................................................................291
Selection, joins, or grouping......................................................................................................... 291
Ordering........................................................................................................................................ 292
Index examples..................................................................................................................................292
Equal selection, no sort sequence............................................................................................... 292
Equal selection, unique-weight sort sequence........................................................................... 292
Equal selection, shared-weight sort sequence........................................................................... 293
Greater than selection, unique-weight sort sequence................................................................ 293
Join selection, unique-weight sort sequence..............................................................................293
Join selection, shared-weight sort sequence..............................................................................293
Order, no sort sequence............................................................................................................... 294
Order, unique-weight sort sequence........................................................................................... 294
Order, shared-weight sort sequence............................................................................................294
Order, ALWCPYDTA(*OPTIMIZE), unique-weight sort sequence................................................295
Group, no sort sequence.............................................................................................................. 295
Group, unique-weight sort sequence...........................................................................................295
Group, shared-weight sort sequence...........................................................................................295
Order & group on same columns, unique-weight sort sequence................................................296
Order & group on same columns, ALWCPYDTA(*OPTIMIZE), unique-weight sort sequence....296
Order & group on same columns, shared-weight sort sequence................................................297
Order & group on same columns, ALWCPYDTA(*OPTIMIZE), shared-weight sort sequence.... 297
Order & group on different columns, unique-weight sort sequence.......................................... 297
Order & group on different columns, ALWCPYDTA(*OPTIMIZE), unique-weight sort
sequence................................................................................................................................. 298
Order & group on different columns, ALWCPYDTA(*OPTIMIZE), shared-weight sort
sequence................................................................................................................................. 298
Sparse index examples.................................................................................................................298
Application design tips............................................................................................................................ 301
Live data............................................................................................................................................. 301
Reduce open operations.................................................................................................................... 302
Retain cursor positions...................................................................................................................... 305
Non-ILE program calls..................................................................................................................305
ILE program calls..........................................................................................................................305
General rules.................................................................................................................................306
Programming techniques........................................................................................................................ 307
Use the OPTIMIZE clause.................................................................................................................. 307
Use FETCH FOR n ROWS....................................................................................................................308
Improve SQL blocking performance............................................................................................ 309
Use INSERT n ROWS.......................................................................................................................... 309
Control database manager blocking..................................................................................................310
Optimize columns selected............................................................................................................... 311
PREPARE considerations................................................................................................................... 311
vii
REFRESH(*FORWARD) considerations..............................................................................................311
Improve concurrency......................................................................................................................... 312
Use SELECTIVITY to supply missing information............................................................................. 313
Performance considerations................................................................................................................... 315
Long object names............................................................................................................................. 315
Precompile options............................................................................................................................ 315
ALWCPYDTA....................................................................................................................................... 316
VARCHAR and VARGRAPHIC............................................................................................................. 317
Field procedures................................................................................................................................ 319
Examples...................................................................................................................................... 320
Db2 for i Services.....................................................................................................................................321
Application Services...........................................................................................................................322
DELIMIT_NAME scalar function................................................................................................... 322
OVERRIDE_QAQQINI procedure..................................................................................................322
OVERRIDE_TABLE procedure.......................................................................................................323
PARSE_STATEMENT table function..............................................................................................324
SELFCODES global variable.......................................................................................................... 331
SQL_ERROR_LOG view.................................................................................................................331
SQLCODE_INFO table function.................................................................................................... 333
VALIDATE_SELF scalar function...................................................................................................334
WLM_SET_CLIENT_INFO procedure............................................................................................ 335
Performance Services........................................................................................................................ 337
ACT_ON_INDEX_ADVICE procedure........................................................................................... 337
ACTIVE_QUERY_INFO table function.......................................................................................... 338
ADD_QUERY_THRESHOLD procedure.......................................................................................... 341
DATABASE_MONITOR_INFO view............................................................................................... 344
HARVEST_INDEX_ADVICE procedure......................................................................................... 347
MTI_INFO table function..............................................................................................................349
QUERY_SUPERVISOR view...........................................................................................................351
REMOVE_INDEXES procedure..................................................................................................... 352
REMOVE_QUERY_THRESHOLD procedure...................................................................................353
RESET_TABLE_INDEX_STATISTICS procedure........................................................................... 353
Plan Cache Services........................................................................................................................... 355
CHANGE_PLAN_CACHE_SIZE procedure.................................................................................... 355
CLEAR_PLAN_CACHE procedure ................................................................................................ 356
DUMP_PLAN_CACHE procedure...................................................................................................357
DUMP_PLAN_CACHE_PROPERTIES procedure...........................................................................359
DUMP_PLAN_CACHE_TOPN procedure....................................................................................... 360
DUMP_SNAP_SHOT_PROPERTIES procedure..............................................................................361
END_ALL_PLAN_CACHE_EVENT_MONITORS procedure........................................................... 361
END_PLAN_CACHE_EVENT_MONITOR procedure......................................................................362
IMPORT_PC_EVENT_MONITOR procedure................................................................................. 362
IMPORT_PC_SNAPSHOT procedure............................................................................................ 363
REMOVE_PC_EVENT_MONITOR procedure................................................................................ 363
REMOVE_PC_SNAPSHOT procedure........................................................................................... 364
REMOVE_PERFORMANCE_MONITOR procedure........................................................................364
START_PLAN_CACHE_EVENT_MONITOR procedure.................................................................. 364
Utility Services....................................................................................................................................365
ANALYZE_CATALOG table function.............................................................................................. 365
CANCEL_SQL procedure...............................................................................................................367
CHECK_SYSCST procedure.......................................................................................................... 368
CHECK_SYSROUTINE procedure................................................................................................. 369
COMPARE_FILE table function.....................................................................................................371
DUMP_SQL_CURSORS procedure................................................................................................ 373
END_IDLE_SQE_THREADS procedure ........................................................................................ 374
EXTRACT_STATEMENTS procedure............................................................................................. 375
FIND_AND_CANCEL_QSQSRVR_SQL procedure......................................................................... 376
FIND_QSQSRVR_JOBS procedure............................................................................................... 377
viii
GENERATE_SQL procedure.......................................................................................................... 378
GENERATE_SQL_OBJECTS procedure.........................................................................................387
RELATED_OBJECTS table function...............................................................................................398
RESTART_IDENTITY procedure................................................................................................... 401
SWAP_DYNUSRPRF procedure.................................................................................................... 401
SYSFILES view.............................................................................................................................. 402
SYSMEMBERSTAT view.................................................................................................................413
VALIDATE_DATA, VALIDATE_DATA_FILE, and VALIDATE_DATA_LIBRARY table functions......416
IBM i Services.......................................................................................................................................... 417
Application Services...........................................................................................................................418
ACTIVATION_GROUP_INFO table function..................................................................................418
ADD_USER_INDEX_ENTRY and ADD_USER_INDEX_ENTRY_BINARY procedures................... 420
BINDING_DIRECTORY_INFO view.............................................................................................. 421
BOUND_MODULE_INFO view.......................................................................................................422
BOUND_SRVPGM_INFO view.......................................................................................................431
CHANGE_USER_SPACE and CHANGE_USER_SPACE_BINARY procedures............................... 432
CHANGE_USER_SPACE_ATTRIBUTES procedure.......................................................................433
CLEAR_DATA_QUEUE procedure................................................................................................. 434
COMMAND_INFO view................................................................................................................. 436
CREATE_USER_INDEX procedure................................................................................................443
CREATE_USER_SPACE procedure................................................................................................446
DATA_AREA_INFO table function................................................................................................ 449
DATA_AREA_INFO view............................................................................................................... 450
DATA_QUEUE_ENTRIES table function....................................................................................... 452
DATA_QUEUE_INFO view............................................................................................................. 454
DB_TRANSACTION_INFO view.................................................................................................... 457
DB_TRANSACTION_JOURNAL_INFO table function...................................................................475
DB_TRANSACTION_OBJECT_INFO table function...................................................................... 477
DB_TRANSACTION_RECORD_INFO table function.....................................................................478
ENVIRONMENT_VARIABLE_INFO view....................................................................................... 480
ERRNO_INFO scalar function.......................................................................................................481
EXIT_POINT_INFO view............................................................................................................... 482
EXIT_PROGRAM_INFO view........................................................................................................ 484
GENERATE_SPREADSHEET scalar function................................................................................ 485
GETENV scalar function................................................................................................................487
LPRINTF procedure...................................................................................................................... 488
PROGRAM_EXPORT_IMPORT_INFO view................................................................................... 488
PROGRAM_INFO view.................................................................................................................. 490
PUTENV scalar function................................................................................................................504
QCMDEXC procedure....................................................................................................................505
QCMDEXC scalar function............................................................................................................ 505
RECEIVE_DATA_QUEUE table function........................................................................................505
REMOVE_USER_INDEX_ENTRY and REMOVE_USER_INDEX_ENTRY_BINARY table
functions.................................................................................................................................. 508
SEND_DATA_QUEUE, SEND_DATA_QUEUE_BINARY, and SEND_DATA_QUEUE_UTF8
procedures...............................................................................................................................510
SEND_EMAIL scalar function....................................................................................................... 511
SERVICES_INFO table.................................................................................................................. 512
SET_PASE_SHELL_INFO procedure.............................................................................................515
SPLIT table function..................................................................................................................... 516
STACK_INFO table function......................................................................................................... 517
USER_INDEX_ENTRIES table function........................................................................................522
USER_INDEX_INFO view............................................................................................................. 523
USER_SPACE table function......................................................................................................... 524
USER_SPACE_INFO view............................................................................................................. 525
WATCH_DETAIL table function.................................................................................................... 526
WATCH_INFO view....................................................................................................................... 531
Backup and Recovery Services.......................................................................................................... 533
ix
Backup, Recovery, and Media Services (BRMS) Services............................................................533
MEDIA_LIBRARY_INFO view....................................................................................................... 533
SAVE_FILE_INFO view................................................................................................................. 536
SAVE_FILE_OBJECTS table function........................................................................................... 538
SAVE_FILE_OBJECTS view...........................................................................................................541
TAPE_CARTRIDGE_INFO view..................................................................................................... 542
Communication Services................................................................................................................... 544
ACTIVE_DB_CONNECTIONS table function.................................................................................544
ADD_TIME_SERVER procedure.................................................................................................... 547
CHANGE_OBJECTCONNECT procedure.......................................................................................548
DNS_LOOKUP table function........................................................................................................551
DNS_LOOKUP_IP scalar function................................................................................................. 552
ENV_SYS_INFO view.....................................................................................................................552
HTTP_SERVER_INFO view............................................................................................................553
NETSTAT_INFO view.....................................................................................................................554
NETSTAT_INTERFACE_INFO view............................................................................................... 561
NETSTAT_JOB_INFO view............................................................................................................ 568
NETSTAT_ROUTE_INFO view....................................................................................................... 570
NETWORK_ATTRIBUTE_INFO view............................................................................................ 577
OBJECTCONNECT_INFO view......................................................................................................584
PING table function...................................................................................................................... 585
RDB_ENTRY_INFO view............................................................................................................... 588
REMOVE_TIME_SERVER procedure.............................................................................................591
SERVER_SBS_CONFIGURATION view......................................................................................... 591
SERVER_SBS_ROUTING view...................................................................................................... 592
SET_SERVER_SBS_ROUTING procedure.....................................................................................595
TCPIP_INFO view..........................................................................................................................601
TIME_PROTOCOL_INFO view...................................................................................................... 602
Configuration Services....................................................................................................................... 602
HARDWARE_RESOURCE_INFO table function............................................................................602
HARDWARE_RESOURCE_INFO view........................................................................................... 609
IFS Services........................................................................................................................................615
COMPARE_IFS table function...................................................................................................... 615
IFS_JOB_INFO table function...................................................................................................... 617
IFS_OBJECT_LOCK_INFO table function.....................................................................................621
IFS_OBJECT_PRIVILEGES table function....................................................................................624
IFS_OBJECT_REFERENCES_INFO table function....................................................................... 626
IFS_OBJECT_STATISTICS table function..................................................................................... 629
IFS_READ, IFS_READ_BINARY, and IFS_READ_UTF8 table functions...................................... 641
IFS_RENAME scalar function....................................................................................................... 643
IFS_UNLINK scalar function.........................................................................................................644
IFS_WRITE, IFS_WRITE_BINARY, and IFS_WRITE_UTF8 procedures...................................... 645
SERVER_SHARE_INFO view.........................................................................................................647
Java Services......................................................................................................................................650
JVM_INFO table function............................................................................................................. 650
JVM_INFO view............................................................................................................................ 652
SET_JVM procedure......................................................................................................................653
Journal Services................................................................................................................................. 654
ASSOCIATE_JOURNAL_RECEIVER table function...................................................................... 654
AUDIT_JOURNAL_DATA_MART_INFO view................................................................................ 657
Audit journal entry services..........................................................................................................658
AUDIT JOURNAL table function common information.......................................................... 658
AUDIT_JOURNAL_AD table function......................................................................................662
AUDIT_JOURNAL_AF table function...................................................................................... 671
AUDIT_JOURNAL_AP table function...................................................................................... 674
AUDIT_JOURNAL_AU table function......................................................................................675
AUDIT_JOURNAL_AX table function...................................................................................... 676
AUDIT_JOURNAL_CA table function...................................................................................... 678
x
AUDIT_JOURNAL_CD table function...................................................................................... 683
AUDIT_JOURNAL_CO table function...................................................................................... 684
AUDIT_JOURNAL_CP table function...................................................................................... 685
AUDIT_JOURNAL_DO table function......................................................................................696
AUDIT_JOURNAL_DS table function...................................................................................... 697
AUDIT_JOURNAL_EV table function...................................................................................... 711
AUDIT_JOURNAL_GR table function...................................................................................... 712
AUDIT_JOURNAL_IM table function...................................................................................... 715
AUDIT_JOURNAL_JS table function.......................................................................................718
AUDIT_JOURNAL_LD table function...................................................................................... 722
AUDIT_JOURNAL_M0 table function..................................................................................... 723
AUDIT_JOURNAL_M6 table function..................................................................................... 725
AUDIT_JOURNAL_M7 table function..................................................................................... 731
AUDIT_JOURNAL_M8 table function..................................................................................... 733
AUDIT_JOURNAL_M9 table function..................................................................................... 738
AUDIT_JOURNAL_NA table function......................................................................................739
AUDIT_JOURNAL_OM table function..................................................................................... 740
AUDIT_JOURNAL_OR table function...................................................................................... 742
AUDIT_JOURNAL_OW table function..................................................................................... 745
AUDIT_JOURNAL_PA table function...................................................................................... 746
AUDIT_JOURNAL_PF table function...................................................................................... 748
AUDIT_JOURNAL_PG table function......................................................................................753
AUDIT_JOURNAL_PS table function...................................................................................... 757
AUDIT_JOURNAL_PU table function...................................................................................... 759
AUDIT_JOURNAL_PW table function..................................................................................... 760
AUDIT_JOURNAL_RA table function...................................................................................... 762
AUDIT_JOURNAL_RO table function......................................................................................764
AUDIT_JOURNAL_RZ table function...................................................................................... 765
AUDIT_JOURNAL_SK table function...................................................................................... 766
AUDIT_JOURNAL_SM table function......................................................................................768
AUDIT_JOURNAL_ST table function.......................................................................................775
AUDIT_JOURNAL_SV table function...................................................................................... 779
AUDIT_JOURNAL_ZC table function...................................................................................... 780
AUDIT_JOURNAL_ZR table function...................................................................................... 782
DISPLAY_JOURNAL table function...............................................................................................784
JOURNAL_INFO view................................................................................................................... 798
JOURNAL_RECEIVER_INFO view................................................................................................ 806
JOURNALED_OBJECTS view........................................................................................................ 815
MANAGE_AUDIT_JOURNAL_DATA_MART procedure................................................................ 817
REMOTE_JOURNAL_INFO view................................................................................................... 819
SMAPP_ACCESS_PATHS view...................................................................................................... 825
Librarian Services...............................................................................................................................826
JOURNAL_INHERIT_RULES view................................................................................................ 826
LIBRARY_INFO table function......................................................................................................830
LIBRARY_LIST_INFO view............................................................................................................833
OBJECT_STATISTICS table function............................................................................................ 834
SYSTEM_OBJECT_TYPES table.................................................................................................... 841
Message Handling Services............................................................................................................... 842
HISTORY_LOG_INFO table function............................................................................................ 842
JOBLOG_INFO table function...................................................................................................... 847
MESSAGE_FILE_DATA view......................................................................................................... 849
MESSAGE_QUEUE_INFO table function...................................................................................... 852
MESSAGE_QUEUE_INFO view..................................................................................................... 855
REPLY_INQUIRY_MESSAGES scalar function..............................................................................856
REPLY_LIST_INFO view................................................................................................................857
SEND_MESSAGE procedure ........................................................................................................ 858
Performance Services........................................................................................................................ 859
COLLECTION_SERVICES_INFO view........................................................................................... 859
xi
PowerHA Services.............................................................................................................................. 862
Product Services................................................................................................................................ 862
CHECK_PRODUCT_OPTIONS table function............................................................................... 863
LICENSE_EXPIRATION_CHECK procedure................................................................................. 864
LICENSE_INFO view.....................................................................................................................865
SOFTWARE_PRODUCT_INFO view.............................................................................................. 867
PTF Services....................................................................................................................................... 872
DEFECTIVE_PTF_CURRENCY view...............................................................................................872
ELECTRONIC_SERVICE_AGENT_INFO view................................................................................873
FIRMWARE_CURRENCY view.......................................................................................................874
GROUP_PTF_CURRENCY view...................................................................................................... 877
GROUP_PTF_DETAILS view.......................................................................................................... 878
GROUP_PTF_INFO view................................................................................................................882
PTF_COVER_LETTER table function.............................................................................................883
PTF_INFO view............................................................................................................................. 884
Security Services................................................................................................................................887
AUTHORITY_COLLECTION views................................................................................................. 888
AUTHORIZATION_LIST_INFO view............................................................................................. 888
AUTHORIZATION_LIST_USER_INFO view.................................................................................. 890
CERTIFICATE_INFO table function..............................................................................................892
CHANGE_USER_PROFILE table function.....................................................................................895
DRDA_AUTHENTICATION_ENTRY_INFO view............................................................................898
FUNCTION_INFO view................................................................................................................. 899
FUNCTION_USAGE view.............................................................................................................. 901
GROUP_PROFILE_ENTRIES view.................................................................................................901
OBJECT_OWNERSHIP view.......................................................................................................... 901
OBJECT_PRIVILEGES table function........................................................................................... 904
OBJECT_PRIVILEGES view.......................................................................................................... 907
SECURITY_INFO view.................................................................................................................. 910
SET_COLUMN_ATTRIBUTE procedure.........................................................................................913
SPECIAL_AUTHORITY_DATA_MART table.................................................................................. 914
SQL_CHECK_AUTHORITY scalar function................................................................................... 915
SQL_CHECK_FUNCTION_USAGE scalar function....................................................................... 916
SQL_CHECK_SPECIAL_AUTHORITY scalar function.................................................................. 916
USER_INFO view.......................................................................................................................... 917
USER_INFO_BASIC view..............................................................................................................926
Spool Services.................................................................................................................................... 934
DELETE_OLD_SPOOLED_FILES procedure.................................................................................. 934
GENERATE_PDF scalar function.................................................................................................. 936
OUTPUT_QUEUE_ENTRIES table function.................................................................................. 937
OUTPUT_QUEUE_ENTRIES view..................................................................................................941
OUTPUT_QUEUE_ENTRIES_BASIC view..................................................................................... 946
OUTPUT_QUEUE_INFO view........................................................................................................ 948
PRINTER_FILE_INFO view...........................................................................................................954
SPOOLED_FILE_DATA table function...........................................................................................956
SPOOLED_FILE_INFO table function...........................................................................................957
Storage Services.................................................................................................................................961
ADD_DEVICE_LOCKING_POLICY procedure...............................................................................962
ASP_INFO view............................................................................................................................. 962
ASP_JOB_INFO view.....................................................................................................................971
ASP_VARY_INFO view...................................................................................................................972
CHANGE_DEVICE_LOCKING_POLICY procedure....................................................................... 974
CHANGE_DISK_PATHS procedure...............................................................................................974
CREATE_LOCKING_POLICY procedure....................................................................................... 977
DELETE_LOCKING_POLICY procedure........................................................................................977
FACTORY_RESET_DEVICE procedure.......................................................................................... 978
LOCKING_POLICY_INFO view..................................................................................................... 978
NVME_INFO view......................................................................................................................... 979
xii
REMOVE_DEVICE_LOCKING_POLICY procedure....................................................................... 983
SYSDISKSTAT table function........................................................................................................ 983
SYSDISKSTAT view....................................................................................................................... 988
SYSTMPSTG view.......................................................................................................................... 995
UNLOCK_DEVICE procedure........................................................................................................ 996
USER_STORAGE view................................................................................................................... 997
System Health Services..................................................................................................................... 997
System limit alerts......................................................................................................................1000
SYSLIMTBL table........................................................................................................................ 1001
SYSLIMITS view..........................................................................................................................1003
SYSLIMITS_BASIC view............................................................................................................. 1006
PROCESS_SYSTEM_LIMITS_ALERTS procedure.......................................................................1007
QIBM_SYSTEM_LIMITS global variables...................................................................................1008
Work Management Services............................................................................................................ 1009
ACTIVE_JOB_INFO table function.............................................................................................1009
ADD_TRACKED_JOB_QUEUE procedure.................................................................................... 1026
Submitted Job Tracker..........................................................................................................1027
AUTOSTART_JOB_INFO view.....................................................................................................1029
CLEAR_TRACKED_JOB_INFO procedure...................................................................................1030
COMMUNICATIONS_ENTRY_INFO view....................................................................................1032
ENDED_JOB_INFO table function..............................................................................................1034
GET_JOB_INFO table function...................................................................................................1037
JOB_DESCRIPTION_INFO view.................................................................................................1039
JOB_INFO table function........................................................................................................... 1046
JOB_LOCK_INFO table function................................................................................................ 1058
JOB_QUEUE_ENTRIES view.......................................................................................................1061
JOB_QUEUE_INFO view............................................................................................................. 1071
MEMORY_POOL table function.................................................................................................. 1075
MEMORY_POOL_INFO view.......................................................................................................1077
OBJECT_LOCK_INFO view......................................................................................................... 1079
OPEN_FILES table function....................................................................................................... 1081
PRESTART_JOB_INFO view........................................................................................................1083
PRESTART_JOB_STATISTICS table function............................................................................. 1086
RECORD_LOCK_INFO view........................................................................................................ 1089
REMOVE_TRACKED_JOB_QUEUE procedure............................................................................ 1090
ROUTING_ENTRY_INFO view.................................................................................................... 1091
SCHEDULED_JOB_INFO view.................................................................................................... 1093
SUBSYSTEM_INFO view.............................................................................................................1096
SUBSYSTEM_POOL_INFO view................................................................................................. 1098
SYSTEM_ACTIVITY_INFO table function.................................................................................. 1099
SYSTEM_STATUS table function................................................................................................ 1100
SYSTEM_STATUS_INFO view..................................................................................................... 1110
SYSTEM_STATUS_INFO_BASIC view.........................................................................................1118
SYSTEM_VALUE_INFO view....................................................................................................... 1125
TRACKED_JOB_INFO table function..........................................................................................1126
TRACKED_JOB_QUEUES view.................................................................................................... 1135
WORKLOAD_GROUP_INFO view................................................................................................ 1136
WORKSTATION_INFO view........................................................................................................1137
SYSTOOLS.............................................................................................................................................. 1138
Using SYSTOOLS.............................................................................................................................. 1138
SYSTOOLS Services..........................................................................................................................1140
HTTP function overview...................................................................................................................1141
BASE64DECODE scalar function................................................................................................1146
BASE64ENCODE scalar function................................................................................................1147
HTTPBLOB and HTTPCLOB scalar functions............................................................................. 1147
HTTPBLOBVERBOSE and HTTPCLOBVERBOSE table functions...............................................1148
HTTPDELETEBLOB and HTTPDELETECLOB scalar functions................................................... 1149
HTTPDELETEBLOBVERBOSE and HTTPDELETECLOBVERBOSE table functions..................... 1150
xiii
HTTPGETBLOB and HTTPGETCLOB scalar functions................................................................1150
HTTPGETBLOBVERBOSE and HTTPGETCLOBVERBOSE table functions................................. 1151
HTTPHEAD scalar function........................................................................................................ 1152
HTTPPOSTBLOB and HTTPPOSTCLOB scalar functions........................................................... 1152
HTTPPOSTBLOBVERBOSE and HTTPPOSTCLOBVERBOSE table functions.............................1153
HTTPPUTBLOB and HTTPPUTCLOB scalar functions............................................................... 1153
HTTPPUTBLOBVERBOSE and HTTPPUTCLOBVERBOSE table functions................................. 1154
URLDECODE scalar function...................................................................................................... 1155
URLENCODE scalar function...................................................................................................... 1155
Database monitor formats.................................................................................................................... 1155
SQL table.......................................................................................................................................... 1155
SQL view........................................................................................................................................... 1161
1000 - SQL Information............................................................................................................. 1161
3000 - Table Scan.......................................................................................................................1181
3001 - Index Used......................................................................................................................1185
3002 - Index Created................................................................................................................. 1191
3003 - Query Sort.......................................................................................................................1197
3004 - Temp Table..................................................................................................................... 1201
3005 - Table Locked...................................................................................................................1207
3006 - Access Plan Rebuilt........................................................................................................ 1209
3007 - Optimizer Timed Out...................................................................................................... 1213
3008 - Subquery Processing......................................................................................................1218
3010 - Host Variable, ODP Implementation..............................................................................1219
3011 - Array Host Variables.......................................................................................................1220
3012 - Global Variables..............................................................................................................1222
3014 - Generic QQ Information................................................................................................. 1223
3015 - Statistics Information.....................................................................................................1233
3018 - STRDBMON/ENDDBMON............................................................................................... 1235
3019 - Rows retrieved................................................................................................................1238
3020 - Index advised (SQE)....................................................................................................... 1240
3021 - Bitmap Created...............................................................................................................1243
3022 - Bitmap Merge................................................................................................................. 1245
3023 - Temp Hash Table Created.............................................................................................. 1248
3025 - Distinct Processing......................................................................................................... 1251
3026 - Set operation.................................................................................................................. 1253
3027 - Subquery Merge............................................................................................................. 1255
3028 - Grouping......................................................................................................................... 1259
3030 - Materialized query tables...............................................................................................1262
3031 - Recursive common table expressions........................................................................... 1265
Messages reference.............................................................................................................................. 1267
Performance information.................................................................................................................1267
Open data paths...............................................................................................................................1292
PRTSQLINF.......................................................................................................................................1298
Notices............................................................................................................1313
Programming interface information......................................................................................................1314
Trademarks............................................................................................................................................1314
Terms and conditions............................................................................................................................ 1315
xiv
Database performance and query optimization
The goal of database performance tuning is to minimize the response time of your queries by making the
best use of your system resources. The best use of these resources involves minimizing network traffic,
disk I/O, and CPU time. This goal can only be achieved by understanding the logical and physical structure
of your data, the applications used on your system, and how the conflicting uses of your database might
affect performance.
The best way to avoid performance problems is to ensure that performance issues are part of your
ongoing development activities. Many of the most significant performance improvements are realized
through careful design at the beginning of the database development cycle. To most effectively optimize
performance, you must identify the areas that yield the largest performance increases over the widest
variety of situations. Focus your analysis on these areas.
Many of the examples within this publication illustrate a query written through either an SQL or an
OPNQRYF query interface. The interface chosen for a particular example does not indicate an operation
exclusive to that query interface, unless explicitly noted. It is only an illustration of one possible query
interface. Most examples can be easily rewritten into whatever query interface that you prefer.
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer
information” on page 1311.
Other information
You can also view or print any of the following PDF files:
• Preparing for and Tuning the SQL Query Engine on DB2® for i5/OS
Query dispatcher
The function of the dispatcher is to route the query request to either CQE or SQE, depending on the
attributes of the query. All queries are processed by the dispatcher. It cannot be bypassed.
Currently, the dispatcher routes queries to SQE unless it finds that the query references or contains any of
the following:
• INSERT WITH VALUES statement or the target of an INSERT with subselect statement
• Tables with Read triggers
• Read-only queries with more than 1000 dataspaces, or updatable queries with more than 256
dataspaces.
• Db2 Multisystem tables
• QQQQry API
In earlier releases, for other non-SQL queries, for example Query/400 or OPNQRYF, the routing of the
query could be controlled by the QAQQINI SQE_NATIVE_ACCESS option. SQE_NATIVE_ACCESS is no
longer supported and a non-SQL query will always run SQE unless unless it contains one of the conditions
listed above.
Statistics manager
In CQE, the retrieval of statistics is a function of the Optimizer. When the Optimizer needs to know
information about a table, it looks at the table description to retrieve the row count and table size.
If an index is available, the Optimizer might extract information about the data in the table. In SQE,
the collection and management of statistics is handled by a separate component called the statistics
manager. The statistics manager leverages all the same statistical sources as CQE, but adds more sources
and capabilities.
The statistics manager does not actually run or optimize the query. Instead, it controls the access to the
metadata and other information that is required to optimize the query. It uses this information to answer
questions posed by the query optimizer. The statistics manager always provides answers to the optimizer.
In cases where it cannot provide an answer based on actual existing statistics information, it is designed
to provide a predefined answer.
The Statistics manager typically gathers and tracks the following information:
Cardinality of The number of unique or distinct occurrences of a specific value in a single column
values or multiple columns of a table.
Selectivity Also known as a histogram, this information is an indication of how many rows
are selected by any given selection predicate or combination of predicates. Using
sampling techniques, it describes the selectivity and distribution of values in a given
column of the table.
Frequent values The top nn most frequent values of a column together with a count of how
frequently each value occurs. This information is obtained by using statistical
sampling techniques. Built-in algorithms eliminate the possibility of data skewing.
For example, NULL values and default values that can influence the statistical values
are not taken into account.
Metadata Includes the total number of rows in the table, indexes that exist over the table, and
information which indexes are useful for implementing the particular query.
Estimate of IO An estimate of the amount of IO operations that are required to process the table or
operation the identified index.
The Statistics manager uses a hybrid approach to manage database statistics. Most of this information
can be obtained from existing indexes. In cases where the required statistics cannot be gathered from
existing indexes, statistical information is constructed on single columns of a table and stored internally.
By default, this information is collected automatically by the system, but you can manually control the
collection of statistics. Unlike indexes, however, statistics are not maintained immediately as data in the
tables change.
Related reference
Collecting statistics with the statistics manager
The collection of statistics is handled by a separate component called the statistics manager. Statistical
information can be used by the query optimizer to determine the best access plan for a query. Since
Plan cache
The plan cache is a repository that contains the access plans for queries that were optimized by SQE.
Access plans generated by CQE are not stored in the plan cache; instead, they are stored in SQL packages,
the system-wide statement cache, and job cache. The purposes of the plan cache are to:
• Facilitate the reuse of a query access plan when the same query is re-executed
• Store runtime information for subsequent use in future query optimizations
• Provide performance information for analysis and tuning
Once an access plan is created, it is available for use by all users and all queries, regardless of where
the query originates. Furthermore, when an access plan is tuned, for example, when creating an index,
all queries can benefit from this updated access plan. This updated access plan eliminates the need to
re-optimize the query, resulting in greater efficiency.
The following graphic shows the concept of re-usability of the query access plans stored in the plan
cache:
Table
An SQL table or physical file is the base object for a query. It represents the source of the data used
to produce the result set for the query. It is created by the user and specified in the FROM clause (or
OPNQRYF FILE parameter).
The optimizer determines the most efficient way to extract the data from the table in order to satisfy the
query. These ways could include scanning or probing the table or using an index to extract the data.
Visual explain icon:
Considerations • All rows in the table are examined regardless of the selectivity of the
query
• Rows marked as deleted are still paged into memory even though
none are selected. You can reorganize the table to remove deleted
rows.
Likely to be used • When expecting many rows returned from the table
• When the number of large I/Os needed to scan is fewer than the
number of small I/Os required to probe the table
Related concepts
Nested loop join implementation
Table probe
A table probe operation is used to retrieve a specific row from a table based upon its row number. The
row number is provided to the table probe access method by some other operation that generates a row
number for the table.
This can include index operations as well as temporary row number lists or bitmaps. The processing for a
table probe is typically random. It requests a small I/O to retrieve only the row in question and does not
attempt to bring in any extraneous rows. This method leads to efficient processing for smaller result sets
because only rows needed to satisfy the query are processed, rather than scanning all rows.
However, since the sequence of the row numbers is not known in advance, little pre-fetching can be
performed to bring the data into main memory. This randomness can result in most of the I/Os associated
with table probe to be performed synchronously.
Considerations Because of the synchronous random I/O the probe can perform poorly
when many rows are selected
Likely to be used • When row numbers (from indexes or temporary row number lists)
are used, but data from the underlying table is required for further
processing of the query
• When processing any remaining selection or projection of the values
Database Monitor and Plan QQRID 3001 Index Used, where QVC14 (Index_Only_Access) set to 'N'
Cache record indicating use indicates that a table probe was used in conjunction with the index
access operation.
Database Monitor and Plan QQRID 3001 Index Used, where QQKP (Index_Probe_Used) set to 'N'
Cache record indicating use will indicate an index scan operation. Preload indicated by QVPARPL =
'Y'. Distinct Probe indicated by QVC11 = 'Y'.
Related reference
Effects of the ALWCPYDTA parameter on database performance
Some complex queries can perform better by using a sort or hashing method to evaluate the query
instead of using or creating an index.
The following example illustrates a query where the optimizer might choose the radix index probe access
method:
In this example, index X1 is used to position to the first index entry that matches the selection built
over both columns LastName and WorkDept. The selection is rewritten into a series of ranges that match
all the leading key columns used from the index X1. The probe is then based upon the composite
concatenated values for all the leading keys. The pseudo-SQL for this rewritten SQL might look as follows:
SELECT * FROM X1
WHERE X1.LeadingKeys BETWEEN 'JonesA01' AND 'JonesE01'
OR X1.LeadingKeys BETWEEN 'PetersonA01' AND 'PetersonE01'
OR X1.LeadingKeys BETWEEN 'SmithA01' AND 'SmithE01'
All the key entries that satisfy the probe operation are used to generate a row number for the table
associated with the index (for example, Employee). The row number is used by a Table Probe operation to
perform random I/O on the table to produce the results for the query. This processing continues until all
the rows that satisfy the index probe operation have been processed. In this example, all the index entries
processed and rows retrieved met the index probe criteria.
Additional selection might be added that cannot use an index probe, such as selection against columns
which are not leading key columns of the index. Then the optimizer performs an index scan operation
within the range of probed values. This process still allows for selection to be performed before the Table
Probe operation.
Related concepts
Nested loop join implementation
Db2 for i provides a nested loop join method. For this method, the processing of the tables in the join
are ordered. This order is called the join order. The first table in the final join order is called the primary
table. The other tables are called secondary tables. Each join table position is called a dial.
Related reference
Effects of the ALWCPYDTA parameter on database performance
Some complex queries can perform better by using a sort or hashing method to evaluate the query
instead of using or creating an index.
Related concepts
Encoded vector indexes
An encoded vector index (EVI) is used to provide fast data access in decision support and query reporting
environments.
EVI maintenance
There are unique challenges to maintaining EVIs. The following table shows a progression of how EVIs are
maintained, the conditions under which EVIs are most effective, and where EVIs are least effective, based
on the EVI maintenance characteristics.
Likely to be used • When the table row size is wide, the number of select columns is
small compared to the number of columns in the table and the query
requires a table probe to retrieve columns
Database Monitor and Plan A QQRID 3001 Index Used record for each EVI with QQRCOD = ‘I8’
Cache record indicating use
SMP parallel enabled Yes
Also referred to as Table Probe, Preload
Visual Explain icon
Prior to encoded vector index only access (EOA), the recommendation had been to only create EVIs for
column with low cardinality (small number of distinct values). This recommendation has now changed.
EVI RRN Probe can be used for columns with high cardinality (large number of distinct values). However,
when creating the EVI, the WITH integer DISTINCT VALUES clause should be used to set the initial size of
the codes appropriately and to minimize maintenance time if the database manager needs to use a larger
code. See the CREATE INDEX statement in the SQL Reference for more details.
Considerations EVIs are usually built over a single key. The more distinct the column
is and the higher the overflow percentage, the less advantageous the
encoded vector index becomes. EVIs always require a Table Probe to be
performed on the result of the EVI probe operation.
Likely to be used • When the selection columns match the leading key columns of the
index
• When an encoded vector index exists and savings in reduced I/O
against the table justifies the extra cost. This cost includes probing
the EVI and fully populating the temporary row number list.
SELECT *
FROM Employee
WHERE WorkDept = 'E01' AND Job = 'CLERK'
AND Salary = 5000
OPTIMIZE FOR 99999 ROWS
Using the example above, the optimizer chooses to create a temporary row number bitmap for each of
the encoded vector indexes used by this query. Each bitmap only identifies those rows that match the
selection on the key columns for that index.
These temporary row number bitmaps are then merged together to determine the intersection of the rows
selected from each index. This intersection is used to form a final temporary row number bitmap used to
help schedule the I/O paging against the table for the selected rows.
The optimizer might choose to perform an index probe with a binary radix tree index if an index existed
over all three columns. The implementation choice is probably decided by the number of rows to be
returned and the anticipated cost of the I/O associated with each plan.
Likely to be used • When asking for GROUP BY, DISTINCT, COUNT, or COUNT DISTINCT
from a single table and the referenced columns are in the key
definition.
• When the number of unique values in the columns of the key
definition is small relative to the number of records in the underlying
table.
• When there is no selection (WHERE clause) within the query or the
selection does not reduce the result set much.
• When the symbol table key satisfies the GROUP BY, and requested
aggregates, like SUM or COUNT, are specified as INCLUDE values.
• when the query is run with commitment control *NONE or *CHG.
Example 1
Example 2
Example 3
Example 4 uses the INCLUDE option. The sums of revenue and cost of
goods per sales region is maintained in real time.
Related concepts
Encoded vector indexes
An encoded vector index (EVI) is used to provide fast data access in decision support and query reporting
environments.
How the EVI works
EVIs work in different ways for costing and implementation.
Related reference
Index grouping implementation
Example 1
Example 2
Related concepts
Encoded vector indexes
An encoded vector index (EVI) is used to provide fast data access in decision support and query reporting
environments.
How the EVI works
Considerations Used for distinct or group by processing. Can perform poorly when
the entire hash table does not stay resident in memory as it is being
processed.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA)
• When the data is required to be collated based upon a column or
columns for distinct or grouping
Considerations Used to process equal join criteria. Can perform poorly when the entire
hash table does not stay resident in memory as it is being processed.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA)
• When the data is required to be collated based upon a column or
columns for join processing
• The join criteria was specified using an equals (=) operator
The hash table probe access method is considered when determining the implementation for a secondary
table of a join. The hash table is created with the key columns that match the equal selection or join
criteria for the underlying table.
The hash table probe allows the optimizer to choose the most efficient implementation in selecting rows
from the underlying table, without regard for join criteria. This single pass through the underlying table
can now use a table scan or existing index to select the rows needed for the hash table population.
Since hash tables are constructed so that most of the hash table remains resident within main memory,
the I/O associated with a hash probe is minimal. Additionally, if the hash table was populated with all
necessary columns from the underlying table, no additional table probe is required to finish processing
this table. This method causes further I/O savings.
Related concepts
Nested loop join implementation
Db2 for i provides a nested loop join method. For this method, the processing of the tables in the join
are ordered. This order is called the join order. The first table in the final join order is called the primary
table. The other tables are called secondary tables. Each join table position is called a dial.
Database Monitor and Plan QQRID 3003 Query Sort. There is no specific field that indicates
Cache record indicating use whether or not the sorted list was used for a scan or a probe. Refer
to Visual Explain diagram for query implementation details.
Considerations Used to process non-equal join criteria. Can perform poorly when
the entire sorted list does not stay resident in memory as it is being
populated and processed.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA)
• When the data is required to be collated based upon a column or
columns for join processing
• The join criteria was specified using a non-equals operator
Database Monitor and Plan QQRID 3003 Query Sort. There is no specific field that indicates
Cache record indicating use whether or not the sorted list was used for a scan or a probe. Refer
to Visual Explain diagram for query implementation details.
The sorted list probe access method is considered when determining the implementation for a secondary
table of a join. The sorted list is created with the key columns that match the non-equal join criteria for
the underlying table. The optimizer chooses the most efficient implementation to select the rows from the
underlying table without regard to any join criteria. This single pass through the underlying table can use a
Table Scan or an existing index to select the rows needed to populate the sorted list.
Temporary list
The temporary list is a temporary object that allows the optimizer to store intermediate results of a query.
The list is an unsorted data structure that is used to simplify the operation of the query. Since the list does
not have any keys, the rows within the list can only be retrieved by a sequential scan operation.
The temporary list can be used for various reasons, some of which include an overly complex view or
derived table, Symmetric Multiprocessing (SMP) or to prevent a portion of the query from being processed
multiple times.
A temporary list is an internal data structure and can only be created by the database manager.
Visual explain icon:
List scan
The list scan operation is used when a portion of the query is processed multiple times, but no key
columns can be identified. In these cases, that portion of the query is processed once and its results
are stored within the temporary list. The list can then be scanned for only those rows that satisfy any
selection or processing contained within the temporary object.
Considerations Used to prevent portions of the query from being processed multiple
times when no key columns are required to satisfy the request.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA).
• When Db2 symmetric multiprocessing is used for the query.
Using the example above, the optimizer chose to create a temporary list to store the selected rows from
the DEPARTMENT table. Since there is no join criteria, a Cartesian product join is performed between
the two tables. To prevent the join from scanning all the rows of the DEPARTMENT table for each join
possibility, the selection against the DEPARTMENT table is performed once. The results are stored in the
temporary list. The temporary list is then scanned for the Cartesian product join.
Considerations Since the row number list contains only the addresses of the selected
rows in the table, a separate Table Probe fetches the table rows.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA).
• When the cost of sorting of the row number is justified by the more
efficient I/O that can be performed during the Table Probe operation.
• When multiple indexes over the same table need to be combined in
order to minimize the number of selected rows.
Database Monitor and Plan QQRID 3001 and QQRID 3021 records for each index used.
Cache record indicating use
The QQC11 field in the 3021 record will be 'L'.
A QQRID 3000 record with QQC11 (Skip_Sequential_Table_Scan) = 'Y'.
Optionally, QQRID 3022 records if bitmap merging occurred.
Using the example above, the optimizer created a temporary row number list for each of the indexes used
by this query. These indexes included a radix index and two encoded vector indexes. Each index row
number list was scanned and merged into a final composite row number list representing the intersection
of all the index row number lists. The final row number list is then used by the Table Probe to determine
which rows are selected and processed for the query results.
Considerations Used when the query contains ordering and additional selection that
can be satisfied by additional indexes. Since the row number list
contains only the addresses of the selected rows in the table, a
separate Table Probe fetches the table rows.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA).
• When the cost of creating and probing the row number list is justified
by reducing the number of Table Probe operations that must be
performed.
• When multiple indexes over the same table need to be combined in
order to minimize the number of selected rows.
Database Monitor and Plan QQRID 3001 and QQRID 3021 records for each index used.
Cache record indicating use
The QQC11 field in the 3021 record will be 'L'.
Optionally, QQRID 3022 records if bitmap merging occurred.
Using the example above, the optimizer created a temporary row number list for each of the encoded
vector indexes. Additionally, an index probe operation was performed against the radix index X1 to satisfy
the ordering requirement. Since the ORDER BY requires that the resulting rows be sequenced by the
WorkDept column, the row number list cannot be scanned for the selected rows.
However, the temporary row number list can be probed using a row address extracted from the index X1
used to satisfy the ordering. By probing the list with the row address extracted from the index probe, the
sequencing of the keys in the index X1 is preserved. The row can still be tested against the selected rows
within the row number list.
Temporary bitmap
The temporary bitmap is a temporary object that allows the optimizer to sequence rows based upon their
row address (their row number). The bitmap can be either scanned or probed by the optimizer to satisfy
different operations of the query.
A temporary bitmap is a data structure that uses a bitmap to represent all the row numbers for a table.
Since each row is represented by a separate bit, all the rows within a table can be represented in a fairly
condensed form. When a row is selected, the bit within the bitmap that corresponds to the selected row is
set on. After the temporary bitmap is populated, all the selected rows can be retrieved in a sorted manner
for quick and efficient retrieval. The temporary bitmap only represents the row number for the associated
selected rows.
No table data is present within the temporary bitmap. A table probe operation is typically associated with
the bitmap in order to retrieve the underlying table data. Because the bitmap is by definition sorted, the
random I/O associated with the table probe operation can be performed more efficiently. The database
manager performs pre-fetch or look-ahead logic to determine if multiple rows are located on adjacent
pages. If so, the table probe requests a larger I/O to bring the rows into main memory more efficiently.
A temporary bitmap is an internal data structure and can only be created by the database manager.
Visual explain icon:
Considerations Since the bitmap contains only the addresses of the selected rows in
the table, a separate Table Probe fetches the table rows.
Likely to be used • When the use of temporary results is allowed by the query
environmental parameter (ALWCPYDTA).
• When the cost of sorting of the row numbers is justified by the more
efficient I/O that can be performed during the Table Probe operation.
• When multiple indexes over the same table need to be combined in
order to minimize the number of selected rows.
Using the example above, the optimizer created a temporary bitmap for each of the indexes used by
this query. These indexes included a radix index and two encoded vector indexes. Each index temporary
bitmap was scanned and merged into a final composite bitmap representing the intersection of all the
index temporary bitmaps. The final bitmap is then used by the Table Probe operation to determine which
rows are selected and processed for the query results.
Bitmap probe
A bitmap probe operation is used to test row numbers generated by a separate operation against
the selected rows of a temporary bitmap. The row numbers can be generated by any operation that
constructs a row number for a table. That row number is then used to probe into a temporary bitmap to
determine if it matches the selection used to generate the bitmap.
The use of a bitmap probe operation allows the optimizer to generate a plan that can take advantage of
any sequencing provided by an index, but still use the bitmap to perform additional selection before any
Table Probe operations.
A bitmap probe is identical to a row number list probe operation. The only difference is that the list probe
is over a list of row addresses while the bitmap probe is over a bitmap representing the addresses.
Database Monitor and Plan QQRID 3001 and QQRID 3021 records for each index used.
Cache record indicating use
The QQC11 field in the 3021 record will be 'BL'.
Optionally, QQRID 3022 records if bitmap merging occurred.
Using the example above, the optimizer created a temporary bitmap for each of the encoded vector
indexes. Additionally, an index probe operation was performed against the radix index X1 to satisfy
the ordering requirement. Since the ORDER BY requires that the resulting rows be sequenced by the
WorkDept column, the bitmap cannot be scanned for the selected rows.
However, the temporary bitmap can be probed using a row address extracted from the index X1 used
to satisfy the ordering. By probing the bitmap with the row address extracted from the index probe, the
sequencing of the keys in the index X1 is preserved. The row can still be tested against the selected rows
within the bitmap.
Database Monitor and Plan QQRID 3002 record and QQRID 3001
Cache record indicating use
where QQKP(Index_Probe_Used) = 'N'.
Database Monitor and Plan QQRID 3002 record and QQRID 3001
Cache record indicating use
where QQKP(Index_Probe_Used) = 'Y'.
Using the example above, the optimizer chose to create a temporary index over the DeptNo column to
help satisfy the join requirement against the DEPARTMENT table. A temporary index probe was then
performed against the temporary index to process the join criteria between the two tables. In this
particular case, there was no additional selection that might be applied against the DEPARTMENT table
while the temporary index was being created.
Temporary buffer
The temporary buffer is a temporary object that is used to help facilitate operations such as parallelism.
It is an unsorted data structure that is used to store intermediate rows of a query. The difference between
a temporary buffer and a temporary list is that the buffer does not need to be fully populated before its
results are processed.
The temporary buffer acts as a serialization point between parallel and non-parallel portions of a query.
The operations used to populate the buffer cannot be performed in parallel, whereas the operations that
fetch rows from the buffer can be performed in parallel.
The temporary buffer is required for SQE because the index scan and index probe operations are not SMP
parallel-enabled for this engine. Unlike CQE, which performs these index operations in parallel, SQE does
not subdivide the index operation work to take full advantage of parallel processing.
The buffer is used to allow a query to be processed under parallelism by serializing access to the index
operations. Any remaining work within the query is processed in parallel.
A temporary buffer is an internal data structure and can only be created by the database manager.
Visual explain icon:
Buffer scan
The buffer scan is used when a query is processed using Db2 Symmetric Multiprocessing, yet a portion of
the query is unable to be parallel processed. The buffer scan acts as a gateway to control access to rows
between the parallel enabled portions of the query and the non-parallel portions.
Multiple threads can be used to fetch the selected rows from the buffer, allowing the query to perform any
remaining processing in parallel. However, the buffer is populated in a non-parallel manner.
Considerations Used to prevent portions of the query from being processed multiple
times when no key columns are required to satisfy the request.
Likely to be used • When the query is attempting to take advantage of Db2 Symmetric
Multiprocessing
• When a portion of the query cannot be performed in parallel (for
example, index scan or index probe)
Database Monitor and Plan QVPARU will be greater than 0 on the associated database monitor
Cache record indicating use record.
SMP parallel enabled Yes
Also referred to as Not applicable
Visual Explain icon
Using the example above, the optimizer chose to use the existing index X1 to perform an index probe
operation against the table. In order to speed up the remaining Table Probe operation for this query, Db2
Symmetric Multiprocessing is used to perform the random probe into the table. Since the index probe is
not SMP parallel-enabled for SQE, it is placed within a temporary buffer to control access to the selected
index entries.
Queue
The Queue is a temporary object that the optimizer uses to feed recursion by putting data values needed
for the recursion on it. This data typically includes those values used on the recursive join predicate, and
other recursive data accumulated or manipulated during the recursive process.
The Queue has two operations allowed:
Enqueue
During an enqueue operation, an entry is put on the queue. The entry contains key values used by the
recursive join predicates or data manipulated as a part of the recursion process. The optimizer always
supplies an enqueue operation to collect the required recursive data on the query node directly above the
Union All.
Database Monitor and Plan There are no explicit records that indicate the use of an enqueue
Cache record indicating use
SMP parallel enabled Yes
Also referred to as Not applicable
Use the CYCLE option in the definition of the recursive query if the data reflecting the parent-child
relationship could be cyclic, causing an infinite recursion loop. CYCLE prevents already visited recursive
key values from being put on the queue again for a given set of related (ancestry chain) rows.
Use the SEARCH option in the definition of the recursive query to return the results of the recursion in
the specified parent-child hierarchical ordering. The search choices are Depth or Breadth first. Depth first
means that all the descendents of each immediate child are returned before the next child is returned.
Breadth first means that each child is returned before their children are returned.
SEARCH requires not only the specification of the relationship keys, the columns which make up the
parent-child relationship, and the search type of Depth or Breadth. It also requires an ORDER BY clause in
the main query on the provided sequence column in order to fully implement the specified ordering.
Dequeue
During a dequeue operation, an entry is taken off the queue. Those values specified by recursive
reference are fed back in to the recursive join process.
The optimizer always supplies a corresponding enqueue, dequeue pair of operations for each recursive
common table expression or recursive view in the specifying query. Recursion ends when there are no
more entries to pull off the queue.
CALL processCustomers()
Database Monitor and Plan Cache record QQRID 3001 where QQRCOD = ‘I7’
indicating use
SMP parallel enabled No
Also referred to as
Visual Explain icon
Using the example above, the optimizer chose to create a temporary indexed list of distinct WORKDEPT
values from index INDEX1. The selection SALARY > 3000 was applied to the index probe distinct.
Index Merge:
An index merge operation is used to provide ordering in conjunction with a temporary indexed list scan
and an index probe distinct or distinct index.
The sequenced rows can be used by the optimizer to satisfy a portion of the query request (such as
ordering or grouping).
Database Monitor and Plan Cache record QQRID 3001 where QQRCOD = ‘I7’
indicating use
SMP parallel enabled No
Also referred to as
Visual Explain icon
Window
The window is a temporary object that holds intermediate results needed to determine the result for
On-Line Analytical Processing (OLAP) functions. The number of rows in the window may change as the
data flows through it.
The window is an internal data structure and can only be created by the database manager.
Visual explain icon:
Processing requirements
Parallelism requires that SMP parallel processing must be enabled by one of the following methods:
• System value QQRYDEGREE
Join optimization
A join operation is a complex function that requires special attention in order to achieve good
performance. This section describes how Db2 for i implements join queries and how optimization choices
are made by the query optimizer. It also describes design tips and techniques which help avoid or solve
performance problems.
The index with key columns EMPNO, PROJNO, and EMSTDATE are fully utilized by combining join and
selection into one operation against all three key columns.
When creating a temporary index, the left-most key columns are the usable join columns in that dial
position. All local row selection for that dial is processed when selecting entries for inclusion into the
temporary index. A temporary index is like the index created for a select/omit keyed logical file. The
temporary index for the previous example has key columns of EMPNO and EMSTDATE.
Since the optimizer tries a combination of join and local row selection, you can achieve almost all the
advantages of a temporary index by using an existing index. In the preceding example, using either
implementation, an existing index could be used or a temporary index could be created. A temporary
index is built with the local row selection on PROJNO applied during the index creation. The temporary
index has key columns of EMPNO and EMSTDATE to match the join selection.
If, instead, an existing index was used with key columns of EMPNO, PROJNO, EMSTDATE (or PROJNO,
EMP_ACT, EMSTDATE), the local row selection can be applied at the same time as the join selection.
This method contrasts to applying the local selection before the join selection, as happens when the
temporary index is created. Or applying the local selection after the join selection, as happens when only
the first key column of the index matches the join column.
The existing index implementation is more likely to provide faster performance because join and selection
processing are combined without the overhead of building a temporary index. However, the existing index
could have slightly slower I/O processing than the temporary index because the local selection is run
many times rather than once. In general, create indexes with key columns for the combination of join and
equal selection columns as the left-most keys.
1-2 2-1 1-3 3-1 1-4 4-1 2-3 3-2 2-4 4-2 3-4 4-3
4. Choose the combination with the lowest join cost and number of selected rows or both.
5. Determine the cost, access method, and expected number of rows for each remaining table joined to
the previous secondary table.
The allowable join order combinations for this query would be:
1–2–3, 2–1–3, or 2–3–1
Right outer or right exception joins are implemented as left outer and left exception, with files flipped. For
example:
is implemented as B LEFT OUTER JOIN A ON B.C1=A.C1. The only allowed join order is 2–1.
Related information
Open Query File (OPNQRYF) command
Change Query Attributes (CHGQRYA) command
A query with multiple FULL OUTER JOIN requests, such as A FULL OUTER JOIN B FULL OUTER JOIN
C can quickly become complicated in this rewritten state. This complication is illustrated in the following
example.
If not running in live data mode, the optimizer could facilitate performance both during optimization and
runtime by encapsulating intermediate results in a temporary data object. This object can be optimized
once and plugged into both the scanned and probed side of the rewrite. These shared temporary objects
eliminate the need to make multiple passes through the specific tables to satisfy the request.
In this example, the result of the (A FULL OUTER JOIN B) is a candidate for encapsulation during its FULL
OUTER join with C.
((A LEFT OUTER JOIN B) UNION ALL (B LEFT EXCEPTION JOIN A)) LEFT OUTER JOIN C )
UNION ALL
(C LEFT EXCEPTION JOIN ((A LEFT OUTER JOIN B) UNION ALL (B LEFT EXCEPTION JOIN A))
FULL OUTER implies that both sides of the join request can generate NULL values in the resulting answer
set. Local selection in the WHERE clause of the query could result in the appropriate downgrade of the
FULL OUTER to a LEFT OUTER or INNER JOIN.
If you want FULL OUTER JOIN behavior and local selection applied, specify the local selection in the ON
clause of the FULL OUTER JOIN, or use common table expressions. For example:
WITH TEMPEMP AS (SELECT * FROM CORPDATA.EMPLOYEE XXX WHERE SALARY > 10000)
SELECT EMPNO, LASTNAME, DEPTNAME
FROM TEMPEMP XXX
FULL OUTER JOIN CORPDATA.DEPARTMENT YYY
ON XXX.WORKDEPT = YYY.DEPTNO
The following rules determine which predicates are added to other join dials:
• The dials affected must have join operators of equal.
• The predicate is isolatable, which means that a false condition from this predicate omits the row.
• One operand of the predicate is an equal join column and the other is a constant or host variable.
• The predicate operator is not LIKE (OPNQRYF %WLDCRD, or *CT).
• The predicate is not connected to other predicates by OR.
The query optimizer generates a new predicate, whether a predicate exists in the WHERE clause
(OPNQRYF QRYSLT parameter).
Some predicates are redundant. Redundant predicates occur when a previous evaluation of other
predicates in the query already determines the result that predicate provides. Redundant predicates
can be specified by you or generated by the query optimizer during predicate manipulation. Redundant
predicates with operators of =, >, >=, <, <=, or BETWEEN (OPNQRYF *EQ, *GT, *GE, *LT, *LE, or %RANGE)
are merged into a single predicate to reflect the most selective range.
WITH HT AS (SELECT *
FROM EMPLOYEE
WHERE EMPLOYEE.EMPNO='000010')
SELECT *
FROM HT, EMP_ACT
WHERE HT.EMPNO = EMP_ACT.EMPNO
AND EMP_ACT.EMPNO IN (SELECT DISTINCT EMPNO
FROM HT)
The optimizer places the results of the "subquery" into a temporary hash table. The hash table of the
subquery can be applied in one of two methods against the EMP_ACT (fact) table:
• The distinct values of the hash tables are retrieved. For each distinct value, an index over EMP_ACT is
probed to determine which records are returned for that value. Those record identifiers are normally
then stored and sorted (sometimes the sorting is omitted, depending on the total number of record
ids expected). Once the ids are determined, the subset of EMP_ACT records can be accessed more
efficiently than in a traditional nested loop join processing.
• EMP_ACT can be scanned. For each record, the hash table is probed to see if the record joins at all to
EMPLOYEE. This method allows for efficient access to EMP_ACT with a more efficient record rejection
method than in a traditional nested loop join process.
Note: LPG processing is part of the normal processing in the SQL Query Engine. CQE only considers the
first method, requires that the index in question by an EVI and also requires use of the STAR_JOIN and
FORCE_JOIN_ORDER QAQQINI options.
Tips for improving performance when selecting data from more than two
tables
The following suggestion is only applicable to CQE and is directed specifically to select-statements that
access several tables. For joins that involve more than two tables, you might want to provide redundant
information about the join columns. The CQE optimizer does not generate transitive closure predicates
between two columns. If you give the optimizer extra information to work with when requesting a join,
it can determine the best way to do the join. The additional information might seem redundant, but is
helpful to the optimizer.
If the select-statement you are considering accesses two or more tables, all the recommendations
suggested in “Creating an index strategy” on page 259 apply. For example, instead of coding:
EXEC SQL
DECLARE EMPACTDATA CURSOR FOR
SELECT LASTNAME, DEPTNAME, PROJNO, ACTNO
FROM CORPDATA.DEPARTMENT, CORPDATA.EMPLOYEE,
CORPDATA.EMP_ACT
WHERE DEPARTMENT.MGRNO = EMPLOYEE.EMPNO
AND EMPLOYEE.EMPNO = EMP_ACT.EMPNO
END-EXEC.
EXEC SQL
DECLARE EMPACTDATA CURSOR FOR
SELECT LASTNAME, DEPTNAME, PROJNO, ACTNO
FROM CORPDATA.DEPARTMENT, CORPDATA.EMPLOYEE,
CORPDATA.EMP_ACT
WHERE DEPARTMENT.MGRNO = EMPLOYEE.EMPNO
AND EMPLOYEE.EMPNO = EMP_ACT.EMPNO
AND DEPARTMENT.MGRNO = EMP_ACT.EMPNO
END-EXEC.
The first selection predicate, XXX.EMPNO = YYY.MGRNO, is an additional join condition that is evaluated
as an "inner join" condition. The second is an isolatable selection predicate that eliminates any
unmatched rows. Either of these predicates can cause the join type for the DEPARTMENT table to change
from a left outer join to an inner join.
Even though the join between the EMPLOYEE and DEPARTMENT tables was changed to an inner join, the
entire query remains a left outer join to satisfy the join condition for the PROJECT table.
Note: Care must be taken when specifying multiple join types since they are supported by appending
selection to the query for any unmatched rows. The number of rows satisfying the join criteria can
become large before selection that either selects or omits the unmatched rows based on that individual
dial join type is applied.
Table 31. Checklist for Creating an Application that Uses Join Queries
What to Do How It Helps
Check the database design. The query optimizer can select an efficient access method because it can
Make sure that there are determine the average number of duplicate values. Many queries could use
indexes available over all the the existing index and avoid the cost of creating a temporary index or hash
join columns and row selection table.
columns or both. The optimizer
provides index advice in several
places to aid in this process:
• the index advisor under
System i Navigator - Database
• the advised information under
Visual Explain
• the advised information in the
3020 record in the database
monitor
Check the query to see whether The query optimizer does not add predicates for predicates connected by OR
some complex predicates could or non-isolatable predicates, or predicate operator LIKE. Modify the query by
be added to other dials to adding additional predicates to help.
allow the optimizer to get better
selectivity for each dial.
Specify The query is creating a temporary index or hash table, and the processing
ALWCPYDTA(*OPTIMIZE) or time could be better if the existing index or hash table was used. Specify
ALWCPYDTA(*YES) ALWCPYDTA(*YES).
The query is not creating a temporary index or hash table, and the
processing time could be better if a temporary index was created. Specify
ALWCPYDTA(*OPTIMIZE).
Alternatively, specify OPTIMIZE FOR n ROWS to inform the optimizer that the
application reads every resulting row. Set n to a large number. You can also
set n to a small number before ending the query.
Specify Ordering is specified and all key columns are from a single dial. The optimizer
ALWCPYDTA(*OPTIMIZE) to can consider all possible join orders with ALWCPYDTA(*OPTIMIZE).
allow the query optimizer to use
a sort routine.
Specify join predicates to Improves performance by reducing the join fan-out. It is best if every
prevent all the rows from one secondary table has at least one join predicate that references one of its
table from being joined to every columns as a 'join-to' column.
row in the other table.
Distinct optimization
Distinct is used to compare a value with another value.
There are two methods to write a query that returns distinct values in SQL. One method uses the
DISTINCT keyword:
Distinct removal
A query containing a DISTINCT over whole-file aggregation (no grouping or selection) allows the
DISTINCT to be removed. For example, look at this query with DISTINCT:
If the DISTINCT and the GROUP BY fields are identical, the DISTINCT can be removed. If the DISTINCT
fields are a subset of the GROUP BY fields (and there are no aggregates), the DISTINCTs can be removed.
Grouping optimization
Db2 for i has certain techniques to use when the optimizer encounters grouping. The query optimizer
chooses its methods for optimizing your query.
Ordered grouping
This implementation uses the Radix Index Scan or the Radix Index Probe access methods to perform the
grouping. An index is required that contains all the grouping columns as contiguous leftmost key columns.
The database manager accesses the individual groups through the index and performs the requested
summary functions.
Since the index, by definition, already has all the key values grouped, the first group result can be
returned in less time than the hashing method. This index performance is faster because the hashing
method requires a temporary result. This implementation can be beneficial if an application does not
need to retrieve all the group results, or if an index exists that matches the grouping columns.
When the grouping is implemented with an index and a permanent index does not exist that satisfies
grouping columns, a temporary index is created. The grouping columns specified within the query are
used as the key columns for this index.
Pre-summarized processing
This SQE-only implementation uses an Encoded Vector Index to extract the summary information already
in the symbol table of the index. The EVI symbol table contains the unique key values and a count of the
number of table records that have that unique value. The grouping for the columns of the index key is
already performed. If the query references a single table and performs simple aggregation, the EVI might
be used for quick access to the grouping results. For example, consider the following query:
If an EVI exists over t1 with a key of col1, the optimizer can rewrite the query to access the precomputed
grouping answer in the EVI symbol table.
This rewrite can result in dramatic improvements when the number of table records is large and the
number of resulting groups is small, relative to the size of the table.
This method is also possible with selection (WHERE clause), as long as the reference columns are in the
key definition of the EVI.
This query can be rewritten by the optimizer to use the EVI. This pre-summarized processing works for
DISTINCT processing, GROUP BY and for column function COUNT. All columns of the table referenced in
the query must also be in the key definition of the EVI.
So, for example, the following query can be made to use the EVI:
This query cannot use the EVI because it references col2 of the table, which is not in the key definition of
the EVI. If multiple columns are defined in the EVI key, for example, col1 and col2, it is important to use
the left-most columns of the key. For example, if an EVI existed with a key definition of (col1, col2), but
the query referenced only col2, it is unlikely the EVI is used.
SELECT AVG(col2)
FROM t1
GROUP BY col1
eviT1 delivers distinct values for col1 and COUNT(*) specific to the group by of col1. eviT1 can be used
to generate an asynchronous bitmap or RRN list for accessing the table rows for specific col1 values. In
addition, eviT1 computes an additional aggregate, AVG(col2), over the same group by column (col1) by
specifying the INCLUDE aggregate.
INCLUDE aggregates are limited to those aggregates that result in numeric values: SUM, COUNT, AVG,
STDDEV, and so on. These values can be readily maintained as records are inserted, deleted, or updated
in the base table.
MIN or MAX are two aggregates that are not supported as INCLUDE aggregates. Deleting the current row
contributing to the MIN or MAX value would result in the need to recalculate, potentially accessing many
rows, and reducing performance.
INCLUDE values can also contain aggregates over derivations. For example, if you have a couple
of columns that contribute to an aggregate, that derivation can be specified, for example, as
SUM(col1+col2+col3).
It is recommended that EVIs with INCLUDE aggregates only contain references to columns or column-
specific derivations, for example, SUM(salary+bonus).
By providing an EVI with INCLUDE index, as follows, and with optimizer support to push down aggregates
to the table level when possible, the resulting implementation takes advantage of the ready-made
aggregates already supplied by EVI employeeSumByDept. The implementation never needs to touch or
aggregate rows in the Employee table.
Aggregate pushdown results in a rewrite with EVI INCLUDE implementation, conceptually like the
following query.
Instead of department joining to all the rows in the employee table, it now has the opportunity to join to
the predetermined aggregates, the sum of salary by department number, in the EVI symbol table. This
results in significant reduction in processing and IO.
Related concepts
How the EVI works
EVIs work in different ways for costing and implementation.
Related reference
Encoded vector index symbol table scan
An encoded vector index symbol table scan operation is used to retrieve the entries from the symbol table
portion of the index.
OPNQRYF example:
In this example, the optimizer can remove EMPNO from the list of grouping columns because of the
EMPNO = '000190' selection predicate. An index that only has LASTNAME and WORKDEPT specified as
key columns could implement the query. If a temporary index or hash is required then EMPNO is not used.
Note: Even though EMPNO can be removed from the list of grouping columns, the optimizer might use a
permanent index that exists with all three grouping columns.
For this query request, the optimizer can add EMPNO as an additional grouping column when considering
X1 for the query.
The query optimizer chooses to use the index IX1. The SLIC runtime code scans the index until
it finds the first non-null value for SALARY. Assuming that SALARY is not null, the runtime code
positions to the first index key and return that key value as the MAX of salary. No more index keys are
processed.
Example 2, using SQL:
The query optimizer chooses to use Index IX2. The database manager positions to the first group for
DEPT where JOB equals 'CLERK' and returns the SALARY. The code then skips to the next DEPT group
where JOB equals 'CLERK'.
• For join queries:
– All grouping columns must be from a single table.
– For each dial, there can be at most one MIN or MAX column function operand that references the dial.
No other column functions can exist in the query.
– If the MIN or MAX function operand is from the same dial as the grouping columns, then it uses the
same rules as single table queries.
– If the MIN or MAX function operand is from a different dial, then the join column for that dial must
join to one of the grouping columns. The index for that dial must contain the join columns followed by
the MIN or MAX operand.
Example 1, using SQL:
GROUP BY GROUPING SETS ((A, B, C), (B, D), (A, B), (A), ())
is rewritten to:
This rewrite allows the query to be implemented using at most two temporary results sets rather than 4.
Queries containing a CUBE clause is broken down into a union of ROLLUPs and grouping sets. For
example:
CUBE(A, B, C)
is equivalent to:
The ROLLUP' notation is an internal representation of a ROLLUP operation that does not include a grand
total row in its result set. So, ROLLUP'(B, C) is equivalent to GROUP BY GROUPING SETS ((B,C), (B)). This
CUBE rewrite implements at most three temporary result sets, rather than the 8 that might be needed had
the query not been rewritten.
In order to allow a more general indexing scheme, it is possible to use an index for index merge ordering
even if there are leading keys not used in the query. The above index could also be used for the following
query:
If SALES was added as a trailing key, then Index Only Access would be used for both queries.
The optimizer can now consider more indexes as it implements the query. The number of columns that
are added as key columns to a temporary index is also reduced. The following SQL example illustrates a
query where the optimizer might eliminate an ordering column.
For this query request, the optimizer can add EMPNO as an additional ordering column when considering
X1 for the query.
View implementation
Views, derived tables (nested table expressions or NTEs), and common table expressions (CTEs) are
implemented by the query optimizer using one of two methods.
These methods are:
• The optimizer combines the query select statement with the select statement of the view.
• The optimizer places the results of the view in a temporary table and then replaces the view reference in
the query with the temporary table.
Using SQL:
The query optimizer generates a new query that looks like the following example:
The query contains the columns selected by the user query, the base tables referenced in the query, and
the selection from both the view and the user query.
Note: The new composite query that the query optimizer generates is not visible to users. Only the
original query against the view is seen by users and database performance tools.
SQL example:
In this case, a view composite cannot be created since a join query references a grouping view.
The results of AVGSALVW are placed in a temporary result table (*QUERY0001). The view reference
AVGSALVW is replaced with the temporary result table. The new query is then run. The generated query
looks like the following:
Note: The new query that the query optimizer generates is not visible to users. Only the original query
against the view is seen by users and database performance tools.
Whenever possible, isolatable selection from the query, except subquery predicates, is added to the view
materialization process. This results in smaller temporary result tables and allows existing indexes to be
used when materializing the view. This process is not done if there is more than one reference to the same
view or common table expression in the query. The following is an example where isolatable selection is
added to the view materialization:
SELECT D.DEPTNAME,A.AVGSAL
FROM CORPDATA.DEPARTMENT D, AVGSALVW A
WHERE D.DEPTNO=A.WORKDEPT AND
A.WORKDEPT LIKE 'D%' AND AVGSAL>10000
The isolatable selection from the query is added to the view resulting in a new query to generate the
temporary result table:
Example 1
The first example is a query that returns information about employees whose job is DESIGNER. The
original query:
Resulting new query after replacing the specified tables with the MQT.
In this query, the MQT matches part of the user query. The MQT is placed in the FROM
clause and replaces tables DEPARTMENT and EMPLOYEE. Any remaining selection not done by
the MQT query (M.job= 'DESIGNER') is done to remove the extra rows. The result expression,
M.salary+M.comm+M.bonus, is calculated. JOB must be in the select-list of the MQT so that the
additional selection can be performed.
Visual Explain diagram of the query when using the MQT:
Resulting new query after replacing the specified tables with the MQT:
Since the MQT could potentially produce more groups than the original query, the final resulting query
must group again and SUM the results to return the correct answer. Also, the selection M.location='NY'
must be part of the new query.
Visual Explain diagram of the query when using the MQT:
Example 3
The MQT contains fewer tables than the query:
All predicates specified in the MQT, must also be specified in the query. The query could contain
additional predicates. Predicates specified in the MQT must match exactly the predicates in the query.
Any additional predicates specified in the query, but not in the MQT must be able to be derived from
columns projected from the MQT. See previous example 1.
Example 4
Set the total salary for all departments that are located in 'NY'.
In this example, the constant 'NY' was replaced by a parameter marker and the MQT also had the
local selection of location='NY' applied to it when the MQT was populated. The MQT matching algorithm
matches the parameter marker and to the constant 'NY' in the predicate D.Location=?. It verifies that the
values of the parameter marker are the same as the constant in the MQT; therefore the MQT can be used.
The MQT matching algorithm also attempts to match where the predicates between the MQT and the
query are not the same. For example, if the MQT has a predicate SALARY > 50000, and the query has the
predicate SALARY > 70000, the MQT contains the rows necessary to run the query. The MQT is used in the
query, but the predicate SALARY > 70000 is left as selection in the query, so SALARY must be a column of
the MQT.
Example 5
SELECT D.deptname, sum(E.salary)
FROM DEPARTMENT D, EMPLOYEE E
WHERE D.deptno=E.workdept AND D.location = 'NY'
GROUP BY D.deptname
In this example, since D.Location is not a column of the MQT, the user query local selection predicate
Location='NY' cannot be determined, so the MQT cannot be used.
Example 6
SELECT D.deptname, sum(E.salary)
FROM DEPARTMENT D, EMPLOYEE E
WHERE D.deptno=E.workdept
GROUP BY D.deptname
In this example, the SUM(salary) aggregation is pushed down through the join to the EMPLOYEE table,
allowing for a match and substitution of MQT6. A regrouping to (sum(sum(salary))) is defined at the top of
the query to compensate for the grouping pushdown.
Instead of department joining to all the rows in the employee table, it now has the opportunity to join to
the predetermined aggregates in MQT6. This type of MQT substitution can result in significant reduction of
processing and IO.
If the MQT contains grouping, then the query must be a grouping query. The simplest case is where the
MQT and the query specify the same list of grouping columns and column functions.
In some cases, if the MQT specifies group by columns that are a superset of query group by columns,
the query can be rewritten to do regrouping. This regrouping reaggregates the groups of the MQT into the
groups required by the query. When regrouping is required, the column functions need to be recomputed.
The following table shows the supported regroup expressions.
The regrouping expression/aggregation rules are:
MQT matching does not support ARRAY_AGG, XMLAGG, and XMLGROUP grouping functions. AVG,
STDDEV, STDDEV_SAMP, VARIANCE_SAMPand VAR_POP are calculated using combinations of COUNT
and SUM. If AVG, STDDEV, or VAR_POP are included in the MQT and regroup requires recalculation of
these functions, the MQT cannot be used. It is recommended that the MQT only use COUNT, SUM, MIN,
and MAX. If the query contains AVG, STDDEV, or VAR_POP, it can be recalculated using COUNT and SUM.
If FETCH FIRST N ROWS is specified in the MQT, then FETCH FIRST N ROWS must also be specified in
the query. Also, the number of rows specified for the MQT must be greater than or equal to the number of
rows specified in the query. It is not recommended that an MQT contain the FETCH FIRST N ROWS clause.
The ORDER BY clause on the MQT can be used to order the data in the MQT if a REFRESH TABLE is run. It
is ignored during MQT matching and if the query contains an ORDER BY clause, it is part of the rewritten
query.
Related reference
MQT supported function
Although an MQT can contain almost any query, the optimizer only supports a limited set of query
functions when matching MQTs to user specified queries. The user-specified query and the MQT query
must both be supported by the SQE optimizer.
The fields start and stop counting based on your situation, or the actions you are currently performing on
your system. A save and restore procedure does not reset the statistics counter if the MQT is restored
over an existing MQT. If an MQT is restored that does not exist on the system, the statistics are reset.
Related information
Retrieve member description (QUSRMBRD) command
The following is the initialization fullselect of the preceding query. It seeds the rows that start the
recursion process. It provides the initial destinations (arrival cities) that are a direct flight from Chicago or
New York.
The following is the iterative fullselect of the preceding query. It contains a single reference in the FROM
clause to the destination recursive common table expression. It also sources further recursive joins to
SELECT
r.departure, b.arrival, r.connects + 1 ,
r.cost + b.ticket
FROM destinations r, flights b
WHERE r.arrival=b.departure
The main query is the query that references the recursive common table expression or view. It is in the
main query where requests like grouping, ordering, and distinct are specified.
Implementation considerations
To implement a source for the recursion, a new temporary data object is provided called a queue. As rows
meet the requirements of either the initialization fullselect or the iterative fullselect, they are pulled up
through the union all. Values necessary to feed the continuing recursion process are captured and placed
in an entry on the queue: an enqueue operation.
At query runtime, the queue data source then takes the place of the recursive reference in the common
table expression or view. The iterative fullselect processing ends when the queue is exhausted of entries
or a fetch N rows limitation has been met. The recursive queue feeds the recursion process and holds
transient data. The join between dequeuing of these queue entries and the rest of the fullselect tables is
always a constrained join, with the queue on the left.
All rows coming out of the RCTE/View are part of the recursion process and need to be fed back in. When
there are multiple fullselects referencing the common table expression, the query is rewritten by the
optimizer to process all non-recursive initialization fullselects first. Then, using a single queue feed, those
same rows and all other row results are sent equally to the remaining iterative fullselects. No matter how
you order the initialization and iterative fullselects in the definition of the RCTE/view, the initialization
fullselects run first. The iterative fullselects share equal access to the contents of the queue.
Conversely, the following is an example where a local predicate applied to all the recursive results is a
good predicate to put in the body of the recursive definition because it could greatly decrease the number
of rows materialized from the RCTE/View. The better query request here is to specify the r.connects <=3
local predicate with in the RCTE definition, in the iterative fullselect.
Placement of local predicates is key in recursive queries. They can incorrectly alter the recursive results
if pushed into a recursive definition. Or they can cause unnecessary rows to be materialized and then
rejected, when a local predicate could legitimately help limit the recursion.
SELECT *
FROM destinations
ORDER BY depth_sequence
If the ORDER BY clause is not specified in the main query, the sequencing option is ignored. To facilitate
the correct sort there is additional information put on the queue entry during recursion. With BREADTH
FIRST, it is the recursion level number and the immediate ancestor join value, so sibling rows can
be sorted together. A depth first search is a little more data intensive. With DEPTH FIRST, the query
engine needs to represent the entire ancestry of join values leading up to the current row and put that
information in a queue entry. Also, because these sort values are not coming from an external data
source, the sort implementation is always a temporary sorted list (no indexes possible).
Do not use the SEARCH option if you do not need your data materialized in a depth or breadth first
manner. There is additional CPU and memory overhead to manage the sequencing information.
When a cycle is determined to be repeating, the output of that cyclic sequence of rows is stopped. To
check for a 'repeated' value however, the query engine needs to represent the entire ancestry of the join
For this query, the begin column of the period is inclusive, while the end column is exclusive. The history
table row(s) with the begin column value less than or equal to '2011-02-28-09.10.12.649592000000'
and the end column value greater than '2011-02-28-09.10.12.649592000000' will be included in the
result.
As a result Db2 rewrites the query as follows:
For this query, the begin column and end column of the period are exclusive. The history table row(s)
with the begin column value less than '9999-12-30-00.00.00.000000000000' and the end column value
greater than '0001-01-01-00.00.00.000000' will be included in the result.
As a result, Db2 rewrites the query as follows:
For this query, the begin column of the period is inclusive, while the end column is exclusive. The history
table row(s) with the begin column value less than or equal to '9999-12-30-00.00.00.000000000000'
and the end column value greater than '2011-02-28-09.10.12.649592000000' will be included in the
result.
As a result, Db2 rewrites the query as follows:
Query with time criteria specified via CURRENT TEMPORAL SYSTEM_TIME special
register.
The advantage of using this method is that you can change the time criteria later and not have to modify
the SQL. For example, assume that you want to retrieve data from policy_info for a given policy_id of C567
that is from one year ago. If the SYSTIME option is set to YES, you can set the CURRENT TEMPORAL
SYSTEM_TIME special register and issue the SELECT statement as follows:
For this query, the begin column of the period is inclusive, while the end column is exclusive. The history
table row(s) with the begin column value less than or equal to CURRENT TEMPORAL SYSTEM_TIME and
the end column value greater than CURRENT TEMPORAL SYSTEM_TIME will be included in the result.
As a result, Db2 rewrites the query as follows:
AQP example
Here is an example query with an explanation of how AQP could work.
The WHERE clause of the preceding query contains a predicate, t1.c3 = CURRENT DATE - t4.c3,
that is difficult to estimate. The estimation difficulty is due to the derivation applied to column t4.c3
and the derivation involving columns t4.c8 and t4.c9. For the purposes of this example, the predicate
t1.c3 = CURRENT DATE - t4.c3 actually eliminates all or nearly all records in the join.
Due to characteristics of the columns involved in that predicate, the statistical estimate has many rows
returned from the join. The optimizer selects join order t1, t3, t2, t4 based on the following record
count estimates.
• Join t1 to t3 produces 33,000,000 rows.
• Join t1, t3 result to t2 produces 1,300,000 rows.
• Join t1, t3, t2 result to t4 (final result set) produces 5 million rows.
The join order is reasonable assuming that the final result set actually produces 5 million rows, but the
estimate is incorrect. The query performs poorly since tables t1, t3, t2 are joined first, producing
1,300,000 rows. These rows are all rejected by table t4 and the t1.c3 = CURRENT DATE - t4.c3
predicate (join starvation).
AQP identifies t4 as the forced primary table. The optimizer would choose t1 as the second table in the
join order since there are no join conditions between t4 and t2 or t3. Since the join condition between
tables t4 and t1 selects few rows, this plan is likely many orders of magnitude faster than the original
plan.
Related reference
Adaptive Query Processing in Visual Explain
You can use Visual Explain to request a new plan.
SELECT a.orderkey,b.orderkey
FROM rvdstar/item_fact3 a, rvdstar/item_fact b
WHERE a.quarter – 8 = b.quarter
ORDER BY b.orderkey
Assume that an order by pushdown plan is chosen, then replaced using AQP while the query is running.
The following is an example of what the DB monitor records might look like. The columns shown for the
purposes of explaining the changes are QQRID, QQUCNT, QQSMINTF, and QQRCOD. The other fields in
the monitor are not affected by AQP processing.
In the example below, not only are you verifying certain user groups for access to particular patient
records but also masking certain data based on whether the patient has participated in a clinical trial.
Extra security is that physicians can see only patient records for whom they are the primary care provider.
ALTER TABLE PATIENT ACTIVATE ROW ACCESS CONTROL ACTIVATE COLUMN ACCESS CONTROL;
The query in the next example, before the introduction of RCAC policies would have accessed only the
PATIENT table. Now it accesses the PATIENT table and the supporting tables that are associated with the
row and column permissions.
The next graphic is the Visual Explain for the next example query. As you can see, the PATIENT table is
accessed along with any other tables mentioned in the ROW and COLUMN access control.
SELECT * FROM PATIENT WHERE PATIENTID = ?
You get the resulting index advice depicted in the next graphic that shows that it is not only over the
PATIENT table that is explicitly specified in the query, but also over the supporting RCAC tables.
To provide access to this materialized query table, an appropriate row permission can be created, or
an ALTER TABLE DEACTIVATE ROW ACCESS CONTROL on the materialized query table can be issued to
remove the row level protection if that is appropriate. If the query optimizer substitutes one or more
tables in a query with this materialized query table via MQT substitution, the row and column access
controls on the replaced (base) tables remain in effect, and the access controls, if any, on the materialized
query table do not apply.
results in no rows because it does not have its own RCAC policy and therefore it cannot expose rows per
the PATIENT table.
SELECT patientid, patientname, pharmacy FROM patient WHERE patientid>4 and diagnosis is not
null;
Row and column level access control does not affect the REFRESH TABLE statement. The table is
refreshed as if row and column level access controls do not exist.
The graphic below shows the Visual Explain that reflects the MQT match and substitution. Note that had
the MQT1 not surfaced a required value of PCPID for the existing RCAC SQL Rules, it would not be able to
satisfy the query request as an MQT match, even though that field is not in the required select list. In this
example Visual Explain, you can see the MQT1 substituted but also inherited the RCAC rules of the base
table PATIENT.
The following query, although it appears to be a match for the above MQT_AGG, will not substitute the
MQT per RCAC rules.
SELECT pcpid, count(*) FROM PATIENT WHERE pcpid in ( 1, ...) GROUP BY pcpid
All existing MQTs should be analyzed before deploying RCAC policy on base tables to make sure that
performance does not unexpectedly start to suffer because MQTs are no longer available to facilitate
the request.
Because most aggregating queries are not dealing with 'details' and so possibly less sensitive to the
requirements of RCAC, aggregating MQT over base tables with RCAC might be best deployed by direct
substitution in the query and restriction through table privileges and disabling the default RCAC rule,
restricting all rows, as follows.
This deactivates the default RCAC applied due to base tables with RCAC and allows direct access to the
MQT in a warehousing environment.
QSYS2.Health_Database_Overview ()
The QSYS2.Health_Database_Overview() procedure returns counts of all the different types of Db2 for i
objects within the target schema or schemas. The counts are broken down by object type and subtype.
Procedure definition:
CREATE PROCEDURE QSYS2.HEALTH_DATABASE_OVERVIEW(
IN ARCHIVE_OPTION INTEGER,
IN OBJECT_SCHEMA VARCHAR(258),
IN NUMBER_OF_ITEMS_ARCHIVE INTEGER,
IN OVERVIEW_SCHEMA VARCHAR(258),
IN OVERVIEW_TABLE VARCHAR(258))
DYNAMIC RESULT SETS 1
LANGUAGE C
SPECIFIC QSYS2.HEALTH_DATABASE_OVERVIEW
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QSYS/QSQHEALTH(OVERVIEW)'
PARAMETER STYLE SQL;
IBM i release
This procedure was added to IBM i in V5R4M0.
Parameters
Archive_Option (Input) The type of operation to perform for the Db2 for i Health Center
overview detail.
The supported values are:
• 1 = Query only, no archive action is taken
• 2 = Archive only
• 3 = Create archive and archive
• 4 = Query the archive
Note: Option 1 produces a new result set. Options 2 and 3 simply use the
results from the last Query option. Option 3 fails if the archive exists.
Object_Schema (Input) The target schema or schemas for this operation. A single schema
name can be entered. The ‘%' character can be used to direct the
procedure to process all schemas with names that start with the same
characters which appear before the ‘%'. When this parameter contains
only the ‘%' character, the procedure processes all schemas within the
database.
Number_Of_Items_Archive (Input) The number of rows to archive.
The archive can be used to recognize trends over time. To have meaningful
historical comparisons, choose the row count size carefully. This argument
is ignored if the Archive_Option is 1.
Overview_Table (Input) The table that contains the database overview archive.
This argument is ignored if the Archive_Option is 1.
Authorities
To query an existing archive, *USE object authority is required for the Overview_Schema and
Overview_Table. To create an archive, *CHANGE object authority is required for the Overview_Schema.
To add to an existing archive, *CHANGE object authority is required for the Overview_Table and *USE
object authority is required for the Overview_Schema.
Result Set
When Archive_Option is 1 or 4, a single result set is returned.
The format of the result is as follows.
QSYS2.Health_Database_Overview () result set format:
Error Messages
Table 34. Error messages
Message ID Error Message Text
SQL0462 W This warning appears in the job log if the procedure encounters objects for
which the user does not have *USE object authority. The warning is provided as
an indication that the procedure was unable to process all available objects.
Usage Notes
None
Related Information
None
Examples
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer
information” on page 1311.
Example 1
Retrieve the overview for the entire database.
Example 3
Retrieve the overview from MYLIB/ARCHIVE1.
Procedure definition:
CREATE PROCEDURE QSYS2.HEALTH_ACTIVITY(
IN ARCHIVE_OPTION INTEGER,
IN REFRESH_CURRENT_VALUES INTEGER,
IN OBJECT_SCHEMA VARCHAR(258),
IN OBJECT_NAME VARCHAR(258),
IN NUMBER_OBJECTS_ACTIVITY_TO_ARCHIVE INTEGER,
IN NUMBER_OF_ACTIVITY_ARCHIVE INTEGER,
IN ACTIVITY_SCHEMA VARCHAR(258),
IN ACTIVITY_TABLE VARCHAR(258))
DYNAMIC RESULT SETS 1
LANGUAGE C
SPECIFIC QSYS2.HEALTH_ACTIVITY
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QSYS/QSQHEALTH(ACTIVITY)'
PARAMETER STYLE SQL;
IBM i release
This procedure was added to IBM i 6.1.
Parameters
Archive_Option (Input) The type of operation to perform for the Db2 for i Health
Center overview detail.
Refresh_Current_Values (Input) This option directs how the archive operation is done.
This option is only valid with archive options 2 and 3.
The supported values are:
• 0 = No. Indicates that we capture the activity on the entire set
of specified schemas and objects.
• 1 = Yes. Indicates that we only refresh the activity of the
objects previously captured (based on the short names).
• 2 = None. Use the results from the prior call. A call must have
been performed in this job before using this option
Object_Name (Input) The target object name for this operation. Only the ‘%'
character is treated as a wildcard since an underscore is a valid
character in a name. The name must be delimited, if necessary,
and case sensitive.
This name also affects the items refreshed if
Refresh_Current_Values = 1.
Activity_Schema (Input) The table that contains the database activity archive.
This argument is ignored if the Archive_Option is 1.
Result Set
When Archive_Option is 1 or 4, a single result set is returned.
The format of the result is as follows. All these items were added for IBM i 6.1.
QSYS2.Health_Activity() result set format:
Limit Detail
The supported Database Health Center Activity can be seen on any machine by executing this query. The
supported value column contains zeros because this category of Health Center information is not tied to a
limit.
Table 35. Summary counts of database and SQL operations within a schema.
SIZING_ID SIZING_NAME SUPPORTED_VALUE
18100 INSERT OPERATIONS 0
18101 UPDATE OPERATIONS 0
18102 DELETE OPERATIONS 0
18103 LOGICAL READS 0
18104 PHYSICAL READS 0
18105 CLEAR OPERATIONS 0
Error Messages
Table 36. Error messages
Message ID Error Message Text
SQL0462 W This warning appears in the job log if the procedure encounters objects for
which the user does not have *USE object authority. The warning is provided as
an indication that the procedure was unable to process all available objects.
Usage Notes
None
Related Information
None
Example
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer
information” on page 1311.
Retrieve the activity information for all objects within the QSYS2 schema, using a maximum of 10 objects
per each activity.
Procedure definition:
CREATE PROCEDURE QSYS2.HEALTH_DESIGN_LIMITS(
ARCHIVE_OPTION INTEGER,
IN REFRESH_CURRENT_VALUES INTEGER,
IN OBJECT_SCHEMA VARCHAR(258),
IN OBJECT_NAME VARCHAR(258),
IN NUMBER_OBJECTS_LIMIT_TO_ARCHIVE INTEGER,
IN NUMBER_OF_LIMITS_ARCHIVE INTEGER,
IN LIMIT_SCHEMA VARCHAR(258),
IN LIMIT_TABLE VARCHAR(258),
DYNAMIC RESULT SETS 1
LANGUAGE C
SPECIFIC QSYS2.HEALTH_DESIGN_LIMITS
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QSYS/QSQHEALTH(DESIGN)'
PARAMETER STYLE SQL;
IBM i release
This procedure was added to IBM i V5R4M0.
Parameters
Archive_Option (Input) The type of operation to perform for the Db2 for i Health
Center activity detail.
The supported values are:
• 1 = Query only, no archive action is taken
• 2 = Archive only
• 3 = Create archive and archive
• 4 = Query the archive
Note: Option 1 produces a new result set. Options 2 and 3 simply
use the results from the last Query option. Option 3 fails if the
archive exists.
Refresh_Current_Values (Input) This option directs how the archive operation is done. This
option is only valid with archive options 2 and 3.
The supported values are:
• 0 = No. Indicates that we capture the activity on the entire set of
specified schemas and objects.
• 1 = Yes. Indicates that we only refresh the activity of the objects
previously captured (based on the short names).
• 2 = None. Use the results from the prior call. A call must have
been performed in this job before using this option
Object_Name (Input) The target object name for this operation. Only the ‘%'
character is treated as a wildcard since an underscore is a valid
character in a name. The name must be delimited, if necessary,
and case sensitive.
This name also affects the items refreshed if
Refresh_Current_Values = 1.
Number_Objects_Limit_to_Archive (Input) The number of objects to save for each design limit.
Number_Of_Limits_Archive (Input) The number of rows to save per object design limit.
The archive can be used to recognize trends over time. To have
meaningful historical comparisons, choose the row count size
carefully. This argument is ignored if the Archive_Option is 1 or
4.
Limit_Schema (Input) The schema that contains the database limit archive.
This argument is ignored if the Archive_Option is 1.
Authorities
To query an existing archive, *USE object authority is required for the Limit_Schema and Limit_Table.
To create an archive, *CHANGE object authority is required for the Limit_Schema. To add to an archive,
*CHANGE object authority is required for the Limit_Table.
When Archive_Option is 1 or 3, *USE object authority is required for the Object_Schema and for any
objects which are indicated by Object_Name. When an object is encountered and the caller does not have
*USE object authority, an SQL0462 warning is placed in the job log. The object is skipped and not included
in the procedure result set.
Result Set
When Archive_Option is 1 or 4, a single result set is returned.
The format of the result is as follows. All these items were added for IBM i V5R4M0.
QSYS2.Health_Design_Limits() result set format:
Limit Detail
The supported Database Health Center Design limits can be seen on any machine by executing this query:
Error Messages
Table 38. Error messages
Message ID Error Message Text
SQL0462 W This warning appears in the job log if the procedure encounters objects for
which the user does not have *USE object authority. The warning is provided as
an indication that the procedure was unable to process all available objects.
Usage Notes
None
Related Information
None
Example
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer
information” on page 1311.
QSYS2.Health_Size_Limits ()
The QSYS2.Health_Size_Limits () procedure returns detailed size information for database objects within
one or more schemas. Size limits help you understand trends towards reaching a database limit such as
‘Maximum size of the data in a table partition'.
Procedure definition:
CREATE PROCEDURE QSYS2.HEALTH_SIZE_LIMITS(
IN ARCHIVE_OPTION INTEGER,
IN REFRESH_CURRENT_VALUES INTEGER,
IN OBJECT_SCHEMA VARCHAR(258),
IN OBJECT_NAME VARCHAR(258),
IN NUMBER_OBJECTS_LIMIT_TO_ARCHIVE INTEGER,
IN NUMBER_OF_LIMITS_ARCHIVE INTEGER,
IN LIMIT_SCHEMA VARCHAR(258),
IN LIMIT_TABLE VARCHAR(258))
DYNAMIC RESULT SETS 1
LANGUAGE C
SPECIFIC QSYS2.HEALTH_SIZE_LIMITS
IBM i release
This procedure was added to IBM i V5R4M0.
Parameters
Archive_Option (Input) The type of operation to perform for the Db2 for i Health
Center activity detail.
The supported values are:
• 1 = Query only, no archive action is taken
• 2 = Archive only
• 3 = Create archive and archive
• 4 = Query the archive
Note: Option 1 produces a new result set. Options 2 and 3 simply
use the results from the last Query option. Option 3 fails if the
archive exists.
Refresh_Current_Values (Input) This option directs how the archive operation is done. This
option is only valid with archive options 2 and 3.
The supported values are:
• 0 = No. Indicates that we capture the activity on the entire set of
specified schemas and objects.
• 1 = Yes. Indicates that we only refresh the activity of the objects
previously captured (based on the short names).
• 2 = None. Use the results from the prior call. A call must have
been performed in this job before using this option
Object_Schema (Input) The target schema or schemas for this operation. A single
schema name can be entered. The ‘%' character can be used
to direct the procedure to process all schemas with names that
start with the same characters which appear before the ‘%'. When
this parameter contains only the ‘%' character, the procedure
processes all schemas within the database.
This name also affects the items refreshed if
Refresh_Current_Values = 1.
Object_Name (Input) The target object name for this operation. Only the ‘%'
character is treated as a wildcard since an underscore is a valid
character in a name. The name must be delimited, if necessary,
and case sensitive.
This name also affects the items refreshed if
Refresh_Current_Values = 1.
Limit_Schema (Input) The schema that contains the database activity archive.
This argument is ignored if the Archive_Option is 1.
Authorities
To query an existing archive, *USE object authority is required for the Limit_Schema and Limit_Table.
To create an archive, *CHANGE object authority is required for the Limit_Schema. To add to an archive,
*CHANGE object authority is required for the Limit_Table.
When Archive_Option is 1 or 3, *USE object authority is required for the Object_Schema and for any
objects which are indicated by Object_Name. When an object is encountered and the caller does not have
*USE object authority, an SQL0462 warning is placed in the job log. The object is skipped and not included
in the procedure result set.
Result Set
When Archive_Option is 1 or 4, a single result set is returned.
The format of the result is as follows.
QSYS2.Health_Size_Limits() result set format:
Table 39. Size limit information for database objects within a schema.
SIZING_ID SIZING_NAME SUPPORTED_VALUE
15000 MAXIMUM NUMBER OF ALL ROWS 4.29E+09
15001 MAXIMUM NUMBER OF VALID ROWS 4.29E+09
15002 MAXIMUM NUMBER OF DELETED ROWS 4.29E+09
15003 MAXIMUM TABLE PARTITION SIZE 1.7E+12
15004 MAXIMUM NUMBER OF OVERFLOW ROWS 4.29E+09
15101 MAXIMUM ROW LENGTH 32766
15102 MAXIMUM ROW LENGTH WITH LOBS 3.76E+09
15103 MAXIMUM NUMBER OF PARTITIONS 256
15150 MAXIMUM NUMBER OF REFERENCED TABLES 256
15300 MAXIMUM NUMBER OF TRIGGERS 300
15301 MAXIMUM NUMBER OF CONSTRAINTS 300
15302 MAXIMUM LENGTH OF CHECK CONSTRAINT 2097151
15400 MAXIMUM *MAX4GB INDEX SIZE 4.29E+09
15401 MAXIMUM *MAX1TB INDEX SIZE 1.7E+12
15402 MAXIMUM NUMBER OF INDEX ENTRIES 0
15500 MAXIMUM KEY COLUMNS 120
15501 MAXIMUM KEY LENGTH 32767
15502 MAXIMUM NUMBER OF PARTITIONING KEYS 120
15700 MAXIMUM NUMBER OF FUNCTION PARAMETERS 2000
15701 MAXIMUM NUMBER OF PROCEDURE PARAMETERS 2000
Error Messages
Table 40. Error messages
Message ID Error Message Text
SQL0462 W This warning appears in the job log if the procedure encounters objects for
which the user does not have *USE object authority. The warning is provided as
an indication that the procedure was unable to process all available objects.
Usage Notes
None
Related Information
None
QSYS2.Health_Environmental_Limits ()
The QSYS2.Health_Environmental_Limits() procedure returns detail on the top 10 jobs on the system,
for different SQL or application limits. The jobs do not have to be in existence. The top 10 information is
maintained within Db2 for i and gets reset when the machine is IPLed, the IASP is varied ON, or when the
QSYS2.Reset_Environmental_Limits() procedure is called.
Procedure definition:
CREATE PROCEDURE QSYS2.HEALTH_ENVIRONMENTAL_LIMITS(
IN ARCHIVE_OPTION INTEGER,
IN NUMBER_OF_LIMITS_ARCHIVE INTEGER,
IN LIMIT_SCHEMA VARCHAR(258),
IN LIMIT_TABLE VARCHAR(258))
DYNAMIC RESULT SETS 1
LANGUAGE C
SPECIFIC QSYS2.HEALTH_ENVIRONMENTAL_LIMITS
IBM i release
This procedure was added to IBM i 6.1.
Parameters
Archive_Option (Input) The type of operation to perform for the Db2 for i Health Center
activity detail.
The supported values are:
• 1 = Query only, no archive action is taken
• 2 = Archive only
• 3 = Create archive and archive
• 4 = Query the archive
Note: Option 1 produces a new result set. Options 2 and 3 simply use the
results from the last Query option. Option 3 fails if the archive exists.
Number_Of_Limits_Archive (Input) The number of rows to save per object health limit.
The archive can be used to recognize trends over time. To have meaningful
historical comparisons, choose the row count size carefully. This argument
is ignored if the Archive_Option is 1 or 4.
Limit_Schema (Input) The schema that contains the database activity archive.
This argument is ignored if the Archive_Option is 1.
Authorities
To query an existing archive, *USE object authority is required for the Limit_Schema and Limit_Table.
To create an archive, *CHANGE object authority is required for the Limit_Schema. To add to an archive,
*CHANGE object authority is required for the Limit_Table.
When Archive_Option is 1 or 3, *USE object authority is required for the Object_Schema and for any
objects which are indicated by Object_Name. When an object is encountered and the caller does not have
*USE object authority, an SQL0462 warning is placed in the job log. The object is skipped and not included
in the procedure result set.
Result Set
When Archive_Option is 1 or 4, a single result set is returned.
The format of the result is as follows. All these items were added for IBM i 6.1.
Limit Detail
The supported Database Health Center Environmental limits can be seen on any machine by executing
this query:
Error Messages
None
Usage Notes
None
Related Information
None
Example
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer
information” on page 1311.
Retrieve the SQL environmental limits for the current database.
Procedure definition:
CREATE PROCEDURE QSYS2.RESET_ENVIRONMENTAL_LIMITS(
LANGUAGE C
SPECIFIC QSYS2.RESET_ENVIRONMENTAL_LIMITS
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QSYS/QSQSSUDF(RESETENV)'
PARAMETER STYLE SQL;
IBM i release
This procedure was added to IBM i 6.1.
Parameters
None.
Authorities
This procedure requires the user to have *JOBCTL user special authority or be authorized to the
QIBM_DB_SQLADM Function through Application Administration in System i Navigator. The Change
Function Usage (CHGFCNUSG) command can also be used to allow or deny use of the function.
For example:
Result Set
None.
Error Messages
Table 42. Error messages
Message ID Error Message Text
SQL0552 Not authorized to PROCEDURE.
Usage Notes
None
Related Information
None
CALL QSYS2.RESET_ENVIRONMENTAL_LIMITS;
This command starts database monitoring for all jobs on the system. The performance statistics are
added to the member named MEMBER1 in the file named FILE1 in the QGPL library. 10 records are held
before being written to the file.
This command starts database monitoring for job number 134543. The job name is DSP01 and was
started by the user named QPGMR. The performance statistics are added to the member named
MEMBER2 in the file named FILE3. 20 records are held before being written to the file.
This command starts database monitoring for job number 134543. The job name is DSP01 and
was started by the user named QPGMR. The performance statistics are added to the member name
DBMONFILE (since OUTMBR was not specified) in the file named DBMONFILE in the library named LIB41.
This library could exist in more than one independent auxiliary storage pool (ASP); the library in the name
space of the originator's job is always used.
Example 4: Starting Public Monitoring For All Jobs That Begin With 'QZDA
This command starts database monitoring for all jobs that whose job name begins with 'QZDA'. The
performance statistics (monitor records) are added to member DBMONFILE (since OUTMBR was not
specified) in file DBMONFILE in library LIB41. This library could exist in more than one independent
auxiliary storage pool (ASP); the library in the name space of the originator's job is always used.
Example 5: Starting Public Monitoring and Filtering SQL Statements That Run Over 10 Seconds
This command starts database monitoring for all jobs. Monitor records are created only for those SQL
statements whose estimated run time meets or exceeds 10 seconds.
Example 6: Starting Public Monitoring and Filtering SQL Statements That Have an Estimated
Temporary Storage Over 200 MB
This command starts database monitoring for all jobs. Monitor records are created only for those SQL
statements whose estimated temporary storage meets or exceeds 200 MB.
This command starts database monitoring for the current job. Monitor records are created only for those
SQL statements that use file LIB41/TABLE1.
This command starts database monitoring for the current job. Monitor records are created only for those
SQL statements that are executed by the current user.
This command starts database monitoring for all jobs whose job name begins with 'QZDA'. Monitor
records are created only for those SQL statements that meet all the following conditions:
• The estimated run time, as calculated by the query optimizer, meets, or exceeds 10 seconds
• Was executed by user 'DEVLPR1'.
• Use any file whose name begins with 'TTT' and resides in library LIB41.
Example 10: Starting Public Monitoring and Filtering SQL Statements That Have Internet Address
'9.10.111.77'.
This command starts database monitoring for all jobs. Monitor records are created only for TCP/IP
database server jobs that are using the client IP version 4 address of '9.10.111.77'.
Example 11: Starting Public Monitoring and Filtering SQL Statements That Have a Port Number of
8471
This command starts database monitoring for all jobs. Monitor records are created only for TCP/IP
database server jobs that are using the local port number 8471.
Example 12: Starting Public Monitoring Based on Feedback from the Query Governor
CHGSYSVAL QQRYTIMLMT(200)
STRDBMON OUTFILE(LIB41/DBMONFILE) JOB(*ALL) FTRQRYGOVR(*COND)
This commands starts database monitoring for all jobs whose estimated run time is expected to exceed
200 seconds, based on the response to the query governor. In this example, data is collected only if the
query is canceled or a return code of 2 is returned by a query governor exit program. The query can be
canceled by a user response to the inquiry message CPA4259, issued because the query exceeded the
query governor limits. It can also be canceled by the program logic inside the registered query governor
exit program.
This command uses the database monitor pre-filter by Client Special Register Program ID to collect
monitor records for all the SQL statements executed by Interactive SQL (STRSQL command) usage.
Example 14: Starting Public Monitoring and Filtering SQL Statements Run From IBM i Access Client
Solutions Run SQL Scripts
This command starts database monitoring for all jobs. Monitor records are created only for those
statements where the client special register CLIENT APPLNAME is IBM i Access Client Solutions - RUN
SQL Scripts.
This command starts database monitoring for all jobs. Monitor records are created only for those
statements where the client special register CLIENT_PROGRAMID is cwbunnav.exe.
Example 16: Starting Public Monitoring and Filtering for the client user dbmusr1
This command starts database monitoring for all jobs. Monitor records are created only for those
statements where the client special register CLIENT_USERID is dbmusr1.
Example 17: Starting Public Monitoring and Filtering SQL Statements Using FTRUSER
This command starts database monitoring for all jobs. Monitor records are created only for those
statements where the user profile is logically equivalent to: User profile NOT LIKE 'STC%' AND user
profile NOT LIKE 'TSA%' AND (user profile LIKE 'S%' OR user profile LIKE 'TS%')
Related information
Start Database Monitor (STRDBMON) command
Restrictions
• If a specific job name and number or JOB(*) was specified on the Start Database Monitor
(STRDBMON) command, the monitor can only be ended by specifying the same job name and number or
JOB(*) on the ENDDBMON command.
• If JOB(*ALL) was specified on the Start Database Monitor (STRDBMON) command, the monitor
can only be ended by specifying ENDDBMON JOB(*ALL). The monitor cannot be ended by specifying
ENDDBMON JOB(*).
When monitoring is ended for all jobs, all the jobs on the system are triggered to close the database
monitor output table. However, the ENDDBMON command can complete before all the monitored jobs
have written their final statistic records to the log. Use the Work with Object Locks (WRKOBJLCK)
ENDDBMON JOB(*)
ENDDBMON JOB(*ALL)
This command ends the monitor open across all jobs on the system. If more than one monitor with
JOB(*ALL) is active, then the MONID parameter must also be specified to uniquely identify which specific
public monitor to end.
Example 3: End Monitoring for an Individual Public Monitor with MONID Parameter
This command ends the monitor that was started with JOB(*ALL) and that has a monitor ID of
061601001. Because there were multiple monitors started with JOB(*ALL), the monitor ID must be
specified to uniquely identify which monitor that was started with JOB(*ALL) is to be ended.
Example 4: End Monitoring for an Individual Public Monitor with MONID Parameter
ENDDBMON MONID(061601001)
This command performs the same function as the previous example. It ends the monitor that was started
with JOB(*ALL) or JOB(*) and that has a monitor ID of 061601001.
This command ends all monitors that are active across multiple jobs. It does not end any monitors open
for a specific job or the current job.
ENDDBMON JOB(QZDA*)
This command ends the monitor that was started with JOB(QZDA*). If more than one monitor with
JOB(QZDA*) is active, then the MONID parameter must also be specified to uniquely identify which
individual monitor to end.
This command ends the monitor that was started with JOB(QZDA*) and has a monitor ID of 061601001.
Because there were multiple monitors started with JOB(QZDA*), the monitor ID must be specified to
uniquely identify which JOB(QZDA*) monitor is to be ended.
Sample output of this query is shown in the following table. Key to this example are the join criteria:
Much data about many queries is contained in multiple rows in table LIB/PERFDATA. It is not uncommon
for data about a single query to be contained in 10 or more rows within the table. The combination of
defining the logical views and then joining the views together allows you to piece together all the data for
a query or set of queries. Column QQJFLD uniquely identifies all queries within a job; column QQUCNT is
unique at the query level. The combination of the two, when referenced in the context of the logical views,
connects the query implementation to the query statement information.
Table 43. Output for SQL Queries that Performed Table Scans
Lib Table Total Index Rows TOT_
Name Name Rows Advised Returned TIME Statement Text
LIB1 TBL1 20000 Y 10 6.2
SELECT * FROM LIB1/TBL1
WHERE FLD1 = 'A'
If the query does not use SQL, the SQL information row (QQQ1000) is not created. Without the SQL
information row, it is more difficult to determine which rows in LIB/PERFDATA pertain to which query.
When using SQL, row QQQ1000 contains the actual SQL statement text that matches the monitor rows to
the corresponding query. Only through SQL is the statement text captured. For queries executed using the
OPNQRYF command, the OPNID parameter is captured and can be used to tie the rows to the query. The
OPNID is contained in column Open_Id of row QQQ3014.
In this example, the output for all queries that performed table scans are shown in the following table.
Note: The columns selected from table QQQ1000 do return NULL default values if the query was not
executed using SQL. For this example assume that the default value for character data is blanks and the
default value for numeric data is an asterisk (*).
If the SQL statement text is not needed, joining to table QQQ1000 is not necessary. You can determine
the total time and rows selected from data in the QQQ3014 and QQQ3019 rows.
There are two slight modifications from the first example. First, the selected columns have been changed.
Most important is the selection of Index_Advised_Columns containing a list of possible key columns to
use when creating the suggested index. Second, the query selection limits the output to those table scan
queries where the optimizer advises that an index is created (A.Index_Advised = 'Y'). The following table
shows what the results might look like.
Determine whether it makes sense to create a permanent index as advised by the optimizer. In this
example, creating one index over LIB1/TBL1 satisfies all three queries since each use a primary or
left-most key column of FLD1. By creating one index over LIB1/TBL1 with key columns FLD1, FLD2, there
is potential to improve the performance of the second query even more. Consider how often these queries
are run and the overhead of maintaining an additional index over the table when deciding whether to
create the suggested index.
If you create a permanent index over FLD1, FLD2 the next sequence of steps is as follows:
1. Start the performance monitor again
2. Rerun the application
3. End the performance monitor
4. Re-evaluate the data.
It is likely that the three index-advised queries are no longer performing table scans.
SELECT COUNT(*)
FROM LIB.QQQ1000
WHERE Dynamic_Replan_Reason_Code <> 'NA'
2. What is the statement text and the reason for the dynamic replans?
Note: You need to refer to the description of column Dynamic_Replan_Reason_Code for definitions of
the dynamic replan reason codes.
3. How many indexes have been created over LIB1/TBL1?
SELECT COUNT(*)
FROM LIB.QQQ3002
WHERE System_Table_Schema = 'LIB1'
AND System_Table_Name = 'TBL1'
4. What key columns are used for all indexes created over LIB1/TBL1 and what is the associated SQL
statement text?
Note: This query shows key columns only from queries executed using SQL.
5. What key columns are used for all indexes created over LIB1/TBL1 and what was the associated SQL
statement text or query open ID?
Note: This query shows key columns from all queries on the system.
6. What types of SQL statements are being performed? Which are performed most frequently?
7. Which SQL queries are the most time consuming? Which user is running these queries?
Note: This example assumes that detail data was collected (STRDBMON TYPE(*DETAIL)).
9. Show the data for all SQL queries with the data for each SQL query logically grouped.
SELECT A.*
FROM LIB.PERFDATA A, LIB.QQQ1000 B
WHERE A.QQJFLD = B.Join_Column
Note: This might be used within a report that will format the interesting data into a more readable
format. For example, all reason code columns can be expanded by the report to print the definition of
the reason code. Physical column QQRCOD = 'T1' means that a table scan was performed because no
indexes exist over the queried table.
10. How many queries are implemented with temporary tables because a key length greater than 2000
bytes, or more than 120 key columns was specified for ordering?
SELECT COUNT(*)
FROM LIB.QQQ3004
WHERE Reason_Code = 'F6'
SELECT B.Statement_Text_Long
FROM LIB.QQQ3010 A, LIB.QQQ1000 B
WHERE A.Join_Column = B.Join_Column
AND A.ODP_Implementation = 'N';
12. What is the estimated time for all queries stopped by the query governor?
Note: This example assumes that detail data was collected (STRDBMON TYPE(*DETAIL)).
13. Which queries estimated time exceeds actual time?
SELECT A.Estimated_Processing_Time,
(A.Open_Time + B.Clock_Time_to_Return_All_Rows),
A.Open_Id, C.Statement_Text_Long
FROM LIB.QQQ3014 A LEFT OUTER JOIN LIB.QQQ3019 B
ON (A.Join_Column = B.Join_Column)
LEFT OUTER JOIN LIB.QQQ1000 C
ON (A.Join_Column = C.Join_Column)
WHERE A.Estimated_Processing_Time/1000 >
(A.Open_Time + B.Clock_Time_to_Return_All_Rows)
Note: This example assumes that detail data was collected (STRDBMON TYPE(*DETAIL)).
14. Should you apply a PTF for queries containing UNIONs? Yes, if any queries are performing UNIONs.
Do any of the queries perform this function?
SELECT COUNT(*)
FROM QQQ3014
WHERE Has_Union = 'Y'
Initial number Select to specify the number of records initially allocated for the monitor. The 'Initial
of records: number of records' option is used to pre-allocate storage to the database monitor
out file. When collecting large amounts of monitor records, this option improves the
collection performance by avoiding automatic storage extensions that occur as a file
grows in size.
Local port: Select to filter by port number. You can select a port from the list or else enter your own
port number.
Ports in the list include:
• 446 - DRDA/DDM
• 447 - DRDA/DDM
• 448 - Secure DRDA/DDM (SSL)
• 4402 - QXDAEDRSQL server
• 8471 - Database server
• 9471 - Secure database server (SSL)
Query Select to search for queries that have exceeded or are expected to exceed the query
Governor governor limits set for the system. Choose from the following options:
limits:
• Always collect information when exceeded
• Conditional collection of information when exceeded
On the Analysis Overview dialog, you can view overview information or else choose one of the following
categories:
• How much work was requested?
• What options were provided to the optimizer?
• What implementations did the optimizer use?
• What types of SQL statements were requested?
• Miscellaneous information
• I/O information
From the Actions menu, you can choose one of the following summary predefined reports:
User Contains a row of summary information for each user. Each row summarizes all SQL
summary activity for that user.
In addition, when a green check is displayed under Summary column, you can select that row and click
Summary to view information about that row type. Click Help for more information about the summary
report. To view information organized by statements, click Statements.
Minimum runtime for the Select to include statements that exceed a certain amount of time.
longest execution of the Select a number and then a unit of time.
statement:
Statements that ran on or Select to include statements run at a specified date and time. Select a
after this date and time: date and time.
Statements that reference Select to include statements that use or reference certain objects. Click
the following objects: Browse to select objects to include.
Statements that contain the Select to include only those statements that contain a specific type of
following text: SQL statement. For example, specify SELECT if you only want to include
statements that are using SELECT. The search is case insensitive for
ease of use. For example, the string 'SELECT' finds the same entries as
the search string 'select'.
Multiple filter options can be specified. In a multi-filter case, the candidate entries for each filter are
computed independently. Only those entries that are present in all the candidate lists are shown. For
example, if you specified options Minimum runtime for the longest execution of the statement and
Statements that ran on or after this date and time, you will be shown statements with the minimum
runtime that ran on or after the specified date and time.
Related reference
Index advisor
The query optimizer analyzes the row selection in the query and determines, based on default values, if
creation of a permanent index improves performance. If the optimizer determines that a permanent index
might be beneficial, it returns the key columns necessary to create the suggested index.
Importing a monitor
You can import monitor data that has been collected using some other interface by using System i
Navigator.
Monitors that are created using the Start Database Monitor (STRDBMON) command are
automatically registered with System i Navigator. They are also included in the list of monitors displayed
by System i Navigator.
To import monitor data, right-click SQL Performance monitors and select Import. Once you have
imported a monitor, you can analyze the data.
Index advisor
The query optimizer analyzes the row selection in the query and determines, based on default values, if
creation of a permanent index improves performance. If the optimizer determines that a permanent index
might be beneficial, it returns the key columns necessary to create the suggested index.
The optimizer is able to perform radix index probe over any combination of the primary key columns, plus
one additional secondary key column. Therefore it is important that the first secondary key column is
The graphic below shows the Index advice for the OR'd predicate columns:
The graphic below depicts the Visual Explain showing the implementation of merge bitmap
representation using the OR'd advice indexes:
Keys Advised Column names for the advised index. The order of the
column names is important. The names are listed in the
same order as in the CREATE INDEX SQL statement. An
exception is when the leading, order independent key
information indicates that the ordering can be changed.
Leading Keys Order Independent Leading, Order Independent keys. the keys at the beginning
of the KEY_COLUMNS_ADVISED field which could be
reordered and still satisfy the index being advised.
Index Type Advised Radix (default) or EVI
Last Advised for Query Use The timestamp representing the last time this index was
advised for a query.
Times Advised for Query Use The cumulative number of times this index has been advised.
This count ceases to increase once a matching permanent
index is created. The row of advice remains in this table until
the user removes it
Estimated Index Creation Time Estimated time in seconds to create this index.
Reason advised Reason why index was advised. Possible values are:
Row selection
Ordering/Grouping
Row selection and Ordering/Grouping
Logical Page Size Advised (KB) Recommended page size to be used on the PAGESIZE
keyword of the CREATE INDEX SQL statement when creating
this index.
Most Expensive Query Estimate Execution time in seconds of the longest running query
which generated this index advice.
Average of Query Estimates Average execution time in seconds of all queries that
generated this index advice.
Visual This option allows you to explain the query without actually running it. The data
Explain only displayed represents the estimate of the query optimizer.
Note: Some queries might receive an error code 93 stating that they are too complex
for displaying in Visual Explain. You can circumvent this error by selecting the "Run and
Explain" option.
Run and If you select Run and Explain, the query is run by the system before the diagram is
Explain displayed. This option might take a significant amount of time, but the information
displayed is more complete and accurate.
Explain while For long running queries, you can choose to start Visual Explain while the query is
running running. By refreshing the Visual Explain diagram, you can view the progress of the
query.
In addition, a database monitor table that was not created as a result of using System i Navigator can
be explained through System i Navigator. First you must import the database monitor table into System i
Navigator. To import, right-click the SQL Performance Monitors and choose the Import option. Specify a
name for the performance monitor (name it is known by within System i Navigator) and the qualified name
of the database monitor table. Be sure to select Detailed as the type of monitor. Detailed represents the
file-based (STRDBMON) monitor while Summary represents the memory-resident monitor (which is not
supported by Visual Explain). Once the monitor has been imported, follow the steps to start Visual Explain
from within System i Navigator.
You can save your Visual Explain information as an SQL Performance monitor. This monitor can be useful
if you started the query from Run SQL Scripts and want to save the information for later comparison.
Select Save as Performance monitor from the File menu.
Related information
Visual Explain (QQQVEXPL) API
Press the Apply or Refresh button to display the current Plan Cache statements. The information shown
includes the SQL query text, last time the query ran, most expensive single instance run, total processing
time consumed, total number of times run, and information about the user and job that first created the
plan entry.
The information also includes several per run averages, including average runtime, average result set size
and average temporary storage usage. There is an adjusted average processing time which is the average
discounting any anomalous runs.
Statement Options
By highlighting one or more plans and right clicking, a menu with several possible actions appears.
Visual Explain Shows a visual depiction of the access plan and provides more detailed performance
analysis. Note only one statement can be highlighted when performing this action.
Show Shows details of up to 10 of the longest running instances of that statement. Within the
Longest Longest Runs list, you can right click a statement and select Visual Explain, Work With SQL
Runs Statement, Work With SQL Statement and Variables, Save to New... snapshot or Remove.
Snapshots are useful for capturing the information for that specific run in Visual Explain.
Removing old or superfluous runs makes room to capture future runs. Only one statement
can be highlighted when performing these actions. Any runs removed only affect which runs
are shown in the list. The total time, total number of runs, and other information for the
statement are still calculated including the runs removed from the list.
Show Active Jobs Displays a list of jobs on the system that are currently using that statement or
statements.
Show User History Shows a list of all user IDs that have run that statement along with the last time
they ran it.
Work with SQL Displays a scripting window containing the SQL statement. The scripting window
Statement is useful for working with and tuning the statement directly, or for just viewing
the statement in its own window. Only one statement can be highlighted when
performing this action.
Work with SQL Statements Displays a scripting window containing the SQL Statement and any
and Variables parameter markers entered with their specific values for that run of the
SQL statement.
The User and Job Name for each statement on the Statements screen is the user and job that created
the initial plan with full optimization. This user is not necessarily the same as the last user to run that
statement. The Longest Runs screen, however, does show the particular user and job for that individual
run.
Minimum runtime for the Show statements with at least one long individual statement instance
longest execution of the runtime.
statement:
Statements that ran on or Show statements that have been run recently.
after this date and time:
Top 'n' most frequently run Show statements run most often.
statements:
Top 'n' statements with the Show the top resource consumers. Shows the first 'n' top statements by
largest total accumulated default when no filtering is given. Specifying a value for 'n' improves the
runtime: performance of getting the first screen of statements, though the total
statements displayed is limited to 'n'.
Statements the following Show statements a particular user has run. The user and job name shown
user has ever run: reflect the originator of the cached statement. This user is not necessarily
the same as the user specified on the filter (there could be multiple users
running the statement).
Statements that are Show statements that are still running or are in pseudo-close mode. The
currently active user and job name shown reflect the originator of the cached statement.
This user is not necessarily the same as the user specified on the filter
(there could be multiple users running the statement).
Note: An alternative for viewing the active statement for a job is to right-
click the Database icon and select SQL Details for Jobs...
Statements for which an Show only those statements where the optimizer advised an index to
index has been advised improve performance.
Statements for which Show only those statements where a statistic not yet collected might have
statistics have been been useful to the optimizer. The optimizer automatically collects these
advised statistics in the background. This option is normally not that interesting
unless, for whatever reason, you want to control the statistics collection
yourself.
Include statements Show the 'hidden' statements initiated by the database to process a
initiated by the operating request. By default the list only includes user-initiated statements.
system
Statements that reference Show statements that reference the tables or indexes specified.
the following objects:
Statements that contain Show statements that include the text specified. This option is useful
the following text: for finding particular types of statements. For example, statements with
a FETCH FIRST clause can be found by specifying ‘fetch'. The search is
not case sensitive for ease of use. For example, the string 'FETCH' finds
the same statements as the search string 'fetch'. This option provides a
wildcard search capability on the SQL text itself.
Multiple filter options can be specified. The candidate statements for each filter are computed
independently. Only those statements that are present in all the candidate lists are shown. For example,
Number of Query Full Opens Since Start Number of queries run since IPL that required a
cursor to be built before the query executed and
returned rows.
Maximum Plan Cache Size For AutoSizing If AutoSizing is active, the maximum plan cache
size.
This property is configurable if the Current® Plan
Cache Size Threshold is *AUTO.
• *DEFAULT(nn) - The database manager
determines, at IPL, the maximum size that the
plan cache can grow to under autosizing. Only
applicable if Size Threshold is set to *AUTO.
The database determined size is shown in
parentheses.
• nn – A user specified size between 50 and
51200. Size is specified in MB. While supported,
it should rarely be changed from *DEFAULT.
• *DISABLED - Indicates that plan cache auto
sizing has been disabled.
Current Plan Cache Hit Ratio The percentage of time the query optimizer found a
matching plan in the plan cache.
This value indicates the efficiency of the plan
cache. The higher the percentage the better.
Total Number of Plan Cache Autosizing If autosizing is active, the number of times the plan
Adjustments cache autosized. This includes both plan cache
increase and decrease.
Last Plan Cache AutoSizing Adjustment If autosizing is active, the timestamp when the
plan cache was last autosized.
Last Autosizing Limited Due to Temporary Storage If autosizing is active, the timestamp of when
the plan cache last attempted to increase the
size of the plan cache but was unable to do so
because the temporary storage used on the system
exceeded limits.
Current Number of Job Scoped (QTEMP) Plans Current number of plans in the plan cache that
for queries that reference tables or indexes that
reside in the job’s QTEMP library. This includes,
for example, global temporary tables. By definition
these job scoped plans and runtime objects cannot
be reused across jobs.
Total Number of Job Scoped (QTEMP) Plans Built Total number of plans built for queries that
Since Start reference tables or indexes that reside in the job’s
QTEMP library.
Total Number of Unique Queries With Job Scoped This value reflects the total number of unique
(QTEMP) References Since Start statements (SQL queries) referencing temporary
files that have been run since IPL.
Total Times Plans Used from Cache Total number of plans that were reused from
the plan cache. (i.e. Plans that did not require a
reoptimization).
Total Plans Pruned Total number of plans the plan cache pruner task
removed.
Number of Times Plan Cache Pruned Number of times that the plan cache pruner task
ran and removed plans from the plan cache.
Time Plan Cache was Last Pruned The timestamp of when the plan cache pruner task
last ran.
Current Number of Temporary Runtime Objects Current Number of Temporary Runtime Objects
Stored in Cache Stored in Cache
Current Total Size of Temporary Runtime Objects Current Total Size of Temporary Runtime Objects
stored in Cache stored in Cache
Maximum Number of Temporary Runtime Objects Maximum number of Temporary Runtime Objects
Stored Per Plan stored per plan.
This property is configurable.
• *DEFAULT(nn) - database determines the
maximum number of runtime objects (ROQs) to
keep per plan. The database determined number
is shown in parentheses.
• nn – A user specified value between 1 and
50 that is the maximum number of runtime
objects to keep per plan. A runtime ‘object’ is
all the runtime constructs (except the cursor)
used to execute the query. It includes the
ROQ, hash tables, sorts, etc… The database will
automatically clear big hash tables and sorts of
data contents (leaving only their shell) before
storing them with the plan. However, smaller
hashes and sorts will retain their contents.
Setting this value smaller will lessen the
temporary storage usage on the machine. Setting
this value higher can improve performance by
having more runtime objects ready to go during
full opens rather than having to build them.
Total Number of Temporary Indexes Created Total number of SQE created temporary indexes
(MTIs) since IPL.
Activity Thresholds Start Time The time from which the tracking started. This
value can be reset (to zero) to reset all the
thresholds and restart tracking.
Note: All thresholds are reset at one time,
thresholds cannot be reset individually. Start Time
restarts each IPL.
Highest Number of Active Queries at One Time The highest number of open plus pseudo closed
cursors (queries) at a given point in time
Highest Number of Plans in Cache The largest number of plans in the plan cache at a
given point in time
Query Supervisor
The Query Supervisor group of properties provide
historical information about the interaction of the
Query Supervisor with queries running on the
system.
CALL qsys2.dump_plan_cache('QGPL','SNAPSHOT1');
CLEAR_PLAN_CACHE
The CLEAR_PLAN_CACHE procedure is a plan cache clearing alternative to performing a system IPL.
CLEAR_PLAN_CACHE procedure
>>-CLEAR_PLAN_CACHE --()----------------------------------><
Display Job You can use the Display Job (DSPJOB) command with the OPTION(*OPNF)
(DSPJOB) parameter to show the indexes and tables used by an application running in a job.
You can also use DSPJOB with the OPTION(*JOBLCK) parameter to analyze object
and row lock contention. It displays the objects and rows that are locked and the
name of the job holding the lock.
Specify the OPTION(*CMTCTL) parameter on the DSPJOB command to show the
isolation level, the number of rows locked during a transaction, and the pending
DDL functions. The isolation level displayed is the default isolation level. The actual
isolation level, used for any SQL program, is specified on the COMMIT parameter of
the CRTSQLxxx command.
Print SQL The Print SQL Information (PRTSQLINF) command lets you print
Information information about the embedded SQL statements in a program, SQL package, or
(PRTSQLINF) service program. The information includes the SQL statements, access plans used,
and the command parameters used to precompile the source member.
Start Database You can use the Start Database Monitor (STRDBMON) command to capture
Monitor to a file information about every SQL statement that runs.
(STRDBMON)
Change Query You can use the Change Query Attribute (CHGQRYA) command to change
Attribute the query attributes for the query optimizer. Among the attributes that can be
(CHGQRYA) changed by this command are the predictive query governor, parallelism, and the
query options.
Start Debug You can use the Start Debug (STRDBG) command to put a job into debug
(STRDBG) mode, and optionally add as many as 20 programs, 20 class files, and 20 service
programs to debug mode. It also specifies certain attributes of the debugging
session. For example, it can specify whether database files in production libraries
can be updated while in debug mode.
Related information
Display Job (DSPJOB) command
Print SQL Information (PRTSQLINF) command
Start Database Monitor (STRDBMON) command
Change Query Attributes (CHGQRYA) command
Start Debug (STRDBG) command
STRDBG places in the job log information about all SQL statements that run.
Each time the SELFCODES global variable is set, the new list of SQLCODE values replaces any SQLCODEs
that were previously being used.
Setting SELFCODES for all user jobs
When a job first uses SQL, its value for the SELFCODES global variable is assigned using the default value
specified for the SELFCODES global variable. When the default is changed, it will apply to jobs that start
after the change is made.
To change the default for the SELFCODES global variable, use the CREATE OR REPLACE VARIABLE SQL
statement. Note that the data type of the global variable must remain VARCHAR(256).
To find all entries where the same error has occurred for the same statement in the same program, the
following query can be used.
SELF example
This example shows how SELF can be used to capture point-of-failure detail for SQL statements that are
failing because they cannot acquire the necessary locks and for SQL statements that are failing due to
lack of authority. The SQLCODEs the example will capture details for are:
• SQLCODE -913 : Row or object &1 in &2 type *&3 in use.
• SQLCODE +551 : Not authorized to object &1 in &2 type *&3.
• SQLCODE -551 : Not authorized to object &1 in &2 type *&3.
• SQLCODE +552 : Not authorized to &1.
• SQLCODE -552 : Not authorized to &1.
Step 1. Build a SELF control string
Use the VALIDATE_SELF scalar function to confirm that the SELF control string is well-formed.
SELECT *
FROM QSYS2.SQL_ERROR_LOG
WHERE LOGGED_SQLCODE IN (551, 552, -551, -552, -913)
ORDER BY LOGGED_TIME DESC;
The following query can be used to examine the stack at the point of failure for every -551 authorization
failure for a DELETE statement.
WITH SELF_ROWS AS (SELECT ROW_NUMBER() OVER() AS INSTANCE, LOG.* FROM QSYS2.SQL_ERROR_LOG LOG
WHERE LOGGED_SQLCODE = -551 AND
STATEMENT_OPERATION = 'DL')
CRTDUPOBJ OBJ(QAQQINI)
FROMLIB(QSYS)
OBJTYPE(*FILE)
TOLIB(MYLIB)
DATA(*YES)
TRG(*YES)
System-supplied triggers are attached to the QAQQINI file in QSYS therefore it is imperative that the only
means of copying the QAQQINI file is through the CRTDUPOBJ CL command. If another means is used,
such as CPYF, then the triggers could be corrupted. An error is signaled that the options file cannot be
retrieved or that the options file cannot be updated.
Because of the trigger programs attached to the QAQQINI file, the following CPI321A informational
message is displayed six times in the job log when the CRTDUPOBJ CL is used to create the file. These
messages are not an error; they are only informational messages.
CPI321A Information Message: Trigger QSYS_TRIG_&1___QAQQINI___00000&N in library &1 was
added to file QAQQINI in library &1. The ampersand variables (&1, &N) are replacement variables that
contain either the library name or a numeric value.
Note: It is highly recommended that the file QAQQINI, in QSYS, not be modified. This file is the original
template that is duplicated into QUSRSYS or a user specified library for use.
Related information
Change Query Attributes (CHGQRYA) command
Create Duplicate Object (CRTDUPOBJ) command
A UNIQUE
A R QAQQINI TEXT('Query options + file')
A QQPARM 256A VARLEN(10) +
TEXT('Query+
option parameter') +
COLHDG('Parameter')
A QQVAL 256A VARLEN(10) +
TEXT('Query option +
parameter value') +
COLHDG('Parameter Value')
A QQTEXT 1000G VARLEN(100) +
TEXT('Query +
option text') +
ALWNULL +
COLHDG('Query Option' +
'Text') +
CCSID(13488) +
DFT(*NULL)
A K QQPARM
To delete an existing row in MyLib/QAQQINI use the DELETE SQL statement. This example removes the
QUERY_TIME_LIMIT row from the QAQQINI file:
To insert a new row into MyLib/QAQQINI use the INSERT SQL statement. This example adds the
QUERY_TIME_LIMIT row with a value of *NOMAX to the QAQQINI file:
ACTIVE_JOBS The number of active jobs that will be used by the query
This option specifies what should be used for active jobs during optimizer to determine fair share. Specify a value between 1
optimization. The number of active jobs is used in determining the and 8192. Specifying a value other than default means that you
Integer value (1 ::
optimizer fair share of memory. may not get all of the performance benefits from the optimizer
8192)
determining a plan using the memory fair share based on actual
system usage. Usage of this setting is intended primarily for
debug or modeling query plans based on an optimizer fair share.
*NO Encoded vector index RRN probes cannot replace table access.
The CHGQRYA attributes for the job are not applied to the remote
*NO jobs. The remote jobs use the attributes associated to them on
APPLY_REMOTE their systems.
Specifies for database queries involving distributed files, whether
the CHGQRYA query attributes are applied to the jobs on the The query attributes for the job are applied to the remote jobs
remote systems associated with this job. used in processing database queries involving distributed tables.
For attributes where *SYSVAL is specified, the system value
*YES
on the remote system is used for the remote job. This option
requires that, if CHGQRYA was used for this job, the remote jobs
must have authority to use the CHGQRYA command.
Only force the join order for those queries that use the SQL JOIN
*SQL syntax. This option mimics the behavior for the optimizer before
FORCE_JOIN_ORDER V4R4M0.
Specifies to the query optimizer that the join of files is to occur in Only force the join position for the file listed by the numeric
the order specified in the query. *PRIMARY value nnn into the primary position (or dial) for the join. nnn is
nnn optional and defaults to 1. The optimizer then determines the
join order for all the remaining files based upon cost.
LIMIT_PREDICATE_ OPTIMIZATION Do not eliminate the predicates that are not simple isolatable
*DEFAULT
predicates (OIF) when doing index optimization. Same as *NO.
Specifies that the query optimizer can only use simple isolatable
predicates (OIF) when performing its index optimization. Do not eliminate the predicates that are not simple isolatable
*NO
An OIF is a predicate that can eliminate a record without further predicates (OIF) when doing index optimization.
evaluation. Any predicate that cannot be classified as an OIF is
Eliminate the predicates that are not simple isolatable
ignored by the optimizer and needs to be evaluated as a non-key
predicates (OIF) when doing index optimization.
selection predicate.
A=10 and (A => 10 AND B=9) are OIFs. *YES
A=10 OR B=9 are not OIFs.
Note: *YES impairs or limits index optimization.
LOB_LOCATOR_THRESHOLD If the value is 0, then the database does not free locators. For
values 1 through 250,000, on a FETCH request, the database
Specifies either *DEFAULT or an Integer Value -- the threshold to compares the SQL current LOB locator count for the job against
free eligible LOB locators that exist within the job. Integer Value the threshold value. If the locator count is greater than or equal
to the threshold, the database frees host server created locators
that have been retrieved. This option applies to all host server
jobs (QZDASOINIT) and has no impact to other jobs.
Paging is done in the pool of the job. This option is normal paging
*JOB
behavior.
All queries are optimized with the goal of returning the first page
of output as fast as possible. This option works well when the
*FIRSTIO output is controlled by a user likely to cancel the query after
OPTIMIZATION_GOAL viewing the first page of data. Queries coded with OPTIMIZE
Specifies the goal that the query optimizer uses when making FOR nnn ROWS honor the goal specified by the clause.
costing decisions.
All queries are optimized with the goal of running the entire
query to completion in the shortest amount of elapsed time. This
option is better when the output of a query is written to a file
*ALLIO
or report, or the interface is queuing the output data. Queries
coded with OPTIMIZE FOR nnn ROWS honor the goal specified
by the clause.
2. Symmetric Multiprocessing (SMP). SMP assigns both CPU and Like *OPTIMIZE, with the value nnn indicating a percentage
I/O processing to tasks that run the query in parallel. Actual from 1 to 200, used to influence the number of tasks. If not
CPU parallelism requires a system with multiple processors. specified, 100 is used.
SMP can only be used if the system feature, Db2 Symmetric
Multiprocessing, is installed. Use of SMP parallelism can The query optimizer determines the parallel degree for the
affect the order in which records are returned. *OPTIMIZE query using the same processing as is done for *OPTIMIZE.
nnn Once determined, the optimizer adjusts the actual parallel
degree used for the query by the percentage given.
Allows the user to override the parallel degree used
without having to specify a particular parallel degree under
*NUMBER_OF_TASKS.
PARALLEL_DEGREE (continued) *NONE No parallel processing is allowed for database query processing
or database table index build, rebuild, or maintenance.
*NUMBER_ Indicates the maximum number of tasks that can be used for a
OF _TASKS single query. The number of tasks is limited to either this value
nnn or the number of disk arms associated with the table.
Not recommended if running SQE. The SQE optimizer attempts
to use this degree and override many of the normal costing
mechanisms. For SQE, use *OPTIMIZE with a percentage.
*MAX xxx Like *MAX, with the value xxx indicating the ability to specify
an integer percentage value 1 - 200. The query optimizer
determines the parallel degree for the query using the same
processing as is done for *MAX. Once determined, the optimizer
adjusts the actual parallel degree used for the query by
the percentage given. This option provides the user the
ability to override the parallel degree used to some extent
without having to specify a particular parallel degree under
*NUMBER_OF_TASKS.
The query time limit for this job is obtained from the system
*SYSVAL
value, QQRYTIMLMT.
QUERY_TIME_LIMIT
Specifies a time limit for database queries allowed to be started *NOMAX There is no maximum number of estimated elapsed seconds.
based on the estimated number of elapsed seconds that the query
Specifies the maximum value that is checked against the
requires to process.
estimated number of elapsed seconds required to run a
integer value query. If the estimated elapsed seconds are greater than this
value, the query is not started. Valid values range from 0 to
2,147,352,578.
Specifies whether to allow IGC constants to always be treated as *YES SQL IGC constants are treated as IGC-OPEN constants.
IGC-OPEN in SQL queries.
If the data in the IGC constant only contains shift-out DBCS-data
Note: When *NO is specified, Db2 for i is not compatible with the *NO shift-in, then the constant are treated as IGC-ONLY, otherwise it
other Db2 platforms. is treated as IGC-OPEN.
Specifies how the delete is implemented by the database This value forces the database manager to never attempt to fast
*NONE
manager. This value is used when processing a DELETE FROM delete on the rows.
table-name SQL statement without a WHERE clause.
*OPTIMIZE This value is same as using *DEFAULT.
Specifying a value for this option allows the user to tune the
behavior of DELETE. The target table for the DELETE statement
must match or exceed the number of rows specified on the
Integer Value option for fast delete to be attempted. A fast delete does not
write individual rows into a journal.
The valid values are 1 - 999,999,999,999,999.
Specifies the compression maximum setting, which is used when The integer value represents the number of times that a
statements are prepared into a package. statement is compressed before the access plan is removed to
Integer Value create more space in the package. Executing the SQL statement
resets the count for that statement to 0. The valid Integer values
are 1 - 255.
For SQL statements, this parameter provides the ability to *YES Warnings:
suppress SQL warnings. • SQL0030
• SQL0335
• SQL0387
• SQL7909 (on a DROP PROCEDURE/ROUTINE/FUNCTION)
Specifies the time zone to apply to any date or dateTime value • s is the sign, + or –
specified in an XML text search using the CONTAINS or SCORE • HH is the hour
function. The time zone is the offset from UTC (Greenwich mean
sHH:MM • MM is the minute
time. It is only applicable when a specific time zone is not given for
the value. The valid range for HH is 00 - 23. The valid range for MM is 00
- 59. The format is specific. All values are required, including
sign. If HH or MM is less than 10, it must have a leading zero
specified.
Note: The following QAQQINI options will be ignored for SQE native query access. These options were
previously honored for CQE native query access.
• LIMIT_PREDICATE_OPTIMIZATION
• STAR_JOIN
• UDF_TIME_OUT
Related information
XML values
SQL statements and SQL/XML functions
Query Supervisor
The Db2 for i SQL Query Engine (SQE) provides a Query Supervisor which enables real-time monitoring of
resource consumption by SQL and native queries, for example the Open Query File (OPNQRYF) command.
Query Supervisor threshold levels can be established for general or specific scenarios. When a threshold
is met or exceeded, the query execution is interrupted, and user-supplied exit program(s) are called.
Summary information about the Query Supervisor’s behavior is available in the SQE Plan Cache Properties
which are accessed with the IBM i Access Client Solutions (ACS) SQL Performance Center. The properties
can also be retrieved using “DUMP_PLAN_CACHE_PROPERTIES procedure” on page 359. The properties
show the number of times since the last IPL that a Query Supervisor threshold has been reached along
with the most recent job and time that the threshold was reached. Similar information is provided for the
most recent instance of a Query Supervisor exit program that directed SQE to terminate a query. Finally, if
there is a problem with the configuration or execution of an exit program, the most recent job and time of
the failure is noted.
These Query Supervisor metrics are provided to give the database engineer (DBE) a basic understanding
of whether thresholds are being encountered, whether queries are being terminated, and whether any
exit program failures exist. The following figure illustrates the query supervision summary metrics.
If CRTRPGMOD and CRTPGM are used to compile and build the program, be sure to include
USRPRF(*OWNER) and ACTGRP(*CALLER) on the CRTPGM command.
The program can be registered as an exit program using this command:
By including the THREAD, USRPRF, DFTACTGRP, and ACTGRP options in the source, they can be omitted
on the compiler command. By using USRPRF(*OWNER), *PUBLIC does not need to be given access to
the objects used by this program. The owning profile of the created program must have authority to the
commands and objects used by the exit program. The program uses THREAD(*CONCURRENT) to ensure
thread safety. The program will run in the activation group of the caller.
**free
ctl-opt main(QS_sendmsg);
ctl-opt ccsid(*char : *jobrun);
ctl-opt thread(*concurrent);
/if defined(*crtbndrpg)
ctl-opt usrprf(*owner);
ctl-opt dftactgrp(*no);
ctl-opt actgrp(*caller);
/endif
//************************************************************************
// Init the return code to continue running the query
//************************************************************************
rc = 0;
cmdstr =
'SBMJOB CMD(RUNSQL SQL(''call qsys2.send_message(''''SQL7064'''', '
+ %char(%len(msg)) + ' ,'''''+ msg + ''''')''))';
return;
end-proc;
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <iconv.h>
#include <stdio.h>
#include <eqqqrysv.h>
memset(from_code, 0, sizeof(from_code));
memset(to_code, 0, sizeof(to_code));
memcpy(from_code, "IBMCCSID012000000000", 20);
memcpy(to_code, "IBMCCSID00000", 13);
converter = iconv_open(to_code, from_code);
if (converter.return_value == 0) {
input_bytes = 60;
output_bytes = 30;
iconv_rc = iconv(converter,
&input, &input_bytes,
&output, &output_bytes);
iconv_close(converter);
if (iconv_rc >= 0)
return; /* Conversion was successful. */
}
return len;
}
/************************************************************************/
int main(int argc, char* argv[])
{
char length_string[10];
char cmd[600];
char thresholdNameInJobCCSID[30];
char msg[512];
memset(thresholdNameInJobCCSID, 0, sizeof(thresholdNameInJobCCSID));
convertThresholdNameToJobCCSID(input->Threshold_Name,
memset(msg, 0, sizeof(msg));
strcat(msg,"QUERY SUPERVISOR THRESHOLD ");
strncat(msg, thresholdNameInJobCCSID, 30);
strcat(msg," REACHED IN JOB ");
strncat(msg, input->Job_Number, trimmed_length(input->Job_Number,6));
strcat(msg, "/");
strncat(msg, input->Job_User, trimmed_length(input->Job_User,10));
strcat(msg, "/");
strncat(msg, input->Job_Name, trimmed_length(input->Job_Name,10));
memset(length_string, 0, sizeof(length_string));
sprintf(length_string,"%d",strlen(msg));
/************************************************************************/
/* Use the SQL service send_message to send the message to QSYSOPR. */
/* SQL cannot be run within the exit program, so submit to batch. */
/************************************************************************/
memset(cmd, 0, sizeof(cmd));
strcat(cmd, "SBMJOB CMD(RUNSQL SQL('call qsys2.send_message(''SQL7064'',");
strcat(cmd,length_string);
strcat(cmd,",''");
strcat(cmd, msg);
strcat(cmd, "'')'))");
system(cmd);
}
By using USRPRF(*OWNER), *PUBLIC does not need to be given access to the objects used by this
program. The owning profile of the created program must have authority to the commands and objects
used by the exit program. The program will run in the activation group of the caller.
MONMSG MSGID(CPF0000)
/* INIT RETURN CODE TO CONTINUE RUNNING QUERY */
CHGVAR VAR(&RC) VALUE(0)
ENDPGM
If CRTRPGMOD and CRTPGM are used to compile and build the program, be sure to include
USRPRF(*OWNER) and ACTGRP(*CALLER) on the CRTPGM command.
The program can be registered as an exit program using this command:
By including the THREAD, USRPRF, DFTACTGRP, and ACTGRP options in the source, they can be omitted
on the compiler command. By using USRPRF(*OWNER), *PUBLIC does not need to be given access to
the objects used by this program. The owning profile of the created program must have authority to the
commands and objects used by the exit program. The program uses THREAD(*CONCURRENT) to ensure
thread safety. The program will run in the activation group of the caller.
**free
ctl-opt main(QS_endqry);
ctl-opt ccsid(*char : *jobrun);
ctl-opt thread(*concurrent);
/if defined(*crtbndrpg)
ctl-opt usrprf(*owner);
ctl-opt dftactgrp(*no);
ctl-opt actgrp(*caller);
/endif
//************************************************************************
// Init the return code to continue running the query
//************************************************************************
rc = 0;
#include <string.h>
return 0;
}
By using USRPRF(*OWNER), *PUBLIC does not need to be given access to the objects used by this
program. The owning profile of the created program must have authority to the commands and objects
used by the exit program. The program will run in the activation group of the caller.
MONMSG MSGID(CPF0000)
/* INIT RETURN CODE TO CONTINUE RUNNING QUERY */
CHGVAR VAR(&RC) VALUE(0)
/* SET UNICODE HEX VALUE FOR THE THRESHOLD NAMED "TERMINATE" */
CHGVAR VAR(&TERMINATE) +
VALUE(X'005400450052004D0049004E004100540045')
/* VALUE FOR ONE HOUR OF ELAPSED TIME */
CHGVAR VAR(&ONEHOUR) VALUE(60 * 60)
ENDPGM
ILE RPG exit program to dump plan cache information for query
This Query Supervisor exit program dumps plan cache information about the query that reached a
threshold.
To compile this ILE RPG program, use the following command. Before compiling, the sample source must
be modified as indicated by the comment in the code. The USER parameter on the SBMJOB command
must name a profile on the system that has the required authority to call QSYS2.DUMP_PLAN_CACHE().
This authority is *JOBCTL special authority or QIBM_DB_SQLADM function usage. In addition, the owner
of the QS_DMPQRY program must have *USE authority to the profile specified on the USER parameter.
One option is to make USER the same as the program owner.
If CRTRPGMOD and CRTPGM are used to compile and build the program, be sure to include
USRPRF(*OWNER) and ACTGRP(*CALLER) on the CRTPGM command.
The program can be registered as an exit program using this command:
By including the THREAD, USRPRF, DFTACTGRP, and ACTGRP options in the source, they can be omitted
on the compiler command. By using USRPRF(*OWNER), *PUBLIC does not need to be given access to
the objects used by this program. The owning profile of the created program must have authority to the
commands and objects used by the exit program. The program uses THREAD(*CONCURRENT) to ensure
thread safety. The program will run in the activation group of the caller.
**free
ctl-opt main(QS_dmpqry);
ctl-opt ccsid(*char : *jobrun);
ctl-opt thread(*concurrent);
/if defined(*crtbndrpg)
ctl-opt usrprf(*owner);
ctl-opt dftactgrp(*no);
ctl-opt actgrp(*caller);
/endif
//************************************************************************
// Init the return code to continue running the query
//************************************************************************
rc = 0;
cmdstr =
'SBMJOB CMD(RUNSQL SQL(''call qsys2.dump_plan_cache('
+ 'FILESCHEMA => ''''SUPERVISOR'''', FILENAME => ''''PLANDUMPS'''' '
+ ', PLAN_IDENTIFIER => '''''
+ %char(input.Plan_Identifier) + ''''')'')) '
+ 'USER('
+ 'MYAUTHUSER' // Replace MYAUTHUSER with a user profile authorized
// to DUMP_PLAN_CACHE().
+ ')';
qcmdexc (cmdstr : %size(cmdstr));
return;
end-proc;
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <eqqqrysv.h>
/************************************************************************/
/* SQL cannot be run within the exit program, so submit to batch. */
/************************************************************************/
memset(cmd, 0, sizeof(cmd));
strcat(cmd, "SBMJOB CMD(RUNSQL SQL('call qsys2.dump_plan_cache(");
strcat(cmd, "FILESCHEMA => ''SUPERVISOR'', FILENAME => ''PLANDUMPS''");
strcat(cmd, ", PLAN_IDENTIFIER => ");
sprintf(plan_id_string, "%llu", input->Plan_Identifier);
strcat(cmd, plan_id_string);
strcat(cmd, ")')) USER(");
strcat(cmd, AUTHORIZED_USER);
strcat(cmd, ")");
system(cmd);
}
By using USRPRF(*OWNER), *PUBLIC does not need to be given access to the objects used by this
program. The owning profile of the created program must have authority to the commands and objects
used by the exit program. The program will run in the activation group of the caller.
MONMSG MSGID(CPF0000)
/* INIT RETURN CODE TO CONTINUE RUNNING QUERY */
CHGVAR VAR(&RC) VALUE(0)
Setup configuration
There are several objects that need to be defined for this data queue processing solution.
The following table is used to log the Query Supervisor data received from the SEND_JSON exit program.
It is populated by the process_QS_data_queue() procedure defined later.
The following data queue is the communication mechanism used by the exit program that got control
because of a Query Supervisor threshold having been met or exceeded. The detail passed in the data
queue is a JSON document where each key name is a piece of data passed to the Query Supervisor exit
program.
Once the programs are in place, a job must be started to run the asynchronous SQL procedure. It will sit
and wait for data queue entries to process.
This command can be added to the QSTRUP processing to allow it to be automatically restarted upon
system IPL
If CRTRPGMOD and CRTPGM are used to compile and build the program, be sure to include
USRPRF(*OWNER) and ACTGRP(*CALLER) on the CRTPGM command.
The program can be registered as an exit program using this command:
By including the THREAD, USRPRF, DFTACTGRP, and ACTGRP options in the source, they can be omitted
on the compiler command. By using USRPRF(*OWNER), *PUBLIC does not need to be given access to
the objects used by this program. The owning profile of the created program must have authority to the
commands and objects used by the exit program. The program uses THREAD(*CONCURRENT) to ensure
thread safety. The program will run in the activation group of the caller.
**free
ctl-opt main(QS_dtaq);
ctl-opt ccsid(*char : *jobrun);
ctl-opt thread(*concurrent);
/if defined(*crtbndrpg)
ctl-opt usrprf(*owner);
ctl-opt dftactgrp(*no);
ctl-opt actgrp(*caller);
/endif
// Properties of the data queue that we will send the JSON to:
dcl-c DataQLib 'SUPERVISOR';
dcl-c DataQName 'SUPER_DQ';
dcl-c DataQMaxBytes 45000;
dcl-pi *n;
input likeds(QQQ_QRYSV_QRYS0100_t);
rc int(10);
end-pi;
dcl-ds buf
likeds(BufferInfo_t);
// Initialization
pInput = %addr(input);
exsr initEscapeAction;
json_key(buf : 'threshold_timestamp');
ts = %timestamp();
json_append(buf : '"'
+ %char(%date(ts))
+ ' '
+ %char(%time(ts) : *hms)
+ '"');
json_append(buf : ',');
json_key(buf : 'job_name');
json_string_value(buf : %trimr(input.Job_Name));
json_append(buf : ',');
json_key(buf : 'job_user');
json_string_value(buf : %trimr(input.Job_User));
json_append(buf : ',');
json_key(buf : 'job_number');
json_string_value(buf : input.Job_Number);
json_append(buf : ',');
json_key(buf : 'subsystem');
json_string_value(buf : %trimr(input.Subsystem));
json_append(buf : ',');
json_key(buf : 'user_name');
json_string_value(buf : %trimr(input.User_Name));
json_append(buf : ',');
json_key(buf : 'query_identifier');
json_string_value(buf : input.Query_Identifier);
json_append(buf : ',');
json_key(buf : 'query_plan_identifier');
json_numeric_value(buf : input.Plan_Identifier);
json_append(buf : ',');
json_key(buf : 'threshold_name');
json_escape_value(buf : %trimr(input.Threshold_Name));
json_append(buf : ',');
json_key(buf : 'threshold_consumption_value');
json_numeric_value(buf : input.Threshold_Consumption_Value);
json_append(buf : ',');
json_key(buf : 'operation_type');
json_numeric_value(buf : input.Operation_Type);
if input.Length_of_CLIENT_ACCTNG > 0;
json_append(buf : ',');
json_key(buf : 'client_acctng');
based_char_ptr = pInput + input.Offset_to_CLIENT_ACCTNG;
json_escape_value(buf
: %subst(based_char : 1
: Input.Length_of_CLIENT_ACCTNG));
endif;
if input.Length_of_CLIENT_APPLNAME > 0;
json_append(buf : ',');
json_key(buf : 'client_applname');
based_char_ptr = pInput + input.Offset_to_CLIENT_APPLNAME;
json_escape_value(buf
: %subst(based_char : 1
: Input.Length_of_CLIENT_APPLNAME));
endif;
if input.Length_of_CLIENT_PROGRAMID > 0;
json_append(buf : ',');
json_key(buf : 'client_programid');
based_char_ptr = pInput + input.Offset_to_CLIENT_PROGRAMID;
json_escape_value(buf
: %subst(based_char : 1
: Input.Length_of_CLIENT_PROGRAMID));
endif;
if input.Length_of_CLIENT_USERID > 0;
json_append(buf : ',');
json_key(buf : 'client_userid');
based_char_ptr = pInput + input.Offset_to_CLIENT_USERID;
json_escape_value(buf
: %subst(based_char : 1
: Input.Length_of_CLIENT_USERID));
endif;
if input.Length_of_CLIENT_WRKSTNNAME > 0;
json_append(buf : ',');
json_key(buf : 'client_wrkstnname');
based_char_ptr = pInput + input.Offset_to_CLIENT_WRKSTNNAME;
json_escape_value(buf
: %subst(based_char : 1
: Input.Length_of_CLIENT_WRKSTNNAME));
endif;
if input.Length_of_SQL_Statement > 0;
json_append(buf : ',');
json_key(buf : 'sql_statement_text');
based_ucs2_ptr = pInput + input.Offset_to_SQL_Statement;
json_escape_value(buf
: %subst(based_ucs2 : 1
: %div(Input.Length_of_SQL_Statement : 2)));
endif;
if input.Length_of_Host_Variable_List > 0;
json_append(buf : ',');
json_key(buf : 'host_variable_list');
based_ucs2_ptr = pInput + input.Offset_to_Host_Variable_List;
json_escape_value(buf
: %subst(based_ucs2 : 1
: %div(Input.Length_of_Host_Variable_List : 2)));
endif;
if buf.truncated;
Qp0zLprintf('SEND_JSON ran out of allocated space for '
+ 'constructing the Query Supervisor JSON data.' + NEWLINE_CH);
endif;
QSNDDTAQ(DataQName
: DataQLib
: buf.curptr - buf.baseptr
: based_buf_data);
begsr initEscapeAction;
jsonEscapeAction =
%list(
// x'00'
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
Backspace :Tab : Newline : UTF16 :
Formfeed : CR : UTF16 : UTF16 :
// x'10'
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
// x'20'
None : None : Quote : None :
None : None : None : None :
None : None : None : None :
None : None : None : None :
// x'30'
None : None : None : None :
None : None : None : None :
None : None : None : None :
None : None : None : None :
// x'40'
None : None : None : None :
None : None : None : None :
None : None : None : None :
None : None : None : None :
// x'50'
None : None : None : None :
None : None : None : None :
None : None : None : None :
Backslash :None : None : None :
// x'60'
None : None : None : None :
None : None : None : None :
None : None : None : None :
None : None : None : None :
// x'70'
None : None : None : None :
None : None : None : None :
None : None : None : None :
None : None : None : None :
// x'80'
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
// x'90'
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16 :
UTF16 : UTF16 : UTF16 : UTF16);
endsr;
on-exit;
dealloc buf.baseptr;
end-proc;
// Loop through all the source UTF-16 characters, copying any that
// do not require escaping, and escaping those that are required.
target_pos = 1;
for i = 1 to %len(source);
c = %subst(source : i : 1);
ucs2_to_num.c = c;
c_num = ucs2_to_num.n;
if action = None;
// No escaping needed. Emit the source character.
%subst(target : target_pos : 1) = c;
target_pos += 1;
else;
%subst(target : target_pos : 1) =
%subst(EscapeChars : Backslash + 1 : 1);
target_pos += 1;
if action = UTF16;
// We escape this as a UTF16 codepoint: \u00XX
%subst(target : target_pos : %len(UnicodePrefix)) = UnicodePrefix;
target_pos += %len(UnicodePrefix);
%subst(target : target_pos : 1) =
%subst(HexChars : %div(c_num : 16) + 1 : 1);
target_pos += 1;
%subst(target : target_pos : 1) =
%subst(HexChars : %rem(c_num : 16) + 1 : 1);
target_pos += 1;
else;
// We escape this as a special character: e.g. \t
%subst(target : target_pos : 1) =
%subst(EscapeChars : Action + 1 : 1);
target_pos += 1;
endif;
endif;
endfor;
// Returns *on if the buffer space can accommodate "len" Unicode chars
// Returns *off and sets the truncated flag if otherwise.
dcl-proc buffer_has_space;
dcl-pi *n ind;
buf likeds(BufferInfo_t);
len int(10) value;
end-pi;
dcl-s required_buf_len int(10);
buf likeds(BufferInfo_t);
string varucs2(MAX_SOURCE_LEN) const;
end-pi;
json_string = %char(num);
end-proc;
#include <except.h>
#include <decimal.h>
#include <qsnddtaq.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include <iconv.h>
#include <assert.h>
#include <time.h>
#include <qp0ztrc.h>
#include <eqqqrysv.h>
/* Properties of the data queue that we will send the JSON to: */
char* DataQLib = "SUPERVISOR";
char* DataQName = "SUPER_DQ ";
const int DataQMaxBytes = 45000;
/* Loop through all the source UTF-16 characters, copying any that
do not require escaping, and escaping those that are required. */
while (source_length-- && target < target_end)
{
const wchar_t c = *source;
enum EscapeAction action;
if (action == None)
{
/* No escaping needed. Emit the source character. */
**target = c;
++*target;
}
else
{
**target = EscapeChars[Backslash];
++*target;
if (action == UTF16)
{
if (target+6 >= target_end)
break;
return 0;
}
return input_len;
}
return input_len;
}
buf->truncated = 1;
return 0;
}
BufferInfo_t buf;
wchar_t translate_buffer[1024];
time_t current_time;
size_t char_count;
wchar_t* work_ptr;
size_t converted_bytes;
struct tm *timeptr;
char* inputAsCharData;
char from_code[32], to_code[32];
JSON_KEY(buf, L"threshold_timestamp");
JSON_APPEND(buf, L"\"");
current_time = time(NULL);
timeptr = localtime(¤t_time);
char_count = wcsftime(buf.curptr,
sizeof(translate_buffer)/2,
L"%F %T",
timeptr);
buf.curptr += char_count;
JSON_APPEND(buf, L"\"");
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"job_name");
JSON_STRING_VALUE(buf, input->Job_Name);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"job_user");
JSON_STRING_VALUE(buf, input->Job_User);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"job_number");
JSON_STRING_VALUE(buf, input->Job_Number);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"subsystem");
JSON_STRING_VALUE(buf, input->Subsystem);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"user_name");
JSON_STRING_VALUE(buf, input->User_Name);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"query_identifier");
JSON_STRING_VALUE(buf, input->Query_Identifier);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"query_plan_identifier");
char_count = swprintf(translate_buffer,
sizeof(translate_buffer)/2,
L"%llu",
input->Plan_Identifier);
JSON_NUMERIC_VALUE(buf, translate_buffer, char_count);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"threshold_type");
JSON_STRING_VALUE(buf, input->Threshold_Type);
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"threshold_consumption_value");
char_count = swprintf(translate_buffer,
sizeof(translate_buffer)/2,
L"%lld",
input->Threshold_Consumption_Value);
JSON_NUMERIC_VALUE(buf, translate_buffer, char_count);
JSON_APPEND(buf, L",");
char_count = swprintf(translate_buffer,
sizeof(translate_buffer)/2,
L"%d",
(int)input->Operation_Type);
JSON_KEY(buf, L"operation_type");
JSON_NUMERIC_VALUE(buf, translate_buffer, char_count);
inputAsCharData = (char*)input;
if (input->Length_of_CLIENT_ACCTNG)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"client_acctng");
work_ptr = translate_buffer;
converted_bytes =
convert_to_utf16(inputAsCharData+input->Offset_to_CLIENT_ACCTNG,
input->Length_of_CLIENT_ACCTNG,
&work_ptr,
sizeof(translate_buffer),
buf.converter);
JSON_ESCAPE_VALUE(buf, translate_buffer, converted_bytes / 2);
}
if (input->Length_of_CLIENT_APPLNAME)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"client_applname");
work_ptr = translate_buffer;
converted_bytes =
convert_to_utf16(inputAsCharData+input->Offset_to_CLIENT_APPLNAME,
input->Length_of_CLIENT_APPLNAME,
&work_ptr,
sizeof(translate_buffer),
buf.converter);
JSON_ESCAPE_VALUE(buf, translate_buffer, converted_bytes / 2);
}
if (input->Length_of_CLIENT_PROGRAMID)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"client_programid");
work_ptr = translate_buffer;
converted_bytes =
convert_to_utf16(inputAsCharData+input->Offset_to_CLIENT_PROGRAMID,
input->Length_of_CLIENT_PROGRAMID,
&work_ptr,
sizeof(translate_buffer),
buf.converter);
JSON_ESCAPE_VALUE(buf, translate_buffer, converted_bytes / 2);
}
if (input->Length_of_CLIENT_USERID)
{
JSON_APPEND(buf, L",");
if (input->Length_of_CLIENT_WRKSTNNAME)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"client_wrkstnname");
work_ptr = translate_buffer;
converted_bytes =
convert_to_utf16(inputAsCharData+input->Offset_to_CLIENT_WRKSTNNAME,
input->Length_of_CLIENT_WRKSTNNAME,
&work_ptr,
sizeof(translate_buffer),
buf.converter);
JSON_ESCAPE_VALUE(buf, translate_buffer, converted_bytes / 2);
}
if (input->Length_of_SQL_Statement)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"sql_statement_text");
JSON_ESCAPE_VALUE(buf,
(wchar_t*)(inputAsCharData+input->Offset_to_SQL_Statement),
input->Length_of_SQL_Statement/2);
}
if (input->Length_of_Host_Variable_List)
{
JSON_APPEND(buf, L",");
JSON_KEY(buf, L"host_variable_list");
JSON_ESCAPE_VALUE(buf,
(wchar_t*)(inputAsCharData+input->Offset_to_Host_Variable_List),
input->Length_of_Host_Variable_List/2);
}
JSON_APPEND(buf, L"}");
if (buf.truncated)
{
Qp0zLprintf("SEND_JSON ran out of allocated space for "
"constructing the Query Supervisor JSON data.\n");
}
QSNDDTAQ(DataQName,
DataQLib,
(decimal(5,0))((char*)buf.curptr-(char*)buf.baseptr),
(void *)buf.baseptr
);
#pragma disable_handler
free((void*)buf.baseptr);
iconv_close(buf.converter);
return 0;
}
The following example adds a reply list element that causes the default reply of C to cancel requests for
jobs whose process name is 'QPADEV0011'.
Related information
Change Job (CHGJOB) command
This command sets the query time limit at 45 seconds. If the user runs a query with an estimated runtime
equal to or less than 45 seconds, the query runs without interruption. The time limit remains in effect
for the duration of the job or user session, or until the time limit is changed by the Change Query
Attributes (CHGQRYA) command.
Assume that the query optimizer estimated the runtime for a query as 135 seconds. A message is sent
to the user that stated that the estimated runtime of 135 seconds exceeds the query time limit of 45
seconds.
To set or change the query time limit for a job other than your current job, the Change Query
Attributes (CHGQRYA) command is run using the JOB parameter. To set the query time limit to
This command sets the query time limit at 45 seconds for job 123456/USERNAME/JOBNAME. If job
123456/USERNAME/JOBNAME tries to run a query with an estimated runtime equal to or less than 45
seconds the query runs without interruption. If the estimated runtime for the query is greater than 45
seconds, for example, 50 seconds, a message is sent to the user. The message states that the estimated
runtime of 50 seconds exceeds the query time limit of 45 seconds. The time limit remains in effect
for the duration of job 123456/USERNAME/JOBNAME, or until the time limit for job 123456/USERNAME/
JOBNAME is changed by the Change Query Attributes (CHGQRYA) command.
To set or change the query time limit to the QQRYTIMLMT system value, use the following Change Query
Attributes (CHGQRYA) command:
CHGQRYA QRYTIMLMT(*SYSVAL)
The QQRYTIMLMT system value is used for duration of the job or user session, or until the time limit is
changed by the Change Query Attributes (CHGQRYA) command. This use is the default behavior
for the Change Query Attributes (CHGQRYA) command.
Note: The query time limit can also be set in the INI file, or by using the Change System Value
(CHGSYSVAL) command.
Related information
Change Query Attributes (CHGQRYA) command
Change System Value (CHGSYSVAL) command
If the user runs any query with an estimated temporary storage consumption equal to or less than 100
MB, the query runs without interruption. If the estimate is more than 100 MB, the CPA4259 inquiry
message is sent by the database. To set or change the query time limit for a job other than your current
job, the CHGQRYA command is run using the JOB parameter. To set the same limit for job 123456/
USERNAME/JOBNAME use the following CHGQRYA command:
This sets the query temporary storage limit to 100 MBfor job 123456/USERNAME/JOBNAME.
Note: Unlike the query time limit, there is no system value for temporary storage limit. The default
behavior is to let any queries run regardless of their temporary storage usage. The query temporary
storage limit can be specified either in the INI file or on the Change Query Attributes (CHGQRYA)
command.
Related information
Change Query Attributes (CHGQRYA) command
The default QQRYDEGREE system value is *NONE. You must change the value if you want parallel query
processing as the default for jobs run on the system.
Changing this system value affects all jobs that is run or are currently running on the system whose
DEGREE query attribute is *SYSVAL. However, queries that have already been started or queries using
reusable ODPs are not affected.
*SYSVAL Specifies that the processing option used is set to the current value of the QQRYDEGREE
system value.
The value can be changed by invoking the SET CURRENT DEGREE statement.
The initial value of CURRENT DEGREE comes from the CHGQRYA CL command, PARALLEL_DEGREE
parameter in the current query options file (QAQQINI), or the QQRYDEGREE system value.
Related information
Set Current Degree statement
Change Query Attributes (CHGQRYA) command
DB2 Symmetric Multiprocessing
*ALL Allows all statistics to be collected in the background. *ALL is the default setting.
*NONE Restricts everyone from creating statistics in the background. *NONE does not prevent
immediate user-requested statistics from being collected, however.
*USER Allows only user-requested statistics to be collected in the background.
*SYSTEM Allows only system-requested statistics to be collected in the background.
When you switch the system value to something other than *ALL or *SYSTEM, the statistics manager
continues to place statistics requests in the plan cache. When the system value is switched back to *ALL,
for example, background processing analyzes the entire plan cache and looks for any existing column
statistics requests. This background task also identifies column statistics that have been used by a plan in
the plan cache. The task determines if these column statistics have become stale. Requests for the new
column statistics as well as requests for refresh of the stale columns statistics are then executed.
All background statistic collections initiated by the system or submitted by a user are performed by
the system job QDBFSTCCOL. User-initiated immediate requests are run within the user job. This job
uses multiple threads to create the statistics. The number of threads is determined by the number of
processors that the system has. Each thread is then associated with a request queue.
There are four types of request queues based on who submitted the request and how long the collection
is estimated to take. The default priority assigned to each thread can determine to which queue the
thread belongs:
• Priority 90 — short user requests
• Priority 93 — long user requests
• Priority 96 — short system requests
• Priority 99 — long system requests
Background statistics collections attempt to use as much parallelism as possible. This parallelism is
independent of the SMP feature installed on the system. However, parallel processing is allowed only
for immediate statistics collection if SMP is installed on the system. The job that requests the column
statistics also must allow parallelism.
Related information
Performance system values: Allow background database statistics collection
High Availability High availability solutions replicate data to a secondary system by using journal
(HA) solutions entries. However, column statistics are not journaled. That means that, on your
backup system, no column statistics are available when you first start using that
system. To prevent the "warm up" effect, you might want to propagate the column
statistics that were gathered on your production system. Recreate them on your
backup system manually.
ISV An ISV might want to deliver a customer solution that already includes column
(Independent statistics frequently used in the application, rather than waiting for the automatic
Software statistics collection to create them. Run the application on the development system
Vendor) for some time and examine which column statistics were created automatically. You
preparation can then generate a script file to execute on the customer system after the initial data
load takes place. The script file can be shipped as part of the application
Business In a large Business Intelligence environment, it is common for large data load and
Intelligence update operations to occur overnight. Column statistics are marked stale only when
environments they are touched by the statistics manager, and then refreshed after first touch. You
might want to consider refreshing the column statistics manually after loading the
data.
You can do this refresh easily by toggling the system value QDBFSTCCOL to *NONE
and then back to *ALL. This process causes all stale column statistics to be refreshed.
It also starts collection of any column statistics previously requested by the system
but not yet available. Since this process relies on the access plans stored in the
plan cache, avoid performing a system initial program load (IPL) before toggling
QDBFSTCCOL. An IPL clears the plan cache.
This procedure works only if you do not delete (drop) the tables and recreate them
in the process of loading your data. When deleting a table, access plans in the plan
cache that refer to this table are deleted. Information about column statistics on that
table is also lost. The process in this environment is either to add data to your tables
or to clear the tables instead of deleting them.
Massive data Updating rows in a column statistics-enabled table can significantly change the
updates cardinality, add new ranges of values, or change the distribution of data values. These
updates can affect query performance on the first query run against the new data. On
the first run of such a query, the optimizer uses stale column statistics to determine
the access plan. At that point, it starts a request to refresh the column statistics.
Prior to this data update, you might want to toggle the system value QDBFSTCCOL
to *NONE and back to *ALL or *SYSTEM. This toggle causes an analysis of the
plan cache. The analysis includes searching for column statistics used in access
plan generation, analyzing them for staleness, and requesting updates for the stale
statistics.
If you massively update or load data, and run queries against these tables at the
same time, the automatic column statistics collection tries to refresh every time 15%
of the data is changed. This processing can be redundant since you are still updating
or loading the data. In this case, you might want to block automatic statistics
collection for the tables and deblock it again after the data update or load finishes.
An alternative is to turn off automatic statistics collection for the whole system before
updating or loading the data. Switch it back on after the updating or loading has
finished.
Backup and When thinking about backup and recovery strategies, keep in mind that creation of
recovery column statistics is not journaled. Column statistics that exist at the time a save
operation occurs are saved as part of the table and restored with the table. Any
column statistics created after the save took place are lost and cannot be recreated
Related information
Performance system values: Allow background database statistics collection
Table name The name of the table associated with the constraint in
check pending state.
Sparse indexes
You can use the SQL CREATE INDEX statement to create a sparse index using SQL selection predicates.
The SQL CREATE INDEX statement can be used to create a sparse index using a WHERE condition. With
this support, the query optimizer recognizes and considers sparse indexes during its optimization. If the
query WHERE selection is a subset of the sparse index WHERE selection, then the sparse index is used to
implement the query. Use of the sparse index usually results in improved performance.
In this example, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Related reference
Using sparse indexes
SQL indexes can be created using WHERE selection predicates. These indexes can also be referred to as
sparse indexes. The advantage of a sparse index is that fewer entries are maintained in the index. Only
those entries matching the WHERE selection criteria are maintained in the index.
Related information
SQL Create Index statement
Example A2
In this example, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The remaining query selection (COL3=30) is executed following the index scan.
Example A3
In this example, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
For selection where all predicates are ORed together, all WHERE selection predicates specified in
the query, must also be specified in the sparse index. The sparse index can contain additional ORed
predicates. All the ORed selection in the query will be executed after the entries are retrieved from the
sparse index. See examples O1, O2, andO3 following.
Example O1
In this example, the query selection exactly matches the sparse index selection and an index scan over
the sparse index can be used. The query selection is executed following the index scan.
Example O2
In this example, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The query selection is executed following the index scan.
Example O3
In this example, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
The previous examples used simple selection, all ANDed, or all ORed together. These examples are
not typical, but they demonstrate how the selection of the sparse index is compared to the selection
of the query. Obviously, the more complex the selection the more difficult it becomes to determine
compatibility.
In the next example T1, the constant 'MN' was replaced by a parameter marker for the query selection.
The sparse index had the local selection of COL1='MN' applied to it when it was created. The sparse index
matching algorithm matches the parameter marker to the constant 'MN' in the query predicate COL1 =?. It
verifies that the value of the parameter marker is the same as the constant in the sparse index; therefore
the sparse index can be used.
The sparse index matching algorithm attempts to match where the predicates between the sparse index
and the query are not the same. An example is a sparse index with a predicate SALARY > 50000, and
a query with the predicate SALARY > 70000. The sparse index contains the rows necessary to run the
query. The sparse index is used in the query, but the predicate SALARY > 70000 remains as selection in
the query (it is not removed).
Example T1
In the next example T2, the keys of the sparse index match the ORDER BY fields in the query. For the
sparse index to satisfy the specified ordering, the optimizer must verify that the query selection is a
subset of the sparse index selection. In this example, the sparse index can be used.
Example T2
Related reference
Using sparse indexes
SQL indexes can be created using WHERE selection predicates. These indexes can also be referred to as
sparse indexes. The advantage of a sparse index is that fewer entries are maintained in the index. Only
those entries matching the WHERE selection criteria are maintained in the index.
Details on the MQT matching algorithm
What follows is a generalized discussion of how the MQT matching algorithm works.
In example S2, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Example S2
In example S3, the query selection exactly matches the sparse index selection and an index scan over the
sparse index can be used.
Example S3
In example S4, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The remaining query selection (COL3=30) is executed following the index scan.
Example S4
In example S6, the query selection exactly matches the sparse index selection and an index scan over the
sparse index can be used. The query selection is executed following the index scan to eliminate excess
records from the sparse index.
Example S6
In example S7, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The query selection is executed following the index scan to eliminate excess
records from the sparse index.
Example S7
In example S8, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Example S8
In the next example S9, the constant 'MN' was replaced by a parameter marker for the query selection.
The sparse index had the local selection of COL1='MN' applied to it when it was created. The sparse index
matching algorithm matches the parameter marker to the constant 'MN' in the query predicate COL1 =?. It
verifies that the value of the parameter marker is the same as the constant in the sparse index; therefore
the sparse index can be used.
Example S9
In the next example S11, the keys of the sparse index do not match the order by fields in the query. But
the selection in sparse index T2 is a superset of the query selection. Depending on size, the optimizer
might choose an index scan over sparse index T2 and then use a sort to satisfy the specified ordering.
Example S11
The next example S12 represents the classic optimizer decision: is it better to do an index probe using
index IX1 or is it better to do an index scan using sparse index SPR1? Both indexes retrieve the same
number of index entries and have the same cost from that point forward. For example, both indexes have
the same cost to retrieve the selected records from the dataspace, based on the retrieved entries/keys.
The cost to retrieve the index entries is the deciding criteria. In general, if index IX1 is large then an index
scan over sparse index SPR1 has a lower cost to retrieve the index entries. If index IX1 is rather small
then an index probe over index IX1 has a lower cost to retrieve the index entries. Another cost decision
is reusability. The plan using sparse index SPR1 is not as reusable as the plan using index IX1 because of
the static selection built into the sparse selection.
Example S12
EVI maintenance
There are unique challenges to maintaining EVIs. The following table shows a progression of how EVIs are
maintained, the conditions under which EVIs are most effective, and where EVIs are least effective, based
on the EVI maintenance characteristics.
When inserting a new distinct • Minimum overhead if contained within overflow area
key value - out of order, within threshold
byte code range
• Symbol table key value added to overflow area, byte code
assigned, statistics assigned
• Vector element added for new row, with new byte code
• Considerable overhead if overflow area threshold reached
• Access path validated - not available
• EVI refreshed, overflow area keys incorporated, new
byte codes assigned (symbol table and vector elements
updated)
• Minimal additional path-length to maintain any INCLUDEd
aggregate values (the increment of a COUNT or adding to
an accumulating SUM)
Least Effective
Related reference
Encoded vector index
Create EVIs on
• Read-only tables or tables with a minimum of INSERT, UPDATE, DELETE activity.
• Key columns that are used in the WHERE clause - local selection predicates of SQL requests.
• Single key columns that have a relatively small set of distinct values.
• Multiple key columns that result in a relatively small set of distinct values.
• Key columns that have a static or relatively static set of distinct values.
• Non-unique key columns, with many duplicates.
Here is the EVI INCLUDE create that will facilitate the rollup query.
The following graphic shows a Visual Explain that illustrates the access and the performance. Instead of
accessing potentially millions of rows, the access is over a rather modest size symbol table.
EXEC SQL
DECLARE DEPTEMP CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
WHERE (WORKDEPT = 'D11' OR
Even if you do not intend to update the employee department, the system cannot use an index with a
key of WORKDEPT.
An index can be used if all the index updatable columns are also used within the query as an isolatable
selection predicate with an equal operator. In the previous example, the system uses an index with a
key of EMPNO.
The system can operate more efficiently if the FOR UPDATE OF column list only names the column you
intend to update: WORKDEPT. Therefore, do not specify a column in the FOR UPDATE OF column list
unless you intend to update the column.
If you have an updatable cursor because of dynamic SQL, or FOR UPDATE was not specified and the
program contains an UPDATE statement, then all columns can be updated.
• For a column being compared with another column from the same row. For example, when using SQL,
your program might include the following:
EXEC SQL
DECLARE DEPTDATA CURSOR FOR
SELECT WORKDEPT, DEPTNAME
FROM CORPDATA.EMPLOYEE
WHERE WORKDEPT = ADMRDEPT
END-EXEC.
Even though there is an index for WORKDEPT and another index for ADMRDEPT, Db2 for i does not use
either index. The index has no added benefit because every row of the table needs to be looked at.
Maximum Key Length The maximum key length for the access path or index.
Unique Partial Key Values The number of unique partial keys for the key fields 1
through 4. If the access path is an encoded vector, this
number represents the number of full key distinct values.
Overflow Values The number of overflow values for this encoded vector index.
Key Code Size The length of the code assigned to each distinct key value of
the encoded vector index.
Sparse Is the index considered sparse. Sparse indexes only contain
keys for rows that satisfy the query. Possible values are:
• Yes
• No
Derived Key Is the index considered derived. A derived key is a key that
is the result of an operation on the base column. Possible
values are:
• Yes
• No
Partitioned Is the index partition created for each data partition defined
for the table using the specified columns. Possible values
are:
• Yes
• No
Maintenance For objects with key fields or join logical files, the type of
access path maintenance used. The possible values are:
• Do not wait
• Delayed
• Rebuild
Delayed Maintenance Keys The number of delayed maintenance keys for the access
path or index.
Recovery When the access path is rebuilt after damage to the access
path is recognized. The possible values are:
• After IPL
• During IPL
• Next Open
Index Logical Reads The number of access path or index logical read operations
since the last IPL.
WHERE Clause Specifies the condition to apply for a row to be included in
the index.
WHERE Clause Has UDF Does the WHERE clause have a UDF. Possible values are:
• Yes
• No
Table Table name of the table that the index is based on.
Table Partition Partition name of the table that the index is based on.
Table System Name System name of the table that the index is based on.
Last Rebuild Number Keys Number of keys in the index when the index was last rebuilt.
Last Rebuild Parallel Degree Parallel degree used when the index was last rebuilt.
Last Rebuild Time Amount of time in seconds it took to rebuild the index the
last time the index was rebuilt.
Keep in Memory Is the index kept in memory. Possible values are:
• Yes
• No
Sort Sequence Schema Schema of the sort sequence table if one is used.
Sort Sequence Name Name of the sort sequence table if one is used.
Random Reads The number of reads that have occurred in a random fashion.
Random means that the location of the row or key could not
be predicted ahead of time.
Last Query Use States the timestamp when the index was last used to retrieve data for a
query.
Last Query Statistic Use States the timestamp when the index was last used to provide statistical
information.
Query Use Count Lists the number of instances the index was used in a query.
Query Statistics Use Lists the number of instances the index was used for statistical information.
Last Used Date The century and date this index was last used.
Days Used Count The number of days the index was used. If the index does not have a last
used date, the count is 0.
Date Reset Days Used The date that the days used count was last reset. You can reset the days used
Count by Change Object Description (CHGOBJD) command.
The fields start and stop counting based on your situation, or the actions you are currently performing on
your system. The following list describes what might affect one or both of your counters:
• The SQE and CQE query engines increment both counters. As a result, the statistics field is updated
regardless of which query interface is used.
• A save and restore procedure does not reset the statistics counter if the index is restored over an
existing index. If an index is restored that does not exist on the system, the statistics are reset.
Related information
Retrieve Member Description (QUSRMBRD) API
Change Object Description (CHGOBJD) command
Rebuild Priority Displays the priority in which the rebuild for this
access path is run. Also referred to as sequence
number.
Possible values are:
1-99: Order to rebuild
Held
Open
Rebuild Reason Displays the reason why this access path needs to be rebuilt.
Possible values are:
Create or build index
IPL
Runtime error
Change file or index sharing
Other
Not needed
Change End of Data
Restore
Alter table
Change table
Change file
Reorganize
Enable a constraint
Alter table recovery
Change file recovery
Index shared
Runtime error
Verify constraint
Convert member
Restore recovery
Last Query Use Timestamp when the access path was last used
Last Query Statistics Use Timestamp when the access path was last used for statistics
Query Use Count Number of times the access path has been used for a query
Query Statistics Use Count Number of times the access path has been used for statistics
Partition Partition detail for the index. Possible values:
• <blank>, which means For all partitions
• For Each Partition
• specific name of the partition
You can also use the Edit Rebuild of Access Paths (EDTRBDAP) command to manage rebuilding
of access paths.
Related information
Rebuild access paths
Edit Rebuild of Access Paths (EDTRBDAP) command
Indexing strategy
There are two approaches to index creation: proactive and reactive. Proactive index creation involves
anticipating which columns are most often used for selection, joining, grouping, and ordering. Then
building indexes over those columns. In the reactive approach, indexes are created based on optimizer
feedback, query implementation plan, and system performance measurements.
It is useful to initially build indexes based on the database model and applications and not any particular
query. As a starting point, consider designing basic indexes based on the following criteria:
• Primary and foreign key columns based on the database model
• Commonly used local selection columns, including columns that are dependent, such as an
automobile's make and model
• Commonly used join columns not considered primary or foreign key columns
• Commonly used grouping columns
Related information
Indexing and statistics strategies for DB2 for i5/OS
With a query like this, the proactive index creation process can begin. The basic rules are:
• Custom-build a radix index for the largest or most commonly used queries. Example using the query
above:
instead of
instead of
If an index was created over the EDUCLVL column, then the optimizer might not use the index in the
second example. The constant precision is greater than the column precision. It attempts to convert the
constant to the precision of the column. In the first example, the optimizer considers using the index,
because the precisions are equal.
instead of
instead of
However, when used at the beginning of a character string, they can prevent Db2 for i from using any
indexes that might be defined on the LASTNAME column to limit the number of rows scanned using index
scan-key positioning. Index scan-key selection, however, is allowed. For example, in the following queries
index scan-key selection can be used, but index scan-key positioning cannot.
In SQL:
In OPNQRYF:
Avoid patterns with a % so that you can get the best performance with key processing on the predicate. If
possible, try to get a partial string to search so that index scan-key positioning can be used.
For example, if you were looking for the name "Smithers", but you only type "S%," this query returns all
names starting with "S." Adjust the query to return all names with "Smi%". By forcing the use of partial
strings, you might get better performance in the long term.
Now, return all the employees whose total compensation is greater than 50000.
The optimizer uses the index TOTALIX with index probe to satisfy both the WHERE selection and the
ordering criteria.
There are some special considerations for matching the derived key with an expression used in the query.
• No expression matching is done to match index key constants with host variables used in a query. This
includes implicit parameter marker conversion performed by the database manager.
In this example, return all employees whose monthly salary is greater than 3000. Use a host variable to
provide the value used by the query.
The optimizer does not use the index since there is no support for matching the host variable value
months in the query to the constant 12 in the index.
• For a dynamic SQL statement, using the QAQQINI option PARAMETER_MARKER_CONVERSION with
value *NO can be used to prevent conversion of constants to parameter markers. This technique allows
for improved derived index key matching. However, because of the performance implications of using
this QAQQINI setting, take care with its usage.
• In general, expressions in the index must match the expression in the query.
In this example, the SALARY+COMM+BONUS expression is in a different order than the index key
SALARY+BONUS+COMM and would not match.
• It is recommended that derived index keys be kept as simple as possible. The index is less likely to be
selected when a complex query expression and a complex index key expression need to be matched.
• The CQE optimizer has limited support for matching derived key indexes.
Related reference
Derived key index
You can use the SQL CREATE INDEX statement to create a derived key index using an SQL expression.
Related information
SQL Create Index statement
It is recommended that the WHERE selection in the sparse index is kept as simple as possible. The more
complex the WHERE selection, the more difficult it becomes to match the sparse index WHERE selection
to the query WHERE selection. Then it is less likely that the sparse index is used. The CQE optimizer does
not support sparse indexes. It does support select/omit logical files however. The SQE optimizer matches
the CQE optimizer in its support for select/omit logical files and has nearly full support for sparse indexes.
Related reference
Sparse indexes
You can use the SQL CREATE INDEX statement to create a sparse index using SQL selection predicates.
Related information
SQL Create Index statement
Index examples
The following index examples are provided to help you create effective indexes.
For the purposes of the examples, assume that three indexes are created.
Assume that an index HEXIX was created with *HEX as the sort sequence.
Assume that an index UNQIX was created with a unique-weight sort sequence.
Assume that an index SHRIX was created with a shared-weight sort sequence.
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
SRTSEQ(*HEX)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
SRTSEQ(*LANGIDUNQ) LANGID(ENU)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
SRTSEQ(*LANGIDSHR) LANGID(ENU)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *GT ''MGR''')
SRTSEQ(*LANGIDUNQ) LANGID(ENU)
SELECT *
FROM STAFF S1 INNER JOIN STAFF S2
ON S1.JOB = S2.JOB
The system can use either index HEXIX or index UNQIX for either query.
SELECT *
FROM STAFF S1 INNER JOIN STAFF S2
ON S1.JOB = S2.JOB
The system can only use index SHRIX for either query.
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
KEYFLD(JOB)
SRTSEQ(*HEX)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
KEYFLD(JOB) SRTSEQ(*LANGIDUNQ) LANGID(ENU)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
KEYFLD(JOB) SRTSEQ(*LANGIDSHR) LANGID(ENU)
OPNQRYF FILE((STAFF))
QRYSLT('JOB *EQ ''MGR''')
KEYFLD(JOB)
SRTSEQ(*LANGIDUNQ) LANGID(ENU)
ALWCPYDTA(*OPTIMIZE)
The system can use either index HEXIX or index UNQIX for selection. Ordering is done during the sort
using the *LANGIDUNQ sort sequence table.
Assume that an index UNQIX2 was created and the sort sequence is a unique-weight sort sequence.
Index example: Ordering and grouping on the same columns with a unique-
weight sort sequence table
Ordering and grouping on the same columns with a unique-weight sort sequence table
(SRTSEQ(*LANGIDUNQ) LANGID(ENU)).
The system can use UNQIX2 to satisfy both the grouping and ordering requirements. If index UNQIX2 did
not exist, the system creates an index using a sort sequence table of *LANGIDUNQ.
The system can use UNQIX2 to satisfy both the grouping and ordering requirements. If index UNQIX2 did
not exist, the system does one of the following actions:
• Create an index using a sort sequence table of *LANGIDUNQ or
• Use index HEXIX2 to satisfy the grouping and to perform a sort to satisfy the ordering
The system can use SHRIX2 to satisfy both the grouping and ordering requirements. If index SHRIX2 did
not exist, the system creates an index using a sort sequence table of *LANGIDSHR.
The system can use SHRIX2 to satisfy both the grouping and ordering requirements. If index SHRIX2 did
not exist, the system creates an index using a sort sequence table of *LANGIDSHR.
The system can use index HEXIX2 or index UNQIX2 to satisfy the grouping requirements. A temporary
result is created containing the grouping results. A temporary index is then built over the temporary result
using a *LANGIDUNQ sort sequence table to satisfy the ordering requirements.
The system can use index HEXIX2 or index UNQIX2 to satisfy the grouping requirements. A sort is
performed to satisfy the ordering requirements.
The system can use index SHRIX2 to satisfy the grouping requirements. A sort is performed to satisfy the
ordering requirements.
In example S2, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Example S2
In example S3, the query selection exactly matches the sparse index selection and an index scan over the
sparse index can be used.
Example S3
In example S4, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The remaining query selection (COL3=30) is executed following the index scan.
Example S4
In example S5, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Example S5
In example S6, the query selection exactly matches the sparse index selection and an index scan over the
sparse index can be used. The query selection is executed following the index scan to eliminate excess
records from the sparse index.
Example S6
In example S7, the query selection is a subset of the sparse index selection and an index scan over the
sparse index can be used. The query selection is executed following the index scan to eliminate excess
records from the sparse index.
Example S7
In example S8, the query selection is not a subset of the sparse index selection and the sparse index
cannot be used.
Example S8
In the next example S9, the constant 'MN' was replaced by a parameter marker for the query selection.
The sparse index had the local selection of COL1='MN' applied to it when it was created. The sparse index
matching algorithm matches the parameter marker to the constant 'MN' in the query predicate COL1 =?. It
verifies that the value of the parameter marker is the same as the constant in the sparse index; therefore
the sparse index can be used.
Example S9
In the next example S10, the keys of the sparse index match the order by fields in the query. For the
sparse index to satisfy the specified ordering, the optimizer must verify that the query selection is a
subset of the sparse index selection. In this example, the sparse index can be used.
Example S10
In the next example S11, the keys of the sparse index do not match the order by fields in the query. But
the selection in sparse index T2 is a superset of the query selection. Depending on size, the optimizer
might choose an index scan over sparse index T2 and then use a sort to satisfy the specified ordering.
Example S11
The next example S12 represents the classic optimizer decision: is it better to do an index probe using
index IX1 or is it better to do an index scan using sparse index SPR1? Both indexes retrieve the same
number of index entries and have the same cost from that point forward. For example, both indexes have
the same cost to retrieve the selected records from the dataspace, based on the retrieved entries/keys.
The cost to retrieve the index entries is the deciding criteria. In general, if index IX1 is large then an index
scan over sparse index SPR1 has a lower cost to retrieve the index entries. If index IX1 is rather small
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
ORDER BY EMPNO
END-EXEC.
EXEC SQL
OPEN C1
END-EXEC.
EXEC SQL
CLOSE C1
END-EXEC.
* Show the display and wait for the user to indicate that
* the next 20 rows should be displayed.
EXEC SQL
DECLARE C2 CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
WHERE EMPNO > :LAST-EMPNO
ORDER BY EMPNO
EXEC SQL
OPEN C2
END-EXEC.
EXEC SQL
CLOSE C2
END-EXEC.
In the preceding example, notice that an additional cursor had to be opened to continue the list and to get
current data. This technique can result in creating an additional ODP that increases the processing time
on the system. In place of the preceding example, the programmer can design the application specifying
ALWCPYDTA(*NO) with the following SQL statements:
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
ORDER BY EMPNO
END-EXEC.
EXEC SQL
OPEN C1
END-EXEC.
* Show the display and wait for the user to indicate that
* the next 20 rows should be displayed.
EXEC SQL
CLOSE C1
END-EXEC.
In the preceding example, the query might perform better if the FOR 20 ROWS clause was used on the
multiple-row FETCH statement. Then, the 20 rows are retrieved in one operation.
Related information
Start SQL Interactive Session (STRSQL) command
EXEC SQL
FETCH EMPT INTO :SALARY
END-EXEC.
EXEC SQL
UPDATE CORPDATA.EMPLOYEE
SET SALARY = :SALARY + 1000
WHERE CURRENT OF EMPT
END-EXEC.
EXEC SQL
FETCH EMPT INTO :SALARY
END EXEC.
EXEC SQL
UPDATE CORPDATA.EMPLOYEE
SET SALARY = :SALARY
WHERE CURRENT OF EMPT
END-EXEC.
You can determine whether SQL statements result in full opens in several ways. The preferred methods
are to use the Database Monitor or by looking at the messages issued while debug is active. You can also
use the CL commands Trace Job (TRCJOB) or Display Journal (DSPJRN).
*ENDPGM The default for all non-ILE precompilers. With this option, a cursor remains open and
accessible only while the program that opened it is on the call stack. When the program
ends, the SQL cursor can no longer be used. Prepared statements are also lost when the
program ends. Locks, however, remain until the last SQL program on the call stack has
completed.
*ENDSQL SQL cursors and prepared statements that are created by a program remain open until the
last SQL program on the call stack has completed. They cannot be used by other programs,
only by a different call to the same program. Locks remain until the last SQL program in the
call stack completes.
*ENDJOB This option allows you to keep SQL cursors, prepared statements, and locks active for
the duration of the job. When the last SQL program on the stack has completed, any SQL
resources created by *ENDJOB programs are still active. The locks remain in effect. The SQL
cursors that were not explicitly closed by the CLOSE, COMMIT, or ROLLBACK statements
remain open. The prepared statements are still usable on subsequent calls to the same
program.
Related reference
Effects of precompile options on database performance
Several precompile options are available for creating SQL programs with improved performance. They
are only options because using them could impact the function of the application. For this reason, the
default value for these parameters is the value that ensures successful migration of applications from
prior releases. However, you can improve performance by specifying other options.
*ENDACTGRP The default for the ILE precompilers. With this option, SQL cursors and prepared
statements remain open until the activation group that the program is running under
ends. They cannot be used by other programs, only by a different call to the same
program. Locks remain until the activation group ends.
*ENDMOD With this option, a cursor remains open and accessible only while the module that
opened it is active. When the module ends, the SQL cursor can no longer be used.
Prepared statements are also lost when the module ends. Locks, however, remain until
the last SQL program in the call stack completes.
General rules for retaining cursor positions for all program calls
Programs compiled with either CLOSQLCSR(*ENDPGM) or CLOSQLCSR(*ENDMOD) must open a cursor
every time the program or module is called, in order to access the data. If the SQL program or module is
called several times, and you want to take advantage of a reusable ODP, then the cursor must be explicitly
closed before the program or module exits.
Using the CLOSQLCSR parameter and specifying *ENDSQL, *ENDJOB, or *ENDACTGRP, you might not
need to run an OPEN and a CLOSE statement on every call. In addition to having fewer statements to run,
you can maintain the cursor position between calls to the program or module.
The following examples of SQL statements help demonstrate the advantage of using the CLOSQLCSR
parameter:
EXEC SQL
DECLARE DEPTDATA CURSOR FOR
SELECT EMPNO, LASTNAME
FROM CORPDATA.EMPLOYEE
WHERE WORKDEPT = :DEPTNUM
END-EXEC.
EXEC SQL
OPEN DEPTDATA
END-EXEC.
EXEC SQL
FETCH DEPTDATA INTO :EMPNUM, :LNAME
END-EXEC.
EXEC SQL
CLOSE DEPTDATA
END-EXEC.
If this program is called several times from another SQL program, it is able to use a reusable ODP.
This technique means that, as long as SQL remains active between the calls to this program, the OPEN
statement does not require a database open operation. However, the cursor is still positioned to the first
result row after each OPEN statement, and the FETCH statement will always return the first row.
In the following example, the CLOSE statement has been removed:
EXEC SQL
DECLARE DEPTDATA CURSOR FOR
SELECT EMPNO, LASTNAME
FROM CORPDATA.EMPLOYEE
WHERE WORKDEPT = :DEPTNUM
END-EXEC.
EXEC SQL
FETCH DEPTDATA INTO :EMPNUM, :LNAME
END-EXEC.
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
WHERE WORKDEPT = 'A00'
ORDER BY LASTNAME
OPTIMIZE FOR 100 ROWS
END EXEC.
Note: The values that can be used for the preceding OPTIMIZE clause are 1–9999999 or ALL.
The optimizer calculates the following costs.
The optimize ratio = optimize for n rows value / estimated number of rows in answer set.
In the previous examples, the estimated cost to sort or to create an index is not adjusted by the optimize
ratio. This method allows the optimizer to balance the optimization and preprocessing requirements.
If the optimize number is larger than the number of rows in the result table, no adjustments are made to
the cost estimates.
If the OPTIMIZE clause is not specified for a query, a default value is used based on the statement type,
value of ALWCPYDTA, or output device.
Related information
INSERT statement
Optimize the number of columns that are selected with SELECT statements
For each column in the SELECT statement, the database manager retrieves the data from the underlying
table and maps it to a host variable in the application program. By minimizing the number of columns that
are specified, processing unit resource usage can be conserved.
Even though it is convenient to code SELECT *, it is far better to explicitly code the columns that are
required for the application. This technique is especially important for index-only access, or if all the
columns participate in a sort operation (as in SELECT DISTINCT and SELECT UNION).
This technique is also important when considering index only access. You minimize the number of
columns in a query and increase the odds that an index can be used to completely satisfy the data
request.
Related information
select-statement
Because the optimizer does not know the internal logic of the RISK_SCORE function, it uses a
default selectivity value. The optimizer will generally assume 33% of the rows satisfy the predicate
RISK_SCORE(EXCHANGE, S.SYMBOL) > .8. If this assumption is not accurate, it could cause the optimizer
to select an inappropriate query plan. To mitigate this, a user who understands the behavior of the
RISK_SCORE function and knows that only 1% of the rows in the table will satisfy the predicate can
rewrite the WHERE clause as:
Another common cause of missing information is when the query selects a small number of rows that
have been added to the table very recently. These rows may not yet be reflected in the statistical
information automatically maintained by the statistics manager, leading the optimizer to believe that
the query selects no rows. As in the above example, the solution is to add a SELECTIVITY clause that
accurately represents the percentage of rows selected by the predicate.
To determine when the use of SELECTIVITY could be helpful for a query, use Visual Explain to identify
operations with significantly inaccurate Percent Selectivity attributes under the Estimated rows selected
and query join info heading. In many cases, you may have a reasonable intuition for the correct selectivity
for the operation. In cases where you need additional information, either Run and Explain or use Visual
Explain on a plan that is cached in the plan cache, since these options provide you with information about
the actual number of rows processed by each operation. These values are given as Actual Rows Selected
Per Plan Step Iteration and can be compared to the estimated Rows Selected Per Plan Step Iteration.
Keep in mind that a given operation could process multiple predicates that have been logically combined.
Since SELECTIVITY applies to an individual predicate, the effect of SELECTIVITY on the overall Percent
Selectivity of the operation can be difficult to predict. In general, the effect of adding SELECTIVITY is
If the preferred plan is known to occur when SALARY > 40000 and it is known that 20% of the rows are
selected by this predicate, then this query can be rewritten as:
When running this query, changes to the host variable value will no longer influence the optimized plan.
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, LASTNAME, WORKDEPT
FROM CORPDATA.EMPLOYEE
WHERE WORKDEPT = 'A00'
ORDER BY LASTNAME
END-EXEC.
The above SQL statement can be written in the following way by using the OPNQRYF command:
OPNQRYF FILE(CORPDATA/EMPLOYEE)
FORMAT(FORMAT1)
QRYSLT(WORKDEPT *EQ ''AOO'')
KEYFLD(LASTNAME)
If you are using host variables to insert or update variable-length columns, use variable length host
variables. Because blanks are not truncated from fixed-length host variables, using fixed-length host
variables can cause more rows to spill into the overflow space. This increases the size of the table.
In this example, fixed-length host variables are used to insert a row into a table:
The host-variable LAST-NAME is not variable length. The string “SMITH”, followed by 35 blanks, is
inserted into the VARCHAR column LAST. The value is longer than the allocate size of 10. 30 of 35 trailing
blanks are in the overflow area.
In this example, variable-length host variables are used to insert a row into a table:
01 VLAST-NAME.
49 LAST-NAME-LEN PIC S9(4) BINARY.
49 LAST-NAME-DATA PIC X(40).
…
MOVE "SMITH" TO LAST-NAME-DATA.
MOVE 5 TO LAST-NAME-LEN.
EXEC SQL
INSERT INTO PHONEDIR
VALUES(:VLAST-NAME, :VFIRST-NAME, :VMIDDLE-NAME, :PHONE)
END-EXEC.
The host variable VLAST-NAME is variable length. The actual length of the data is set to 5. The value is
shorter than the allocated length. It can be placed in the fixed portion of the column.
Running the Reorganize Physical File Member (RGZPFM) command against tables that contain
variable-length columns can improve performance. The fragments in the overflow area that are not in use
are compacted by the Reorganize Physical File Member (RGZPFM) command. This technique
reduces the read time for rows that overflow, increases the locality of reference, and produces optimal
order for serial batch processing.
Choose the appropriate maximum length for variable-length columns. Selecting lengths that are too long
increases the process access group (PAG). A large PAG slows performance. A large maximum length
makes SEQONLY(*YES) less effective. Variable-length columns longer than 2000 bytes are not eligible as
key columns.
Improving performance
For queries that use field procedures, the path length is longer due to the additional processing of calling
the field procedure. In order to improve performance of queries, the SQE optimizer:
• attempts to remove decoding operations, based on the QAQQINI FIELDPROC_ENCODED COMPARISON
setting.
• matches existing indexes over columns that have an associated field procedure.
• creates and uses MTIs over columns with field procedures. The MTI will be created as non-resuable
which means it will not be shared between queries.
• creates statistics over the encoded values through statistics collection.
The SQE optimizer attempts to do the following optimizations:
• optimization of predicates that compare a field procedure column to a constant or host variable. For
example, predicate FP1(4, C1) = ‘abc' is optimized as C1 = FP1(0,‘abc'). With this specific example, the
optimization is done as long as the QAQQINI option is not *NONE.
• remove field procedure decoding operations from join predicates when the same field procedure is
applied to both sides of the join predicate, and no compatibility conversion is required. For example,
join predicate FP1(4,T1.C1) > FP1(4,T2.C1) is rewritten as T1.C1 > T2.C1. With this specific example, the
optimization is done as long as the QAQQINI option is either *ALLOW_RANGE or *ALL. This technique is
also applied to = predicates when the QAQQINI option is *ALLOW_EQUAL.
• remove field procedures from GROUP BY and ORDER BY clauses. For example, ORDER BY FP1(4,C1) is
rewritten as ORDER BY C1 if the QAQQINI setting is either *ALLOW_RANGE or *ALL
The CQE optimizer does not look at the QAQQINI option, which means it always runs in *NONE mode.
*NONE mode requires that all references to the column are decoded before any other operation is
performed. A CQE query does not match any existing indexes when the column has an associated field
procedure. If an index is required, a temporary index is built with the index keys decoded.
Related reference
QAQQINI query options
There are different options available for parameters in the QAQQINI file.
Related information
Defining field procedures
CREATE TABLE
Note the FP1 with the decode operation around the COL2 references in the SELECT list and the WHERE
clause.
Assuming the QAQQINI FIELDPROC_ENCODED COMPARISON is set to *ALLOW_EQUAL, *ALLOW_RANGE
or *ALL:
The query optimizer rewrites the query as:
This rewrite allows the query optimizer to use the encoded index IX1 to implement the WHERE clause and
only cause one invocation of the field procedure for the query.
Example 2
The optimized version removes the FieldProc from the ORDER BY clause assuming that the field
procedure QAQQINI option is set to *ALLOW_RANGE or *ALL:
Example 3
The optimized version removes the field procedure invocation from the GROUP BY clause column col2,
allowing it to group the encoded data and only run the field procedure once per group. The decoded
grouped data is returned to the user. This optimization is done if the field procedure QAQQINI option is
set to *ALLOW_RANGE or *ALL:
IS NULL/IS NOT NULL predicate does not require calling the field procedure field-decode option 4. The
field procedure cannot change the nullability of the field.
DELIMIT_NAME ( name )
name A character or graphic string expression that identifies a name. The string must contain only
characters allowed in an SQL identifier. If the string is longer than 128 characters, it will be
truncated to 128 characters.
The result of the function is a varying length character string that contains name correctly delimited. This
includes delimiting reserved words. If name is the null value or an empty string, null is returned.
Example
• Delimit these names:
VALUES DELIMIT_NAME('ABC'),
DELIMIT_NAME('abc'),
DELIMIT_NAME('test"name'),
DELIMIT_NAME('test''name2'),
DELIMIT_NAME('NEW')
ABC
"abc"
"test""name"
"test'name2"
"NEW"
OVERRIDE_QAQQINI procedure
The OVERRIDE_QAQQINI procedure creates and modifies a temporary version of the QAQQINI file.
The temporary QAQQINI file will be created in QTEMP. It inherits all query options that are already
in place for the job. The OVERRIDE_QAQQINI procedure can be called multiple times to establish job
specific QAQQINI settings.
The procedure can also be called to discard the temporary customization settings.
Authorization: For most QAQQINI options, none is required. For the following three options, the caller
must have *JOBCTL special authority or be authorized to the QIBM_DB_SQLADM function usage ID. These
options are more restrictive because they can affect the performance of other jobs.
• QUERY_TIME_LIMIT when the option-value is not 0.
• STORAGE_LIMIT
• PARALLEL_DEGREE
, option-name
OPTION_NAME =>
)
, option-value
OPTION_VALUE =>
option-name A character or graphic string expression that identifies the name of the QAQQINI option to
be changed.
This parameter is required when override-option is 2. For options 1 and 3, it can be
omitted or passed as the empty string.
option-value A character or graphic string expression that identifies the value to assign to the QAQQINI
option identified by option-name.
This parameter is required when override-option is 2. For options 1 and 3, it can be
omitted or passed as the empty string.
Example
• Establish the temporary override for QAQQINI. The job's current QAQQINI values will be used as the
initial values.
CALL QSYS2.OVERRIDE_QAQQINI(1);
• Improve the chances that you can acquire an exclusive lock for a database file. Multiple calls to the
procedure can be used to change more than one QAQQINI value.
• Discard the temporary QAQQINI file and revert to using the job's version of the QAQQINI file.
CALL QSYS2.OVERRIDE_QAQQINI(3);
OVERRIDE_TABLE procedure
The OVERRIDE_TABLE procedure sets the blocking size for a table. This procedure uses the Override with
Database File (OVRDBF) and Delete Override (DLTOVR) CL commands to control the blocking factor when
the file is accessed within the current job.
Authorization: The caller must have *USE authority to the OVRDBF and DLTOVR CL commands.
Example
• Override the EMPLOYEE table to use 256K blocking for sequential processing.
Related reference
Control database manager blocking
To improve performance, the SQL runtime attempts to retrieve and insert rows from the database
manager a block at a time whenever possible.
PARSE_STATEMENT ( SQL-statement
SQL_STATEMENT =>
, naming
NAMING =>
, decimal-point
DECIMAL_POINT =>
)
, SQL-string-delimiter
SQL_STRING_DELIMITER =>
SQL-statement A character or graphic string expression that contains a valid SQL statement. The
maximum string length is 2 megabytes.
naming A character or graphic string expression that defines the naming rule for the statement.
decimal-point A character or graphic string expression that defines the decimal point for numeric
constants in SQL-statement.
SQL-string- A character or graphic string expression that defines the string delimiter for strings
delimiter in SQL-statement. Delimited identifiers in the SQL statement will use the opposite
character.
*APOSTSQL or ' The apostrophe character (') is used to delimit strings. This is the
default.
*QUOTESQL or " The quote character (") is used to delimit strings.
When the SQL statement is parsed, object names are identified and a result row is returned for every
name. This is done at the SQL parser level where names are identified strictly by where they appear in the
syntax. The following rules apply:
• Names used in data change statements and in any query construct are returned.
• For CALL, the procedure being called is returned.
• For DDL statements, most items are returned. Notable exceptions are:
– RCDFMT name for CREATE TABLE, CREATE VIEW, and CREATE INDEX.
– FIELDPROC program name for CREATE TABLE and ALTER TABLE.
– Columns used as partitioning keys for CREATE TABLE and ALTER TABLE.
– Parameter names for CREATE FUNCTION and CREATE PROCEDURE.
– Return column names for CREATE FUNCTION (Table).
– External program name for functions and procedures.
Any statement that does not contain these constructs, a query, or an expression returns no rows.
• Names in a routine-body, triggered-action, and trigger-body are not returned. To see these references,
use QSYS2.SYSPROGRAMSTMTSTAT to find all the statements for the generated program or service
program and pass each of them as an argument to this table function.
• If the SQL statement is the null value, an empty string, a string of all blanks, or contains a syntax error,
no row is returned.
The result of the function is a table containing a row for each name reference with the format shown in the
following table. All the columns are null capable.
HISTORY TABLE Table is the history table for an ALTER TABLE statement
with ADD VERSIONING.
TARGET TABLE This is the table that will be affected for an insert,
update, delete, merge, truncate, lock table, or refresh
table statement. The value is also returned for any
explicitly specified columns from the target table for
insert, update, and merge.
NAME_START_POSITION INTEGER Position within the SQL-statement string that this name begins. For qualified
TABLE names, this is the position where the RDB or schema name begins. For all
other name types, this is the position of the name.
Example
For every program and service program in library APPLIB, find all the references to table names in static
SQL statements.
Example
Configure SELF to capture detail for all jobs started in the future, for any SQL statements that fail with
SQLCODE = -913 or SQLCODE = -204.
SQL_ERROR_LOG view
The SQL_ERROR_LOG view returns information captured by the SQL Error Logging Facility (SELF).
Authorization: The caller must have *ALLOBJ special authority or be authorized to the
QIBM_DB_SQLADM function usage identifier.
The following table describes the columns in the view. The system name is SQL_ERROR. The schema is
QSYS2.
Table 65. SQL_ERROR_LOG view
LOGGED_SQLCODE LOG_CODE INTEGER The SQLCODE for this instance of SELF detail.
STATEMENT_TEXT STMTTEXT DBCLOB(2M) CCSID 1200 The SQL statement that encountered the SQLSTATE
that corresponds to LOGGED_SQLCODE. Can contain
the special value of UNKNOWN if the statement text
is not available.
STATEMENT_OPERATION OP_CODE CHAR(2) The SQL statement operation. For a list of values, see
the QQC21 field in “Database monitor view 1000 -
SQL Information” on page 1161.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name of the most recent occurrence
of LOGGED_SQLCODE.
THREAD_ID THREAD_ID BIGINT The thread identifier of the most recent occurrence
of LOGGED_SQLCODE. A thread ID of 0 indicates that
the thread ID is not available.
ADOPTED_USER_NAME ADOPT_USER VARCHAR(10) Value of the CURRENT_USER special register for the
most recent occurrence of LOGGED_SQLCODE.
USER_NAME USER_NAME VARCHAR(10) Value of the USER special register for the most recent
occurrence of LOGGED_SQLCODE.
SYSTEM_USER_NAME SYS_USER VARCHAR(10) Value of the SYSTEM_USER special register for the
most recent occurrence of LOGGED_SQLCODE.
INITIAL_ADOPTED_USER_NAM INIT_ADOPT VARCHAR(10) Value of the CURRENT_USER special register for the
E most recent occurrence of LOGGED_SQLCODE.
INITIAL_STACK INIT_STACK CLOB(1M) CCSID 1208 The call stack of the current thread for the initial
occurrence of LOGGED_SQLCODE.
SQLCODE_INFO ( sqlcode )
P_SQLCODE =>
sqlcode An integer value that represents a positive (warning) or negative (error) SQLCODE.
The result of the function is a table containing one row for a recognized SQLCODE value. If an unsupported
SQLCODE value is provided, no row is returned. The columns of the result table are described in the
following table. The result columns are nullable.
Table 66. SQLCODE_INFO table function
Example
Return the message information for SQLCODE -204.
VALIDATE_SELF ( self-sqlcodes )
SELF_SQLCODES =>
self-sqlcodes A character or graphic string expression that contains one or more SQLCODE values,
separated by commas or blanks.
Examples
• Validate a string of SQLCODE values before assigning it to the SELFCODES global variable.
SET SYSIBMADM.SELFCODES =
SYSIBMADM.VALIDATE_SELF('-913, -104,,+406,802');
• Configure SELF to capture detail for all jobs started in the future, for any SQL statements that fail with
SQLCODE = -913.
WLM_SET_CLIENT_INFO procedure
The WLM_SET_CLIENT_INFO procedure sets values for the SQL client special registers.
Authorization: None required.
, client-wrkstnname
CLIENT_WRKSTNNAME =>
, client-applname
CLIENT_APPLNAME =>
, client-acctng
CLIENT_ACCTSTR =>
, client-programid
CLIENT_PROGRAMID =>
)
, verbose
VERBOSE =>
client-userid A character or graphic string expression containing the value to set for the CURRENT
CLIENT_USERID special register for the current connection.
If this parameter is omitted, the value of the CURRENT CLIENT_USERID special
register is not changed.
client- A character or graphic string expression containing the value to set for the CURRENT
wrkstnname CLIENT_WRKSTNNAME special register for the current connection.
If this parameter is omitted, the value of the CURRENT CLIENT_WRKSTNNAME special
register is not changed.
client- A character or graphic string expression containing the value to set for the CURRENT
applname CLIENT_APPLNAME special register for the current connection.
If this parameter is omitted, the value of the CURRENT CLIENT_APPLNAME special
register is not changed.
client-acctng A character or graphic string expression containing the value to set for the CURRENT
CLIENT_ACCTNG special register for the current connection.
If this parameter is omitted, the value of the CURRENT CLIENT_ACCTNG special
register is not changed.
client- A character or graphic string expression containing the value to set for the CURRENT
programid CLIENT_PROGRAMID special register for the current connection.
If this parameter is omitted, the value of the CURRENT CLIENT_PROGRAMID special
register is not changed.
verbose A character or graphic string expression that indicates whether the informational,
severity 10 message SQL799C should be sent to the joblog when this procedure is
called. The message lists the changed client special registers and their new values.
NO SQL799C will not be sent to the joblog when this procedure is called.
Example
• Change the values of the CURRENT CLIENT_USERID and CURRENT CLIENT_PROGRAMID special
registers for the current connection.
Performance Services
These services include procedures that provide interfaces to work with indexes and a view to see
information about database monitors.
Related reference
QAQQINI file override support
If you find working with the QAQQINI query options file cumbersome, consider using the
QSYS2.OVERRIDE_QAQQINI procedure. Instead of creating, managing, and using a QAQQINI *FILE
object directly, this procedure can be called to work with a temporary version of the INI file. It uses
user-specified options and values. The support relies upon the QTEMP library, so any changes affect only
the job which calls the procedure.
ACT_ON_INDEX_ADVICE procedure
The ACT_ON_INDEX_ADVICE procedure creates new indexes for a table based on indexes that have been
advised for the table.
Authorization: See Note below.
schema-name A character string containing the system name of the schema containing the table.
table-name A character string containing the system name of the table. If NULL is passed, this
parameter is not used to select the target index advice.
times-advised The number of times an index should have been advised before creating a permanent
index. If NULL is passed, this parameter is not used to select the target index advice.
mti-used The number of times a maintained temporary index (MTI) has been used because a
matching permanent index did not exist. If NULL is passed, this parameter is not used
to select the target index advice.
average- The average estimated number of seconds needed to execute the query that drove the
estimate index advice. If NULL is passed, this parameter is not used to select the target index
advice.
For each potential index meeting the specified criteria, a CREATE INDEX statement will be run to generate
the permanent index. A radix index will be named name_RADIX_INDEX_n. An EVI index will be named
name_EVI_INDEX_n. The name represents the table name and n is a unique number. The row containing
this advised index is removed from the QSYS2.SYSIXADV table.
Examples
For schema PRODLIB, find all instances of index advice where a maintained temporary index was used
more than 1000 times and create permanent SQL indexes.
CALL SYSTOOLS.ACT_ON_INDEX_ADVICE(‘PRODLIB’,NULL,NULL,1000,NULL)
Related reference
SYSTOOLS
SYSTOOLS is a set of Db2 for IBM i supplied examples and tools.
ACTIVE_QUERY_INFO (
job-name
JOB_NAME =>
, job-user
JOB_USER =>
, job-number
JOB_NUMBER =>
)
, user-name
USER_NAME =>
job-name A character or graphic string expression that contains an unqualified job name that
determines the job information to be returned.
The job name can end with a wildcard character. For example, 'QPADEV*' indicates that any
job name starting with the characters 'QPADEV' is a match.
The string can be the following special values:
If this parameter is not specified, is an empty string, or is the null value, information for all
jobs is returned.
job-user A character or graphic string expression that contains a user name that determines the job
information to be returned.
The job user name can end with a wildcard character. For example, 'Q*' indicates that any job
user name starting with the character 'Q' is a match.
The string can be the following special value:
If this parameter is not specified, is an empty string, or is the null value, information for all
users is returned.
job- A character or graphic string expression that contains a job number that determines the job
number information to be returned.
The string can be the following special value:
If this parameter is not specified, is an empty string, or is the null value, information for all
job numbers is returned.
user- A character or graphic string expression that contains a user name. This is the user profile
name under which the initial thread is running at this time.
The user name can end with a wildcard character. For example, 'BA*' indicates that any user
name starting with the characters 'BA' is a match.
The string can be the following special value:
If this parameter is not specified, is an empty string, or is the null value, the results are not
filtered by the user name used by the initial thread .
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 67. ACTIVE_QUERY_INFO table function
USER_NAME VARCHAR(10) The user profile under which the initial thread is running at this time.
For jobs that swap user profiles, this user profile name and the user
profile that started the job can be different.
HLL High Level Language (HLL) open done using SQE. HLL
opens include opens done via RPG, C, and COBOL
PSEUDO_CLOSED VARCHAR(3) The current state of the SQL cursor associated with the query.
NO Query is open
FILE_NAME VARCHAR(10) The database file name of the first table referenced by the query.
NUMBER_OF_PSEUDO_CLOSES BIGINT The number of complete runs for this full open of the query.
Returns 0 if this query has not been pseudo-closed.
CURRENT_ROW_COUNT BIGINT If this cursor is not pseudo-closed, the current number of rows
fetched for this run of the query.
Contains the null value if this cursor is currently pseudo-closed.
CURRENT_TEMPORARY_STORAGE BIGINT The current amount of temporary storage, in MB, used by the query.
This size does not include storage used by MTIs.
CURRENT_PAGE_FAULTS BIGINT If this cursor is not pseudo-closed, the current number of page faults
for this run of the query.
Contains the null value if this cursor is currently pseudo-closed.
MTI_SIZE BIGINT The current size of MTIs, in MB. This size includes shared MTIs.
Contains the null value if no MTIs are used by the query.
AVERAGE_ROW_COUNT BIGINT The average number of rows fetched for pseudo-closed runs of this
query.
Contains the null value if there are no prior runs.
AVERAGE_RUNTIME BIGINT The average runtime in microseconds for pseudo-closed runs of this
query.
Contains the null value if there are no prior runs.
AVERAGE_PAGE_FAULTS BIGINT The average number of page faults for pseudo-closed runs of this
query.
Contains the null value if there are no prior runs.
Examples
• Retrieve information about all active SQE queries on the system.
SELECT *
FROM TABLE(QSYS2.ACTIVE_QUERY_INFO( ));
ADD_QUERY_THRESHOLD procedure
The ADD_QUERY_THRESHOLD procedure defines a new threshold to be used by the Query Supervisor.
Adding a threshold only affects subsequently executed queries. Queries that are currently running
continue to use the thresholds that were in effect when the query execution was initiated. The Query
Supervisor only supervises user jobs. It does not affect system jobs or queries run by the operating
system. The thresholds only apply to resources used by the SQL Query Engine (SQE).
Query Supervisor thresholds can include using job name, user name, and subsystem filters. The filters
are combined to restrict the set of jobs for the rule. For jobs that meet the filtering criteria, when
the threshold is met or exceeded, any exit programs registered with the QIBM_QQQ_QRY_SUPER exit
point are called. An exit program can be used to implement actions such as query logging or real-time
notification. It can also direct SQE to terminate the query. The exit program interface is described here:
Query Supervisor Exit Program.
When the first threshold is defined for a system, any active jobs, including the job that runs the initial
ADD_QUERY_THRESHOLD, will not be affected by Query Supervisor thresholds.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
threshold-type ,
THRESHOLD_TYPE =>
threshold-value
THRESHOLD_VALUE =>
, job-names
JOB_NAMES =>
, include-users
INCLUDE_USERS =>
, exclude-users
EXCLUDE_USERS =>
, subsystems
SUBSYSTEMS =>
, detection-frequency
DETECTION_FREQUENCY =>
)
, long-comment
LONG_COMMENT =>
threshold- A character or graphic string that provides a name for the threshold. The name can be up
name to 30 characters long and can contain any characters including blanks. The name cannot
be the same as an existing threshold name.
threshold- A character or graphic string that specifies the type of the threshold to be enforced.
type
CPU TIME The total processing unit time used by the query, in seconds.
ELAPSED TIME The total clock time, in seconds.
TEMPORARY STORAGE The amount of storage, in megabytes (MB), that the query
uses.
TOTAL IO COUNT The total number of I/O operations.
threshold- A big integer value that contains the threshold value, in units defined by the specified
value threshold-type. The value must be greater than 0.
job-names A character or graphic string that specifies up to 100 job names separated by either
a blank or a comma. Each job name can end with a wildcard character. For example,
'QPADEV*' indicates that any job name starting with the characters 'QPADEV' is a match.
include-users A character or graphic string that specifies up to 100 user names separated by either
a blank or a comma. A group profile does not expand to include all profiles that are
members of the group. Each name can end with a wildcard character. For example,
'ADM*' indicates that any user name starting with the characters 'ADM' is a match.
Queries where the effective user of the thread matches one of these names are eligible
to be supervised. If one or more names are specified for include-users, the exclude-users
parameter must have a value of *NONE. Can contain the following special value:
*ALL Jobs for all users are supervised. This is the default.
exclude- A character or graphic string that specifies up to 100 user names separated by either
users a blank or a comma. A group profile does not expand to include all profiles that are
members of the group. Each name can end with a wildcard character. For example,
'ADM*' indicates that any user name starting with the characters 'ADM' is a match.
Queries where the effective user of the thread matches one of these names are not
supervised. If one or more names are specified for exclude-users, the include-users
parameter must have a value of *ALL. Can contain the following special value:
*NONE No jobs are explicitly eliminated from being supervised based on the user
name. This is the default.
subsystems A character or graphic string that specifies up to 100 subsystem names separated by
either a blank or a comma. Each name can end with a wildcard character. For example,
'RSBS*' indicates that any subsystem name starting with the characters 'RSBS' is a
match.
Only jobs running in a subsystem that match one of these names are eligible to be
supervised. Can contain the following special value:
detection- An integer value that specifies the minimum time, in seconds, between calls to exit
frequency programs registered with the QIBM_QQQ_QRY_SUPER exit point for this threshold for
a specific thread. During the detection-frequency time interval following a threshold
detection, the Query Supervisor does not process additional instances for this threshold
in the same thread. Each time a query is run in a thread, a specific threshold can be
processed at most once during the execution of that query.
The detection-frequency provides a protection from having a specific threshold
recognized and processed more frequently than desired. If the same threshold is
encountered within the same thread and the detection-frequency time period has not yet
completed, the associated exit programs are not called and there is no external evidence
that the Query Supervisor did not perform threshold detection.
The default is 600 (10 minutes).
long- A character or graphic string that describes this Query Supervisor threshold. It can be up
comment to 2000 characters long.
Examples
• Set a threshold value for total CPU time to 30 seconds for all jobs. When this value is reached, any
registered exit programs will be called.
• Set a threshold value for temporary storage to 10 megabytes for all jobs except for those running with
the BATCHRUN user profile. Set a detection frequency of 2 minutes. When the storage threshold value
is reached, any registered exit programs will be called. If the same thread reaches this threshold for a
different query within 2 minutes, the registered exit programs will not be called.
DATABASE_MONITOR_INFO view
The DATABASE_MONITOR_INFO view returns information about database monitors and plan cache event
monitors on the server. Database monitors are started using the Start Database Monitor (STRDBMON)
command. The QSYS2.START_PLAN_CACHE_EVENT_MONITOR procedure is used to start a plan cache
event monitor. SQL Performance Monitors within IBM i Navigator are synonymous with database monitors
and are included in this view.
Authorization: None required.
The following table describes the columns in the view. The system name is DBMON_INFO. The schema is
QSYS2.
Table 68. DATABASE_MONITOR_INFO view
System Column
Column Name Name Data Type Description
MONITOR_FILE MONFILE VARCHAR(10) The file to which the database activity detail is written for this
monitor.
System Column
Column Name Name Data Type Description
IASP_NUMBER IASPNUMBER SMALLINT The independent auxiliary storage pool (IASP) number for the
monitor file.
MONITOR_MEMBER_OPTION MBROPT VARCHAR(7) Value used for the member replace option the last time this
monitor was started.
Nullable
• REPLACE
• ADD
Contains the null value for an EVENT monitor.
NUMBER_ROWS CARD BIGINT The number of rows in the database monitor file.
DATA_SIZE SIZE BIGINT The total size, in bytes, of the database monitor file.
MONITOR_JOB_FILTER JOB VARCHAR(32) Qualified job name for this monitor. For an EVENT monitor, this is
the job that started the monitor. Following the qualified job name
is the filter operator that applies to the job name. This is either *EQ
or *NE.
The special value of *ALL indicates all jobs on the system are
monitored. A generic name is allowed for both the job name and
the user name.
HOST_VARIABLE HOSTVAR VARCHAR(9) How host variables are handled in this database monitor.
FORCE_RECORDS FRCRCD SMALLINT The number of records to be held in the buffer before forcing
the records to be written to the file when running with a private
Nullable monitor.
Contains the null value if the system calculates the value or for an
EVENT monitor.
RUN_THRESHOLD_FILTER RUNTHLD INTEGER The filtering threshold, in seconds, based on the estimated run
time of SQL statements in this monitor.
Nullable
Contains the null value if a run time threshold is not used for
filtering or for an EVENT monitor.
STORAGE_THRESHOLD_FILTER STGTHLD INTEGER The filtering threshold, in megabytes, based on the estimated
temporary storage usage of SQL statements in this monitor.
Nullable
Contains the null value if a temporary threshold is not used for
filtering or for an EVENT monitor.
INCLUDE_SYSTEM_SQL INCSYSSQL VARCHAR(3) Monitor includes records for system-generated SQL statements.
System Column
Column Name Name Data Type Description
FILE_FILTER FTRFILE VARCHAR(2728) A list of up to 10 qualified file references that are used for filtering.
Following each file name is the filter operator that applies to the
Nullable file name. This is either *EQ or *NE. When more than one file is
listed, a comma and a single blank separate the entries. Either the
file name or the library name can be a generic name.
A special value of *ALL for the file name indicates all files in the
library.
Contains the null value if no database files are used for filtering.
USER_FILTER FTRUSER VARCHAR(158) A list of up to 10 user profiles that are used for filtering. Following
each user profile name is the filter operator that applies to the
Nullable user profile. This is either *EQ or *NE. When more than one profile
is listed, a comma and a single blank separate the entries. A profile
name can be a generic name.
Contains the null value if the user profile is not used for filtering.
TCPIP_FILTER FTRINTNETA VARCHAR(254) The TCP/IP address or host name is used for filtering.
Nullable This is an IPv4, IPv6, or IP host domain name, or the special value
of *LOCAL.
Contains the null value if the TCP/IP address or host name is not
used for filtering or for an EVENT monitor.
LOCAL_PORT_FILTER FTRLCLPORT INTEGER Filtering is based on the local TCP/IP port number. Monitor records
will be created for TCP/IP database server jobs running on behalf
Nullable of the specified local TCP/IP port. Jobs named QRWTSRVR and
QZDASOINIT are examples of these server jobs.
The IBM i well defined port numbers are documented here: Port
numbers for host servers and server mapper.
Contains the null value if the port number is not used for filtering
or for an EVENT monitor.
Contains the null value if the query governor is not used for
filtering or for an EVENT monitor.
CLIENT_ACCTNG_FILTER FTRCLTACG VARCHAR(128) The CURRENT CLIENT_ACCTNG special register is used for
filtering.
Nullable
Contains the null value if the CURRENT CLIENT_ACCTNG special
register is not used for filtering or for an EVENT monitor.
CLIENT_APPLNAME_FILTER FTRCLTAPP VARCHAR(128) The CURRENT CLIENT_APPLNAME special register is used for
filtering.
Nullable
Contains the null value if the CURRENT CLIENT_APPLNAME
special register is not used for filtering or for an EVENT monitor.
CLIENT_PROGRAMID_FILTER FTRCLTPGM VARCHAR(128) The CURRENT CLIENT_PROGRAMID special register is used for
filtering.
Nullable
Contains the null value if the CURRENT CLIENT_PROGRAMID
special register is not used for filtering or for an EVENT monitor.
CLIENT_USERID_FILTER FTRCLTUSR VARCHAR(128) The CURRENT CLIENT_USERID special register is used for
filtering.
Nullable
Contains the null value if the CURRENT CLIENT_USERID special
register is not used for filtering or for an EVENT monitor.
CLIENT_WRKSTNNAME_FILTER FTRCLTWS VARCHAR(128) The CURRENT CLIENT_WRKSTNNAME special register is used for
filtering.
Nullable
Contains the null value if the CURRENT CLIENT_WRKSTNNAME
special register is not used for filtering or for an EVENT monitor.
System Column
Column Name Name Data Type Description
SQL_CODE_FILTER FTRSQLCODE VARCHAR(7) How the SQLCODE result from a statement execution is used for
filtering.
Nullable
NONZERO Any SQL statement with an SQLCODE value that is
non-zero is included in the monitor.
Contains the null value if the SQLCODE for a statement is not used
for filtering or for an EVENT monitor.
SQLCODE_VALUE SQLCODEVAL INTEGER The positive or negative SQLCODE value to use for filtering.
Examples
Example 1: Get the MONITOR_ID for all the active PUBLIC monitors and the file names associated with
the MONITOR_IDs.
Example 2: Find the active monitors that have outfiles larger than 1Gig.
Example 3: Find any active monitors that are filtering based upon a specific SQLCODE (FTRSQLCODE).
Example 4: Get the MONITOR_ID for a user's SQL plan cache event monitor and use it to end the active
event monitor.
HARVEST_INDEX_ADVICE procedure
The HARVEST_INDEX_ADVICE procedure generates one or more CREATE INDEX statements in source file
members for a specified table based on indexes that have been advised for the table.
Authorization: See Note below.
schema-name A character string containing the system name of the schema containing the table.
table-name A character string containing the system name of the table.
times-advised The number of times an index should have been advised before creating a permanent
index. Pass a value of 1 to not limit index creation by the number of times advised.
mti-used The number of times a maintained temporary index (MTI) has been used because a
matching permanent index did not exist. Pass a value of 0 to not limit index creation
by MTI use.
average- The average estimated number of seconds needed to execute the query that drove
estimate the index advice. Pass a value of 0 to not limit index creation by the average query
estimate.
output-library A character string value containing the name of the library for the output source file.
output-file A character string value containing the name of the output source file. The file must
exist and must be a source physical file.
For each potential index meeting the specified criteria, a CREATE INDEX statement to create the
permanent index will be generated in a member in the source file provided to this procedure. A radix
index will be named name_RADIX_INDEX_n. An EVI index will be named name_EVI_INDEX_n. The
name represents the table name and n is a unique number. The row containing this advised index is
removed from the QSYS2.SYSIXADV table.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to process index advice using
an SQL procedure. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be
extracted and used as a model for building similar procedures, or to create a customized version within a
user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Harvest create index statements for file TOYSTORE/SALES into source physical file QGPL/INDEXSRC.
Then use RUNSQLSTM to create the indexes.
BEGIN
DECLARE NOT_FOUND CONDITION FOR '02000';
DECLARE ERROR_COUNT INTEGER DEFAULT 0;
DECLARE AT_END INT DEFAULT 0;
DECLARE V_INDEX_COUNT INTEGER DEFAULT 0;
DECLARE V_PARTITION_NAME VARCHAR(10);
DECLARE INDEX_SOURCE_CURSOR CURSOR FOR
SELECT TABLE_PARTITION FROM QSYS2.SYSPARTITIONSTAT
WHERE TABLE_SCHEMA = 'QGPL' AND TABLE_NAME = 'INDEXSRC';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET ERROR_COUNT = ERROR_COUNT + 1;
Related reference
SYSTOOLS
SYSTOOLS is a set of Db2 for IBM i supplied examples and tools.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
MTI_INFO (
table-schema
TABLE_SCHEMA =>
)
, table-name
TABLE_NAME =>
table- A character or graphic string expression that contains the schema name of the base table
schema for the MTIs to be returned. The schema name may be either the SQL or the system schema
name.
Can contain the following special value:
*ALL Information for MTIs in all schemas with a base table specified by table-schema is
returned. This is the default.
If this parameter contains an empty string or the null value, *ALL is used.
table- A character or graphic string expression that contains the table name of the base table for
name the MTIs to be returned. The table name may be either the SQL or the system table name.
Can contain the following special value:
*ALL Information for all MTIs with a base table in table-schema is returned. This is the
default.
If this parameter contains an empty string or the null value, *ALL is used.
The result of the function is a table containing multiple rows with the format shown in the following table.
Each row contains information for one MTI on the system. All columns are nullable.
TABLE_SCHEMA VARCHAR(128) Schema name of the base table that the MTI is created over.
TABLE_NAME VARCHAR(128) Name of the base table that the MTI is created over.
REFERENCE_COUNT BIGINT The current number of references to this MTI. This includes plans in
the plan cache and open queries that are using this MTI. When this
count goes to 0, the MTI will be deleted.
SPARSE_DEFINITION DBCLOB(10000) CCSID 1200 The predicate used to create the sparse MTI.
Contains the null value if SPARSE is NO.
QRO_HASH VARCHAR(8) An internally generated identifier which identifies the SQE query which
originally created the MTI.
PLAN_IDENTIFIER DECIMAL(20,0) Identifies the plan within the plan cache which originally created the
MTI.
USER_NAME VARCHAR(10) The effective user of the thread that created the MTI.
QUALIFIED_JOB_NAME VARCHAR(28) The fully qualified job name of the job that created the MTI.
FILE_NAME VARCHAR(10) The database file name of the base table that the MTI is created over.
Example
• Return information about all MTIs that exist over the APPLIB/EMPLOYEE table.
QUERY_SUPERVISOR view
The QUERY_SUPERVISOR view contains the threshold rules defined for the Query Supervisor.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
The following table describes the columns in the view. The system name is QRY_SUPER. The schema is
QSYS2.
Table 70. QUERY_SUPERVISOR view
CCSID 1200
EXCLUDE_USERS EXCL_USERS VARCHAR(1099) A list of user names that are not supervised by
this threshold. Each name in the list is padded
Nullable with blanks to fill ten characters, with a single
comma separating the name entries.
Contains the null value if no user names are
excluded.
Example
• List all the thresholds defined for the Query Supervisor.
SELECT *
FROM QSYS2.QUERY_SUPERVISOR ORDER BY THRESHOLD_TYPE, THRESHOLD_VALUE DESC;
REMOVE_INDEXES procedure
The REMOVE_INDEXES procedure drops any indexes meeting the specified criteria.
Authorization: See Note below.
schema-name A character string containing the system name of the schema containing the indexes to
be evaluated. If the NULL value is passed, the entire database is processed.
times_used A big integer value indicating the number of times an index has been used.
index-age A character string containing an SQL labeled duration, such as '2 MONTHS'.
The procedure will evaluate all indexes for the specified schema-name value and drop any index that does
not meet the times-used and index-age threshold. If the number of times the index has been used by a
query and used for statistics is less than the times-used value, the index is considered under utilized and
is a candidate to be dropped. An index that has existed at least the length of time indicated by index-age
is also a candidate to be dropped. Any index that meets both criteria is dropped.
Only index names that have names like name_RADIX_INDEX_x or name_EVI_INDEX_x will be
considered by this procedure.
Examples
• Remove any index in MYLIB that is older than a month that has never been used.
• Remove all indexes from all schemas on the system that have existed for at least two weeks and haven't
been used at least 100 times.
Related reference
SYSTOOLS
SYSTOOLS is a set of Db2 for IBM i supplied examples and tools.
REMOVE_QUERY_THRESHOLD procedure
The REMOVE_QUERY_THRESHOLD procedure removes a threshold that is monitored by the Query
Supervisor. Removing a threshold only affects subsequently executed queries. Queries that are currently
running will continue to use the thresholds that were in effect when the query execution was initiated.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
REMOVE_QUERY_THRESHOLD ( threshold-name )
THRESHOLD_NAME =>
threshold-name A character or graphic string that specifies the name of an existing threshold to be
removed.
Example
Remove the MAXTIME threshold rule.
RESET_TABLE_INDEX_STATISTICS procedure
The RESET_TABLE_INDEX_STATISTICS procedure clears usage statistics for indexes defined over a table
or tables and optionally deletes rows from the index advice tracking table.
Authorization: The counts will only be reset when the caller has *OBJMGT and *OBJOPR authority on the
table. For each index found over the table, *OBJOPR authority to the index is required. If the caller does
not have the required authority to the table, the object is skipped and no warning is returned. If the caller
does not have the required authority to the index, the object is skipped and an SQL warning is returned.
RESET_TABLE_INDEX_STATISTICS ( schema-name ,
SCHEMA_NAME =>
table-name
TABLE_NAME =>
)
, delete-advice
DELETE_ADVICE =>
schema- A character string expression for the name of the schema or schemas to use. The name
name is case-sensitive and must not be delimited. Wildcard characters (_ and %) are allowed in
the string following the rules for the SQL LIKE predicate.
table-name A character string expression for the name of the table or tables to use. The name is
case-sensitive and must not be delimited. Wildcard characters (_ and %) are allowed in
the string following the rules for the SQL LIKE predicate.
delete- A character string expression that indicates whether this procedure should remove rows
advice from the index advice tracking table.
NO Index advice for the table is not affected. This is the default.
YES This procedure will delete rows from the index advice tracking table (QSYS2/
SYSIXADV) that correspond to schema-name and table-name. To be removed, an
index must exist and the user must be authorized to the index.
The procedure writes information related to every index processed into an SQL global temporary table.
The fields LAST_QUERY_USE, LAST_STATISTICS_USE, LAST_USE_DATE, and NUMBER_DAYS_USED are
not affected. The following query will display the results of the last call to the procedure:
SELECT * FROM SESSION.SQL_INDEXES_RESET
The table that is created contains the following columns:
Table 71. SQL_INDEXES_RESET result table
NUMBER_DISTRIBUTED_PARTITIONS NUMBE00001 INTEGER If the table is a distributed table, contains the total number of
partitions.
LAST_QUERY_USE LAST_00002 TIMESTAMP The timestamp of the last time the SQL index was used in a query
since the last time the usage statistics were reset.
LAST_STATISTICS_USE LAST_00003 TIMESTAMP The timestamp of the last time the SQL index was used by the
optimizer for statistics since the last time the usage statistics
were reset.
QUERY_USE_COUNT QUERY00001 BIGINT The number of times the SQL index was used in a query since the
last time the usage statistics were reset.
QUERY_STATISTICS_COUNT QUERY00002 BIGINT The number of times the SQL index was used by the optimizer for
statistics since the last time the usage statistics were reset.
Examples
• Zero the statistics for all indexes over table TOYSTORE.SALES
• Zero the statistics for all indexes over any table in schema TOYSTORE whose name starts with the letter
S.
CHANGE_PLAN_CACHE_SIZE procedure
The CHANGE_PLAN_CACHE_SIZE procedure provides a way to change the maximum amount of storage
used by the plan cache.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
CHANGE_PLAN_CACHE_SIZE ( integer-expression )
integer- A numeric expression that specifies the size, in megabytes, that the plan cache cannot
expression exceed. Once set, the maximum size of the plan cache will be retained across IPLs and
IBM i operating system upgrades. If the value is zero, the plan cache is reset to its default
value which allows the plan cache to be auto-sized by the database.
Example
• Change the plan cache maximum size to 3072 megabytes:
CALL QSYS2.CHANGE_PLAN_CACHE_SIZE(3072);
CLEAR_PLAN_CACHE (
qro-hash
QRO_HASH => , plan-identifier
PLAN_IDENTIFIER =>
qro-hash A character or graphic string expression that identifies a set of plans for a specific SQE
query. If qro-hash is not specified, the null value is used.
plan-identifier A numeric value which uniquely identifies a plan within the plan cache. If plan-identifier
is not specified, the null value is used.
If qro-hash is specified and plan-identifier is not specified, the procedure will clear all the plans from the
SQL plan cache with that qro-hash. If a qro-hash and a plan-identifier are specified, that specific plan will
be removed. If no matching plan is found, the procedure returns without error.
If no parameters are specified, or a null value is specified for both qro-hash and plan-identifier, the
procedure will clear all plans in the SQL plan cache that exist at the time the procedure is run.
Besides clearing the plan information, any Maintained Temporary Indexes (MTIs) not currently in use by a
query will be deleted as part of the clear operation. Queries run while the CLEAR_PLAN_CACHE procedure
is running may have their plans removed, but the queries themselves will not incur a failure related to plan
removal. After the clear is complete, as queries are re-optimized, they will be inserted into the plan cache.
Removal of all plans is intended for use primarily in performance test and quality assurance
environments. It provides database performance analysts with a way to create a consistent environment
from which to evaluate potential database performance changes.
Removal of a specific plan is intended for limited use, such as when directed by IBM service or when
needing to force the optimizer to re-optimize a specific query.
The time the CLEAR_PLAN_CACHE procedure takes to run will vary depending on the plan cache size. To
avoid tying up an interactive job, it is recommended that the procedure should be submitted in a batch job
using a combination of the Submit Job (SBMJOB) and Run SQL (RUNSQL) CL commands.
Notes
The QRO hash is an internally generated identifier for an SQE query. In general, this identifier will be
unique for each SQE query and uses implicit schema qualification among other data to generate the QRO
hash. If the SQE optimizer generates multiple plans for the same query, then multiple plans will have the
same QRO hash. However, every plan will have a unique plan identifier. The QRO hash for a statement may
change on release boundaries or after loading PTFs. The QRO hash is externalized:
• In a Visual Explain
• From Show Statements exploration of the SQL Plan Cache and SQL Plan Cache Snapshots
• In the QQC83 column of the 3014 record of a database monitor or plan cache snapshot file
• As information passed to a Query Supervisor exit program.
• As returned from the QSYS2.ACTIVE_JOB_INFO table function
Example
• Submit a job to clear the plan cache.
DUMP_PLAN_CACHE procedure
The DUMP_PLAN_CACHE procedure creates a database monitor file (snapshot) from the plan cache.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
DUMP_PLAN_CACHE ( library-name ,
FILESCHEMA =>
file-name
FILENAME =>
, plan-identifier
PLAN_IDENTIFIER =>
, sql-statement-text-filter
SQL_STATEMENT_TEXT_FILTER =>
, include-system-queries
INCLUDE_SYSTEM_QUERIES =>
)
, iasp-name
IASP_NAME =>
library-name A character or graphic string expression that identifies the name of the library
containing file-name. The special value of *CURLIB can be used.
iasp-name A character or graphic string expression that identifies the independent ASP (IASP)
group to be used for finding plans to dump. An IASP must be available to access its
plans.
If plan-identifier is specified, only that specific plan is dumped. If plan-identifier is not specified, all plans
in the plan cache matching sql-statement-text-filter and include-system-queries that are found in the IASP
identified by iasp-name are dumped.
The file has the same definition as the QSYS/QAQQDBMN file. See Database monitor SQL table format for
more information.
If the file already exists, the authorities are not changed. If the file does not exist, it is created, and
ownership of the file is assigned to the effective user of the thread that calls DUMP_PLAN_CACHE. The
public authority is set to *EXCLUDE. All other authorities are copied from the QSYS/QAQQDBMN file.
The time the DUMP_PLAN_CACHE procedure takes to run will vary depending on the plan cache size. To
avoid tying up an interactive job, it is recommended that the procedure should be submitted in a batch job
using a combination of the Submit Job (SBMJOB) and Run SQL (RUNSQL) CL commands.
Notes
The plan identifier is a unique number that is generated when the plan is optimized. The plan identifier is
externalized in several ways:
• The statement number of a Visual Explain of a plan cache snapshot or a Visual Explain from the Show
Statements exploration of the SQL Plan Cache
• From Show Statements exploration of the SQL Plan Cache and SQL Plan Cache Snapshots
• In the QQUCNT column of the 1000 record of a plan cache snapshot file.
• As information passed to a Query Supervisor exit program.
Example
• Dump the plan cache to a database performance monitor file called SNAPSHOT1 in library SNAPSHOTS.
• Dump a specific plan to a database performance monitor file called QUERY1 in library SNAPSHOTS.
• Dump all plans in the current IASP that reference table TOYSTORE_SALES.
DUMP_PLAN_CACHE_PROPERTIES procedure
The DUMP_PLAN_CACHE_PROPERTIES creates a file containing the properties of the plan cache.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
library- A character or graphic string expression that identifies the name of the library containing
name file-name.
file-name A character or graphic string expression that identifies the name of the resulting properties
file. It must be a valid system file name. If the file does not exist, it is created with public
authority for the file the same as the create authority specified for the library in which
the file is created. Use the QSYS2.LIBRARY_INFO table function or the Display Library
Description (DSPLIBD) command to show the library's create authority. If the file exists, the
new plan cache properties will be appended to it.
The file definition matches the definition of QSYS2/QDBOPPCGEN, which has the following definition.
Table 72. QDBOPPCGEN table
VALUE_UNITS VALUEUNITS VARCHAR(128) The type of unit that applies to the VALUE columns.
ENTRY_NUMBER ENTRYNBR INTEGER A unique identifying number for this row. The number assigned
to a value will be the same in every generated plan cache
properties file.
DA Detail entry
HE Heading entry
MINVALUE MINVALUE VARCHAR(128) The minimum value allowed for this item
MAXVALUE MAXVALUE VARCHAR(128) The maximum value allowed for this item.
DFTVALUE DFTVALUE VARCHAR(128) The initial value provided by the system for this value.
Example
• Dump the plan cache properties to a file called PCPROP1 in library SNAPSHOTS.
CALL QSYS2.DUMP_PLAN_CACHE_PROPERTIES('SNAPSHOTS','PCPROP1');
DUMP_PLAN_CACHE_TOPN procedure
The DUMP_PLAN_CACHE_TOPN procedure creates a database monitor file (snapshot) from the plan
cache containing the user-initiated queries based on the specified category option.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
DUMP_PLAN_CACHE_TOPN ( library-name ,
FILESCHEMA =>
file-name , topn_number
FILENAME => TOPN =>
)
, category
CATEGORY =>
library- A character or graphic string expression that identifies the name of the library containing
name file-name.
file-name A character or graphic string expression that identifies the name of the resulting database
monitor file. If the file does not exist, it is created. If the file exists, the new plan cache
properties will be appended to it.
topn- An integer expression representing the number of queries to dump
number
category A character or graphic string expression that identifies the type of top N queries to be
dumped.
CPU Dump the TOPN queries with the most accumulated CPU time.
DATABASE READS Dump the TOPN queries with the most accumulated database read
I/Os. This includes both synchronous and asynchronous reads.
RUNTIME Dump the TOPN queries with the longest accumulated runtime. This
is the default.
STORAGE Dump the TOPN queries with the largest temporary storage usage.
The file has the same definition as the QSYS/QAQQDBMN file. If the file does not exist, it is created with
the public authority set to *EXCLUDE. See Database monitor SQL table format for more information.
DUMP_SNAP_SHOT_PROPERTIES procedure
The DUMP_SNAP_SHOT_PROPERTIES returns a result set containing the properties for an existing plan
cache snapshot.
Authorization: None required.
library-name A character or graphic string expression that identifies the name of the library containing
file-name.
file-name A character or graphic string expression that identifies the name of an existing database
monitor file.
VALUE_UNITS VARCHAR(128) The type of unit that applies to the VALUE column.
ENTRY_NUMBER INTEGER A unique identifying number for this row. The number assigned to a value will be the
same in every generated plan cache properties file.
DA Detail entry
HE Heading entry
Example
• Return the plan cache properties of an existing snapshot.
END_ALL_PLAN_CACHE_EVENT_MONITORS procedure
The END_ALL_PLAN_CACHE_EVENT_MONITORS procedure ends all active plan cache event monitors.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
END_ALL_PLAN_CACHE_EVENT_MONITORS ( )
Example
CALL QSYS2.END_ALL_PLAN_CACHE_MONITORS();
END_PLAN_CACHE_EVENT_MONITOR procedure
The END_PLAN_CACHE_EVENT_MONITOR procedure ends the event monitor identified by the given
monitor-ID.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
END_PLAN_CACHE_EVENT_MONITOR ( monitor-ID )
monitor-ID A character or graphic string expression that identifies the monitor to be ended.
Example
• End the plan cache monitor identified by PLANCACHE1.
CALL QSYS2.END_PLAN_CACHE_EVENT_MONITOR('PLANC00001');
IMPORT_PC_EVENT_MONITOR procedure
The IMPORT_PC_EVENT_MONITOR procedure imports an event monitor file for usage in the SQL
Performance Center that is part of IBM i Access Client Solutions (ACS).
Authorization: The caller must have:
• *EXECUTE authority to the library, and
• *OBJOPR and *READ authorities to the event monitor file.
IMPORT_PC_EVENT_MONITOR ( library-name ,
PLAN_CACHE_LIBRARY =>
file-name ,
PLAN_CACHE_FILE => IMPORTED_NAME =>
imported-name )
library-name A character or graphic string expression that identifies the name of the library
containing file-name.
file-name A character or graphic string expression that identifies the name of an existing event
monitor file.
imported-name The name of the plan cache event monitor to import. This name is used to identify the
plan cache event monitor in the SQL Performance Center.
Example
• Import a plan cache event monitor SNAPSHOTS/MON1 and name it NEWMON.
CALL QSYS2.IMPORT_PC_EVENT_MONITOR('SNAPSHOTS','MON1','NEWMON');
IMPORT_PC_SNAPSHOT ( library-name ,
PLAN_CACHE_LIBRARY =>
file-name ,
PLAN_CACHE_FILE => IMPORTED_NAME =>
imported-name )
library-name A character or graphic string expression that identifies the name of the library
containing file-name.
file-name A character or graphic string expression that identifies the name of an existing plan
cache snapshot file.
imported-name The name of the plan cache snapshot to import. This name is used to identify the plan
cache snapshot in the SQL Performance Center.
Example
• Import a plan cache snapshot file SNAPSHOTS/SNAP121413.
REMOVE_PC_EVENT_MONITOR procedure
The REMOVE_PC_EVENT_MONITOR procedure deletes a file containing an event monitor.
Authorization: The caller must have:
• *USE authority to the library, and
• *OBJOPR and *OBJEXIST authorities to the event monitor file.
REMOVE_PC_EVENT_MONITOR ( library-name
PLAN_CACHE_LIBRARY =>
, file-name )
PLAN_CACHE_FILE =>
library-name A character or graphic string expression that identifies the name of the library containing
file-name.
file-name A character or graphic string expression that identifies the name of an existing event
monitor file.
Example
CALL QSYS2.REMOVE_PC_EVENT_MONITOR('SNAPSHOTS','PRUNEDP1');
REMOVE_PC_SNAPSHOT procedure
The REMOVE_PC_SNAPSHOT procedure deletes a file containing a plan cache snapshot.
Authorization: The caller must have:
• *USE authority to the library, and
• *OBJOPR and *OBJEXIST authorities to the performance monitor file and any dependent indexes.
library-name A character or graphic string expression that identifies the name of the library containing
file-name.
file-name A character or graphic string expression that identifies the name of an existing plan cache
snapshot file.
Example
• Remove the plan cache snapshot file called PC1 in library SNAPSHOTS.
CALL QSYS2.REMOVE_PC_SNAPSHOT('SNAPSHOTS','PC1');
REMOVE_PERFORMANCE_MONITOR procedure
The REMOVE_PERFORMANCE_MONITOR procedure deletes a file containing a performance monitor.
Authorization: The caller must have:
• *USE authority to the library, and
• *OBJOPR and *OBJEXIST authorities to the performance monitor file and any dependent indexes.
library-name A character or graphic string expression that identifies the name of the library containing
file-name.
file-name A character or graphic string expression that identifies the name of an existing
performance monitor file.
Example
• Remove the performance monitor MON1 in SNAPSHOTS.
CALL QSYS2.REMOVE_PERFORMANCE_MONITOR('SNAPSHOTS','MON1');
START_PLAN_CACHE_EVENT_MONITOR procedure
The START_PLAN_CACHE_EVENT_MONITOR procedure starts an event monitor to capture plans as they
are removed from the cache and generates performance information into a database monitor file.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM function usage ID.
)
, monitor-ID
library-name A character or graphic string expression that identifies the name of the library to contain
file-name. library-name cannot be QTEMP.
file-name A character or graphic string expression that identifies the name of the database monitor
file. It must be a valid system file name. If the file does not exist, it is created.
Initially the file is created and populated with the starting record id 3018 (column QQRID
= 3018).
monitor-ID An optional character string output variable that will contain the 10 character identifier of
the event monitor that was started.
The event monitor stays active until one of the following occurs:
• It is ended by one of the end event monitor procedure calls.
• It is ended using the IBM i Navigator interface.
• An IPL of the system occurs.
• The specified database monitor file is deleted or otherwise becomes unavailable.
Example
• Start an event monitor and place plan information into a database monitor file called PRUNEDP1 in
library SNAPSHOTS:
CALL QSYS2.START_PLAN_CACHE_EVENT_MONITOR('SNAPSHOTS','PRUNEDP1');
• Start an event monitor and place plan information into a database monitor file called PRUNEDPLANS1 in
library SNAPSHOTS. Capture the monitor id into host variable HVmonid for use later:
CALL QSYS2.START_PLAN_CACHE_EVENT_MONITOR('SNAPSHOTS','PRUNEDPLANS1',:HVmonid);
Utility Services
These procedures provide interfaces to monitor and work with SQL in jobs on the current system or to
compare constraint and routine information across systems.
)
, library-name
LIBRARY_NAME =>
option A character or graphic string expression that identifies the type of catalog analysis to
perform.
DBXREF Analysis will be done for objects in the database cross reference files. This is
the default.
Verification is done for constraints defined for *FILE objects.
The analysis done by this function goes beyond what RCLDBXREF
OPTION(*CHECK) provides. It verifies that the constraint definitions in every
database file object are correctly recorded in the database catalog.
DBXREF Analysis will be done of the database cross reference servers. The database
SERVER cross reference servers will be verified to ensure they are functioning properly.
One or more result rows with DBXREF SERVER in the CATEGORY column
indicate the current database cross reference server status.
library- A character or graphic string expression that identifies the library to be analyzed. This
name parameter only applies when option is DBXREF.
*ALL All *FILE objects within all libraries will be analyzed, including any in independent
auxiliary storage pools that are accessible. This is the default.
name All *FILE objects within this library will be analyzed.
The result of the function is a table containing one row for each reported item with the format shown in
the following table. All the columns are nullable.
Table 73. ANALYZE_CATALOG table function
Example
• Determine if there are any constraint inconsistencies for any database files on the system.
• Determine if there are any constraint inconsistencies for database files in library APPLIB.
• Examine how the database cross reference servers are running. If they are behind on processing, the
DESCRIPTION and DETAIL columns will indicate the number of entries in the queue that are waiting to
be processed.
CANCEL_SQL procedure
The CANCEL_SQL procedure requests cancellation of an SQL statement for the specified job.
Authorization: None required if the caller’s user profile is the same as the job user identity of the
qualified job which is being canceled. Otherwise, the caller must have *JOBCTL special authority or be
authorized to the QIBM_DB_SQLADM function usage ID.
CANCEL_SQL ( job-name )
job-name A character string containing the qualified job name to be canceled. It must be in upper case.
The CANCEL_SQL() procedure provides an alternative to end job immediate. It supports all application
and interactive SQL environments.
When an SQL cancel is requested, an asynchronous request is sent to the job identified by job-name.
If the job is processing an interruptible, long-running machine operation, analysis is done within the job
Example
Safely cancel a job running an SQL statement.
CALL QSYS2.CANCEL_SQL('483456/QUSER/QZDASOINIT')
CHECK_SYSCST procedure
The CHECK_SYSCST procedure compares entries in the QSYS2.SYSCST table between two systems.
Authorization: See Note below.
This procedure will return a result set to the caller. If no result set is requested, the differences are logged
to the SESSION.SYSCSTDIFF table.
The result set that is returned or the table that is created contains the following columns:
SERVER_NAME SRVRNAME VARCHAR(18) Name of server where the request was run.
TABLE_NAME TBNAME VARCHAR(128) Name of the table which the constraint is created over.
SYSTEM_TABLE_NAME SYS_TNAME CHAR(10) System name of the table which the constraint is created over.
CONSTRAINT_KEYS COLCOUNT SMALLINT Specifies the number of key columns if this is a UNIQUE,
PRIMARY KEY, or FOREIGN KEY constraint.
CHECK_PENDING CHECK00001 VARCHAR(3) Indicates whether the constraint is in check pending state.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to compare catalog tables
between systems using an SQL procedure. Similar to other Db2 for i provided tools within SYSTOOLS,
the SQL source can be extracted and used as a model for building similar procedures, or to create a
customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Find all the differences in constraint settings between the current system and LP01UT18 for the
CORPDB_EX schema:
Related reference
SYSTOOLS
SYSTOOLS is a set of Db2 for IBM i supplied examples and tools.
CHECK_SYSROUTINE procedure
The CHECK_SYSROUTINE procedure compares entries in the QSYS2.SYSROUTINES table between two
systems.
Authorization: See Note below.
CHECK_SYSROUTINE (
remote-rdb-name , schema-name )
, avoid-result-set
This procedure will return a result set to the caller. If no result set is requested, the differences are logged
to the SESSION.SYSRTNDIFF table.
The result set that is returned or the table that is created contains the following columns:
Table 75. SYSRTNDIFF result set
SERVER_NAME SRVRNAME VARCHAR(18) Name of server where the request was run.
ROUTINE_CREATED RTNCREATE TIMESTAMP The timestamp when the routine was created.
ROUTINE_DEFINER DEFINER VARCHAR(128) Name of the user that defined the routine.
ROUTINE_SCHEMA RTNSCHEMA VARCHAR(128) Name of the schema that contains the routine.
SQL_DATA_ACCESS DATAACCESS VARCHAR(8) Identifies whether a routine contains SQL and whether it reads or
modifies data.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to compare catalog tables
between systems using an SQL procedure. Similar to other Db2 for i provided tools within SYSTOOLS,
the SQL source can be extracted and used as a model for building similar procedures, or to create a
customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Compare the current system to a remote system to find which routines differ, when they were created,
and who created them.
Related reference
SYSTOOLS
, library2 , file2
LIBRARY2 => FILE2 =>
, rdb2
RDB2 =>
, compare-attributes
COMPARE_ATTRIBUTES =>
, compare-data
COMPARE_DATA =>
)
, parallel-degree
PARALLEL_DEGREE =>
library1 A character or graphic string expression that identifies the library that contains file1. It
must exist on the current server and cannot be QTEMP.
compare- A character or graphic string expression that indicates whether the data is compared for
data the file, including the relative record number (RRN) of each row.
parallel- A character or graphic string that specifies the maximum degree of parallelism to use
degree when comparing the file.
If the Db2 Symmetric Multiprocessing (SMP) feature is not installed, a warning is issued if
the value is not NONE and the compare will not use parallelism.
2-256 The maximum degree of parallelism to be used. Using parallelism can cause the
compare to complete sooner, but it will have an impact on system resources.
NONE No parallelism will be used. This is the default.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 76. COMPARE_FILE table function
ATTRIBUTE_NAME VARGRAPHIC(512) The name of file attribute or the relative record number (RRN) that is
not identical.
CCSID 1200
CCSID 1200
CCSID 1200
• Compare the data for file T1 between the TEST library and the PROD library. As soon as any difference is
detected, stop the compare.
DUMP_SQL_CURSORS procedure
The DUMP_SQL_CURSORS procedure lists the open cursors for a job.
Authorization: None required if the caller's user profile is same as the job user identity of the qualified job
for which the open cursors are being listed. Otherwise, the caller must have *JOBCTL special authority or
be authorized to the QIBM_DB_SQLADM or QIBM_DB_SYSMON function usage ID.
To place the results in library-name.file-name, the caller must have:
• *EXECUTE authority to the library, and
• *OBJOPR and *ADD authorities to the file.
If the file does not exist, the caller must have *ADD authority to the library.
DUMP_SQL_CURSORS ( job-name ,
JOB_NAME =>
library-name ,
LIBRARY_NAME => FILE_NAME =>
file-name , output-option )
OUTPUT_OPTION =>
job-name A character string containing a qualified job name or a value of '*' to indicate the current
job
library-name A character string containing a system library name for the procedure output. An empty
string is allowed.
file-name A character string containing a system file name for the procedure output. An empty
string is allowed.
output-option An integer value that indicates how to return the output.
The result set that is returned or the file that is created contains the following columns:
Table 77. DUMP_SQL_CURSORS result table
OBJECT_NAME OBJNAME CHAR(10) Object containing the current SQL statement. Blank if current
SQL statement is not in a program, service program, or package.
OBJECT_LIBRARY OBJLIB CHAR(10) Library for object containing the current SQL statement. Blank if
current SQL statement is not in a program, service program, or
package.
OBJECT_TYPE OBJTYPE CHAR(10) Type of object containing the current SQL statement. Blank if
current SQL statement is not in a program, service program, or
package.
JOBNAME JOBNAME CHAR(28) System job name for the cursor. Contains * if current job was
specified for job-name argument.
Example
Populate QGPL/SQLCSR1 file with open SQL cursors for the current job.
END_IDLE_SQE_THREADS procedure
The END_IDLE_SQE_THREADS procedure will end any idle SQE threads for the current job.
Authorization: None required.
END_IDLE_SQE_THREADS ( )
Example
• End the idle SQE threads.
CALL QSYS2.END_IDLE_SQE_THREADS();
EXTRACT_STATEMENTS ( monitor-schema ,
MONITOR_SCHEMA =>
monitor-name
MONITOR_NAME =>
, additional-select-columns
ADDITIONAL_SELECT_COLUMNS =>
, additional-predicates
ADDITIONAL_PREDICATES =>
, order-by
ORDER_BY =>
, output-schema
OUTPUT_SCHEMA =>
)
, output-table
OUTPUT_TABLE =>
monitor- A character or graphic string expression that identifies the name of the library
schema containing monitor-name.
monitor-name A character or graphic string expression that identifies the name of an existing
database monitor file.
additional- A character or graphic string of up to 5000 characters containing additional columns
select-columns or expressions to be appended to the generated SELECT clause. A value of *AUDIT will
cause the procedure to return the merged statement and columns that are normally
interesting for auditing.
output-table The table name to contain the output. If the table identified by output-schema and
output-table does not exist, it will be created. If the table exists, the result of this
calling this procedure will be appended to the table. For an existing table, the number
of selected columns must match the selected columns when the table was generated.
If output-name is not specified, the null value is used.
If output-schema or output-table is the null value, a result set containing the extracted statement
information is returned.
Examples
• Extract the 100 most recent statements from monitor APRIL1014:
• Extract all the queries where the query took longer than one second:
FIND_AND_CANCEL_QSQSRVR_SQL procedure
The FIND_AND_CANCEL_QSQSRVR_SQL procedure finds a set of jobs with SQL activity and safely cancels
them.
The FIND_AND_CANCEL_QSQSRVR_SQL procedure uses the FIND_QSQSRVR_JOBS and CANCEL_SQL
procedures to determine the set of jobs that have SQL activity for the provided job-name. Each of these
jobs is made a target of an SQL cancel request.
Authorization: The caller must have:
• QSYS2/FIND_QSQSRVR_JOBS() authorizations, and
• QSYS2/CANCEL_SQL() authorizations
Example
Cancel all the QSQSRVR jobs used by a specific job.
CALL QSYS2.FIND_AND_CANCEL_QSQSRVR_SQL('564321/APPUSER/APPJOBNAME')
FIND_QSQSRVR_JOBS procedure
The FIND_QSQSRVR_JOBS procedure returns information about a QSQSRVR job.
Authorization: The caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM or QIBM_DB_SYSMON function usage ID.
FIND_QSQSRVR_JOBS ( job-name )
If the specified job is active and is set up to use SQL server mode, the procedure determines which
QSQSRVR jobs are being used by the application in the form of active SQL server mode connections.
The procedure collects and returns work management, performance, and SQL information. It returns two
SQL result sets, one containing summary information and one containing detailed SQL server mode job
information.
The results of the procedure call are saved in two temporary tables, QTEMP.QSQSRVR_SUMMARY and
QTEMP.QSQSRVR_DETAIL. When called from within IBM i Navigator Run SQL Scripts, two results sets are
displayed. When called from other interfaces, you need to query the temporary tables to see the data.
The result sets that are returned or the tables that are created contain the following columns:
Table 78. FIND_QSQSRVR_JOBS result set 1
NUMBER_OF_ACTIVE_JOBS NUMJOBS INTEGER Number of QSQSRVR jobs active for this job.
SERVER_MODE_JOB SRVRJOB CHAR(28) The fully qualified QSQSRVR job name for an active SQL Server
Mode connection established by job-name.
SERVER_MODE_CONNECTING_JOB CONNJOB CHAR(28) The fully qualified job name of the application job. This value
matches what was input for job_name.
TOTAL_PROCESSING_TIME TOTALCPU BIGINT The total amount of CPU time (in milliseconds) that has been
used by all server jobs.
TEMP_MEG_STORAGE TEMPMSTG INTEGER The total amount of auxiliary storage (in megabytes) that is
currently allocated to all server jobs.
PAGE_FAULTS FAULTS BIGINT The total number of times an active program referenced an
address that was not in main storage for all server jobs.
IO_REQUESTS IOREQS BIGINT The total number of auxiliary I/O requests performed by the job
across all routing steps for all server jobs. This includes both
database and non-database paging.
System Column
Column Name Name Data Type Description
CURRENT_USERNAME CURRUSER CHAR(10) The user profile that the thread is currently running under.
RUN_PRIORITY PRIORITY INTEGER The highest run priority allowed for any thread within this job.
SYSTEM_POOL_IDENTIFIER POOLID INTEGER The identifier of the system-related pool from which the job's main
storage is allocated.
TOTAL_PROCESSING_TIME TOTALCPU BIGINT The amount of CPU time (in milliseconds) that has been currently
used by this job.
PAGE_FAULTS FAULTS BIGINT The number of times an active program referenced an address
that was not in main storage during the current routing step of the
specified job.
IO_REQUESTS IOREQS BIGINT The number of auxiliary I/O requests performed by the job across
all routing steps. This includes both database and non-database
paging.
MEMORY_POOL_NAME POOLNAME CHAR(10) The name of the memory pool in which the job started running.
TEMP_MEG_STORAGE TEMPMSTG INTEGER The amount of auxiliary storage (in megabytes) that is currently
allocated to this job.
TIME_SLICE TSLICE INTEGER The maximum amount of processor time (in milliseconds) given to
each thread in this job before other threads in this job and in other
jobs are given the opportunity to run.
DEFAULT_WAIT DFTWAIT INTEGER The default maximum time (in seconds) that a thread in the job
waits for a system instruction to acquire a resource.
SQL_APPLICATION_LIBRARY SQLLIB CHAR(10) The library name for the SQL statement object.
SQL_APPLICATION_PROGRAM SQLPGM CHAR(10) The program, service program, or package name of the object
which contains the last SQL statement executed in the job.
SERVER_MODE_CONNECTING_JOB CONNJOB CHAR(28) The qualified job name of the job which established the SQL Server
Mode connection.
SERVER_MODE_CONNECTED_THREAD CONNTHD CHAR(10) The thread identifier of the last thread to use this connection.
STATUS_OF_CURRENT_SQL_STMT STMTSTAT CHAR(10) Status of the SQL statement. Values are ACTIVE or COMPLETED.
GENERATE_SQL procedure
The GENERATE_SQL procedure generates the SQL data definition language statements required to
recreate a database object. The results are returned in the specified database source file member, source
stream file, or as a result set.
The database source file member or integrated file system (IFS) stream file will contain the generated
SQL statements. If the output source file is QTEMP/Q_GENSQL with a member name of Q_GENSQL, the
source file is returned as a result set as well.
Authorization:
When writing to a database source physical file the caller must have:
• *EXECUTE to the library containing the source physical file
• To add a member:
– *OBJOPR and *ADD to the source physical file
database-object-library-name ,
DATABASE_OBJECT_LIBRARY_NAME =>
database-object-type
DATABASE_OBJECT_TYPE =>
, database-source-file-name
DATABASE_SOURCE_FILE_NAME =>
, database-source-file-library-name
DATABASE_SOURCE_FILE_LIBRARY_NAME =>
, database-source-file-member
DATABASE_SOURCE_FILE_MEMBER =>
, severity-level
SEVERITY_LEVEL =>
, replace-option
REPLACE_OPTION =>
, statement-formatting-option
STATEMENT_FORMATTING_OPTION =>
, date-format
DATE_FORMAT =>
, date-separator
DATE_SEPARATOR =>
, time-format
TIME_FORMAT =>
, time-separator
TIME_SEPARATOR =>
, naming-option
NAMING_OPTION =>
, decimal-point
DECIMAL_POINT =>
, standards-option
STANDARDS_OPTION =>
, drop-option
DROP_OPTION =>
, message-level
MESSAGE_LEVEL =>
, comment-option
COMMENT_OPTION =>
, label-option
LABEL_OPTION =>
, header-option
HEADER_OPTION =>
, trigger-option
TRIGGER_OPTION =>
, constraint-option
CONSTRAINT_OPTION =>
, system-name-option
SYSTEM_NAME_OPTION =>
, privileges-option
PRIVILEGES_OPTION =>
, ccsid-option
CCSID_OPTION =>
, create-or-replace-option
CREATE_OR_REPLACE_OPTION =>
, obfuscate-option
OBFUSCATE_OPTION =>
, activate-access-control-option
ACTIVATE_ROW_AND_COLUMN_ACCESS_CONTROL_OPTION =>
, mask-and-permission-option
MASK_AND_PERMISSION_OPTION =>
, qualified-name-option
QUALIFIED_NAME_OPTION =>
, additional-index-option
ADDITIONAL_INDEX_OPTION =>
, index-instead-of-view-option
INDEX_INSTEAD_OF_VIEW_OPTION =>
, temporal-option
TEMPORAL_OPTION =>
, source-stream-file
SOURCE_STREAM_FILE =>
, source-stream-file-end-of-line
SOURCE_STREAM_FILE_END_OF_LINE =>
)
, source-stream-file-ccsid
SOURCE_STREAM_FILE_CCSID =>
database- A character or graphic string expression that identifies the name of the database object
object-name for which DDL will be generated. Either the SQL name or the system name may be
database- A character or graphic string expression that identifies the name of the source file that
source-file- contains the SQL statements generated by the procedure. The name must be a valid
name system name. The name is case sensitive. If delimiters are required for the name to be
valid, they must be specified. For example, a file with a name of "abc" must be specified
with the surrounding quotes. A file with a name of ABC must be specified in upper case.
The record length of the specified source file must be greater than or equal to 92.
Can contain the following special value:
severity-level The severity level at which the operation fails. If errors occur that have a severity level
greater than this value, the operation ends. The valid values are in the range 0 through
39 inclusive. Any severity 40 error will cause the procedure to fail.
If severity-level is not specified, 39 will be used.
replace- The replace option for the database source file member or source stream file. The valid
option values are:
0 The resulting SQL statements are appended to the end of the database source file
member or source stream file.
1 The database source file member or source stream file is cleared prior to adding the
resulting SQL statements. If this option is chosen, the clear might happen even if an
error is returned from the procedure.
. Period separator
, Comma separator
source- An integer value that defines the CCSID to use if a new source stream file is created.
stream-file- If source-stream-file is specified and the source stream file does not exist, it will be
ccsid created with this CCSID value. A value of 0 indicates that the default job CCSID is to be
used. A CCSID of 65535 cannot be specified.
If source-stream-file-ccsid is not specified, 0 will be used.
This parameter is ignored when writing to a source file.
Examples
• Generate DDL for all tables in a schema and return the source as a result set.
• Generate DDL for all indexes starting with ‘X’ within the SAMPLE_CORPDB schema, place the output in a
file named DDLSOURCE/GENFILE member INDEXSRC.
• Generate DDL for a single table and include the constraints within a CREATE OR REPLACE TABLE
statement.
• Generate DDL for MYLIB.MYTABLE, placing the output in source stream file /usr/mytable_ddl.
GENERATE_SQL_OBJECTS procedure
The GENERATE_SQL_OBJECTS procedure generates the SQL data definition language (DDL) statements
required to recreate a set of database objects. The results are returned in the specified database source
file member, source stream file, or as a result set. The procedure will generate the objects so that
dependent objects are generated after depended on objects.
, system-table-schema
SYSTEM_TABLE_SCHEMA =>
, database-source-file-name
DATABASE_SOURCE_FILE_NAME =>
, database-source-file-library-name
DATABASE_SOURCE_FILE_LIBRARY_NAME =>
, database-source-file-member
DATABASE_SOURCE_FILE_MEMBER =>
, severity-level
SEVERITY_LEVEL =>
, replace-option
REPLACE_OPTION =>
, statement-formatting-option
STATEMENT_FORMATTING_OPTION =>
, date-format
DATE_FORMAT =>
, date-separator
DATE_SEPARATOR =>
, time-format
TIME_FORMAT =>
, time-separator
TIME_SEPARATOR =>
, naming-option
NAMING_OPTION =>
, decimal-point
DECIMAL_POINT =>
, standards-option
STANDARDS_OPTION =>
, drop-option
DROP_OPTION =>
, message-level
MESSAGE_LEVEL =>
, comment-option
COMMENT_OPTION =>
, label-option
LABEL_OPTION =>
, header-option
HEADER_OPTION =>
, trigger-option
TRIGGER_OPTION =>
, constraint-option
CONSTRAINT_OPTION =>
, system-name-option
SYSTEM_NAME_OPTION =>
, privileges-option
PRIVILEGES_OPTION =>
, ccsid-option
CCSID_OPTION =>
, create-or-replace-option
CREATE_OR_REPLACE_OPTION =>
, obfuscate-option
OBFUSCATE_OPTION =>
, activate-access-control-option
ACTIVATE_ROW_AND_COLUMN_ACCESS_CONTROL_OPTION =>
, mask-and-permission-option
MASK_AND_PERMISSION_OPTION =>
, qualified-name-option
QUALIFIED_NAME_OPTION =>
, additional-index-option
ADDITIONAL_INDEX_OPTION =>
, index-instead-of-view-option
INDEX_INSTEAD_OF_VIEW_OPTION =>
, temporal-option
TEMPORAL_OPTION =>
, source-stream-file
SOURCE_STREAM_FILE =>
, source-stream-file-end-of-line
SOURCE_STREAM_FILE_END_OF_LINE =>
)
, source-stream-file-ccsid
SOURCE_STREAM_FILE_CCSID =>
system-table- A character or graphic string expression that identifies the name of a table that contains
name the names and types of the database objects for which DDL will be generated. The
The contents of the columns must be specified according to the following rules for the
corresponding parameters in the QSQGNDDL API. Each row in the table must identify an
object that is distinct from every other object in the table.
OBJECT_SCHEMA Identifies the schema name of an object for which DDL will be
generated. The name must be delimited if delimiters are required
in an SQL statement. This name is ignored if the specified object
type is SCHEMA. *LIBL and *CURLIB are not allowed.
OBJECT_NAME Identifies the name of an object for which DDL will be generated.
The name must be delimited if delimiters are required in an SQL
statement. If the object type is a FUNCTION or PROCEDURE, this
name must be the specific name of the function or procedure. If
TABLE or VIEW is specified for the object type, the object name
must not identify an alias.
SQL_OBJECT_TYPE Identifies the SQL object type of an object for which DDL will be
generated.
system-table- A character or graphic string expression that identifies the name of the library of the
schema table that contains the names and types of the database objects for which DDL will
be generated. The system name of the schema must be specified. The name is case
sensitive. Delimiters must be specified if they are required. For example, a schema with
database- A character or graphic string expression that identifies the name of the source file that
source-file- contains the SQL statements generated by the procedure. The name must be a valid
name system name. The name is case sensitive. If delimiters are required for the name to be
valid, they must be specified. For example, a file with a name of "abc" must be specified
with the surrounding quotes. A file with a name of ABC must be specified in upper case.
The record length of the specified source file must be greater than or equal to 92.
Can contain the following special value:
severity-level The severity level at which the operation fails. If errors occur that have a severity level
greater than this value, the operation ends. The valid values are in the range 0 through
39 inclusive. Any severity 40 error will cause the procedure to fail.
If severity-level is not specified, 39 will be used.
replace-option The replace option for the database source file member or source stream file. The valid
values are:
0 The resulting SQL statements are appended to the end of the database source file
member or source stream file.
1 The database source file member or source stream file is cleared prior to adding the
resulting SQL statements. If this option is chosen, the clear might happen even if an
error is returned from the procedure.
. Period separator
, Comma separator
0 Qualified object names should be generated. Unqualified names within the body of
SQL routines will remain unqualified.
1 Unqualified object names should be generated when a library is found which
matches the database object library name. Any SQL object or column reference
that is RDB qualified will be generated in its fully qualified form. For example, rdb-
name.schema-name.table-name and rdb-name.schema-name.table-name.column-
name references will retain their full qualification.
source- A character or graphic string expression that defines the end of line character(s) which
stream-file- will be appended to the end of each line when writing to source-stream-file. The carriage
end-of-line return character is always X’0D’. Based on the CCSID of the source stream file, the line
feed character is X’25’ for an EBCDIC CCSID and X’0A’ for ASCII and UTF-8 CCSIDs. The
valid values are:
source- An integer value that defines the CCSID to use if a new source stream file is created.
stream-file- If source-stream-file is specified and the source stream file does not exist, it will be
ccsid created with this CCSID value. A value of 0 indicates that the default job CCSID is to be
used. A CCSID of 65535 cannot be specified.
If source-stream-file-ccsid is not specified, 0 will be used.
This parameter is ignored when writing to a source file.
Notes
• If an error occurs while generating the DDL for an object, the source file or source stream file will
contain the error and processing will continue to the next object. After processing the last object, a
warning SQLSTATE '01H52' will be returned.
• Objects are generated in the following order:
1. Schemas
2. Types
3. Sequences
4. Aliases
5. Non-MQT tables and any constraints and indexes on those tables
6. Functions
7. Procedures
8. Variables
9. Views, DDS-created logical files and MQTs and any constraints and indexes on those tables
10. Triggers
11. Masks
12. Permissions
Restrictions
• One use of this procedure is to create a clone of a set of objects in another library by using
QUALIFIED_NAME_OPTION=>1, setting the current schema and path, and then running the generated
script.
– If a depended on object is not included in the list of objects for which DDL will be generated, errors
may occur when attempting to run the generated script. For example, if view V1 is based on table T1,
but only V1 is specified, the attempt to run the generated script will fail because T1 was not included.
– The QSQGNDDL API, on which this procedure is based, generates a qualified name in some cases.
Thus, it may be necessary to make minor modifications to the script prior to running it. For
more information see the Qualified name option parameter in Generate Data Definition Language
(QSQGNDDL) API.
• A function or procedure that has a parameter with a DEFAULT clause that references a variable, view, or
MQT will not create when running the generated script. This is because variables, views, and MQTs are
generated after functions and procedures. Note that references to variables, views, and MQTs within the
body of function or procedure are soft dependencies and will not prevent the create.
• A variable that contains a DEFAULT clause that references a view or MQT will not create when running
the generated script. This is because views and MQTs are generated after variables.
Examples
• Generate ordered DDL for the objects listed in the QTEMP.INORDER file.
RELATED_OBJECTS ( library-name ,
LIBRARY_NAME =>
file-name )
FILE_NAME =>
library-name A character or graphic string expression that identifies the library that contains file-name.
It must exist on the current server.
file-name A character or graphic string expression that identifies the database file to list related
objects for. This must be the system name of the file.
SOURCE_SQL_NAME VARCHAR(128) The name of the object that this row is dependent on.
LONG_COMMENT VARGRAPHIC(2000) CCSID 1200 The SQL long comment for the object.
Contains the null value when the comment is not available.
OBJECT_TEXT VARGRAPHIC(50) CCSID 1200 The system text description for the object.
Contains the null value when the text is not available.
LAST_ALTERED TIMESTAMP The timestamp when the object was last altered. For objects that
cannot be altered, this is the create timestamp.
Contains the null value when SQL_OBJECT_TYPE is FOREIGN KEY.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to use the SQL catalog to find
dependency information using an SQL function. Similar to other Db2 for i provided tools within SYSTOOLS,
the SQL source can be extracted and used as a model for building similar functions, or to create a
customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Examples
• List all the objects that are dependent on the ORDERS file in APPLIB.
• List all the objects that are dependent on the ORDERS file in APPLIB. For each object, return how many
recursive steps were required to find the object.
RESTART_IDENTITY ( source-schema
SOURCE_SYSTEM_TABLE_SCHEMA =>
, source-table ,
SOURCE_SYSTEM_TABLE_NAME =>
target-schema ,
TARGET_SYSTEM_TABLE_SCHEMA =>
target-table )
TARGET_SYSTEM_TABLE_NAME =>
source- A character or graphic string for the schema name containing source-file. It must be a
schema system schema name.
source-table A character or graphic string for the table name that has the identity value to copy. It
must be a system table name. The table must contain an identity column.
target- A character or graphic string for the schema name containing target-table. It must be a
schema system schema name.
target-table A character or graphic string for the table name that is to have its identity column value
reset. It must be a system table name. The table must contain an identity column that
has the same name as the identity column in source-table.
Example
Set the identity column in NEWTABLE to have the same next value as the identity column in OLDTABLE
SWAP_DYNUSRPRF procedure
The SWAP_DYNUSRPRF procedure switches the SQL DYNUSRPRF setting for a program or service
program. The possible values are *OWNER and *USER. Calling this procedure will change the value for a
program or service program to the opposite setting. The switch will be performed for all modules in an ILE
program or service program.
The following query shows the current value of the DYNUSRPRF setting for any modules that are part of
an ILE program or service program:
Authorization: The caller must have *ALLOBJ special authority or be authorized to the
QIBM_DB_SECADM function usage ID.
SWAP_DYNUSRPRF ( program-library
PROGRAM_LIBRARY =>
, program-name
PROGRAM_NAME =>
, program-type )
PROGRAM_TYPE =>
program-library A character or graphic string containing the name of the library containing the
program. Can be one of the following special values:
Example
Switch the value of the dynamic user profile for program MYLIB/MYPGM.
SYSFILES view
The SYSFILES view contains information about database files. Additional information is available in the
QSYS2.SYSTABLES view.
The information returned is similar to the detail seen from the Display File Description (DSPFD) command
and the Retrieve Database File Description (QDBRTVFD) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the file, and
• *OBJOPR authority to the file.
The following table describes the columns in the view. The schema is QSYS2.
Table 81. SYSFILES view
IASP_NUMBER IASPNUMBER INTEGER The independent auxiliary storage pool (IASP) number.
LAST_ALTERED_TIMESTAMP ALTEREDTS TIMESTAMP(0) Timestamp when the file was last altered or created.
FILE_LEVEL_ID FILE_LVLID CHAR(13) File level identifier. This is the date of the file in
CYYMMDDHHMMSS format.
YES The record format level identifiers are checked when the
file is opened.
See Level checking for some additional information
about how level checking works.
Nullable Contains the null value if the object owner is not available.
CREATE_PUBLIC_AUTHORITY PUB_AUTH VARCHAR(10) The public authority that the file was created with (AUT). This is
not the current public authority for the file.
MAXIMUM_RECORD_LENGTH RECLENGTH INTEGER Maximum record length. This is the length of the record in the
file's record format that contains the largest number of bytes.
NUMBER_BASED_ON_FILES BASE_FILES INTEGER Number of files directly referenced by a logical file, view, or
index.
Nullable
Contains the null value for physical files.
BASED_ON_FILES BASED_ON CLOB(35K) CCSID A list of files directly referenced by this logical file, view, or
1208 index.
Nullable This list is returned as an array within a JSON object. The array
is identified by BASED_ON_FILES. Each entry in the JSON array
identifies one file. Each array entry can contain information with
the following keys:
• LIBRARY
• FILE
• MEMBER
• LF_FORMAT
Contains the null value for physical files.
FILE_VRM FILE_VRM CHAR(6) File version, release, and modification level. VxRyMz, where x is
the version, y the release, and z the modification level. This is
the release where the file was created.
EARLIEST_POSSIBLE_RELEASE MINRLS CHAR(6) Earliest supported version, release, and modification level. New
database support used in the file will prevent the file from being
Nullable saved to a prior version, release, and modification level. The
value is formatted as VxRyMz, where x is the version, y the
release, and z the modification level.
Contains the null value if the value is prior to V2.
MEDIA_PREFERENCE UNIT VARCHAR(4) Preferred storage unit for the file (UNIT).
Nullable Contains the null value if a source file was not used.
SOURCE_FILE SRCFILE VARCHAR(10) Name of the source file containing the DDS used to create the
file.
Nullable
Contains the null value if a source file was not used.
SOURCE_FILE_MEMBER SRCMBR VARCHAR(10) Source file member name within SOURCE_FILE used to create
the file.
Nullable
Contains the null value if a source file was not used.
ACCESS_PATH_KEYED ACCESSPATH VARCHAR(3) Whether the file has a keyed sequence access path.
Nullable *MAX1TB All access paths associated with this file will be
allowed to occupy a maximum of 1 terabyte (1
099 511 627 776 bytes) of auxiliary storage
Nullable NO The access path and changed records are not forced to
auxiliary storage when the access path is changed.
Nullable *AFTIPL The file access path is built after the IPL is
completed.
*NO The file access path is built when the file is next
opened.
SORT_SEQUENCE_LIBRARY SRTSEQ_LIB VARCHAR(10) The library containing the sort sequence table or alternate
collating sequence table. Can contain the special value *LIBL.
Nullable
Contains the null value if SRTSEQ_IND is 1 or if there is no
library.
SORT_SEQUENCE SRTSEQ VARCHAR(10) The sort sequence table or alternate collating sequence table
associated with the file.
Nullable
Contains the null value if SRTSEQ_IND is 1.
ROUNDING_MODE DECFLTRND VARCHAR(8) Rounding mode to be used for decimal floating point
(DECFLOAT) calculations.
Nullable
CEILING
DOWN
FLOOR
HALFDOWN
HALFEVEN
HALFUP
UP
Contains the null value if the file has no decimal floating point
fields or this is not an SQL view, SQL index with a derived key
expression, SQL materialized query table, or logical file.
DECFLOAT_WARNINGS DECFLTWRN VARCHAR(3) Indicates whether warnings should be returned from decimal
floating point calculations.
Nullable
NO Warnings are not returned.
Contains the null value if the file has no decimal floating point
fields or this is not an SQL view, SQL index with a derived key
expression, SQL materialized query table, or logical file.
Nullable Contains the null value if file has more than one format or if no
value is available.
Nullable Contains the null value if file has more than one format.
Nullable Contains the null value if file has more than one format.
Nullable Contains the null value if file has more than one format.
COMMON_CCSID CCSID INTEGER The CCSID used when all fields with a character, open, and
graphic data type use the same CCSID.
Nullable
Contains the null value if file has more than one format or if all
character, open, and graphic fields do not use the same CCSID.
Nullable NO A CCSID was not specified for any character type fields
in the format.
Contains the null value if file has more than one format.
NO The file has only one CCSID for its character type fields
or the file has no character type fields.
YES The file has more than one CCSID for its character type
fields
Nullable NO The file record format does not contain UTF-8, UTF-16,
or UCS-2 fields.
Contains the null value if file has more than one format.
CONTAINS_LOB LOB VARCHAR(3) File contains large object fields. These are the SQL data types
character large object (CLOB), double-byte character large
object (DBCLOB), and binary large object (BLOB).
NO The file record format does not have a large object field.
CONTAINS_DATALINK_ DATALINKFL VARCHAR(3) File contains DataLink with FILE LINK CONTROL fields.
FILE_LINK_CONTROL
NO The file record format does not have a DataLink field
with FILE LINK CONTROL.
YES The file record format has a DataLink field with FILE
LINK CONTROL.
Nullable NO The file record format does not have any null capable
fields.
Contains the null value if file has more than one format.
CONTAINS_DEFAULT DFT VARCHAR(3) The physical file format contains fields with explicit default
values.
Nullable
NO The file record format does not have any fields with
explicit default values.
YES The file record format has fields with explicit default
values.
Contains the null value if file has more than one format.
Values for the following columns are returned when NATIVE_TYPE is PHYSICAL. Otherwise, the columns will contain the null value.
YES New members added to the file use the initial number of
records to determine storage space that is allocated for
the member (ALLOCATE(*YES)).
INITIAL_RECORDS SIZE_INIT INTEGER Initial number of records (SIZE). This is the number of records
that can be inserted before an automatic extension occurs.
Nullable
Contains the null value if the number of records that can be
inserted into each member is not limited by the user. The system
determines the maximum member size (*NOMAX).
INCREMENT_RECORDS SIZE_INCR INTEGER Increment number of records (SIZE). This is the maximum
number of records that can be inserted into the member after
Nullable an automatic extension occurs.
Contains the null value when INITIAL_RECORDS is null.
MAXIMUM_INCREMENTS SIZE_MAX INTEGER Maximum number of increments (SIZE). This is the maximum
number of automatic extensions that can be made to the
Nullable member.
Contains the null value when INITIAL_RECORDS is 0.
Values for the following columns are returned when NATIVE_TYPE is LOGICAL. Otherwise, the columns will contain the null value.
TOTAL_SELECT_OMIT TOTAL_SO INTEGER Total number of select/omit statements for all record formats.
Nullable
Nullable NO The selection and omission tests specified for the file
are done when the access path is updated.
YES The selection and omission tests specified for the file
are done when the file is read.
PHYSICAL_LOB PF_LOB VARCHAR(3) Whether this logical file has no large object fields, but the based-
on physical file has a large object field.
Nullable
NO The logical file and based-on physical file either both
have large object fields or both do not.
YES The logical file has no large object fields, but the based-
on physical file has a large object field.
PHYSICAL_DATALINK PF_DATALNK VARCHAR(3) Whether this logical file has no DataLink fields, but the based-on
physical file has a DataLink field.
Nullable
NO The logical file and based-on physical file either both
have DataLink fields or both do not.
YES The logical file has no DataLink fields, but the based-on
physical file has a DataLink field.
INDEX_EXPRESSION_HAS_UDF IXEXPUDF VARCHAR(3) If the SQL index key column is an expression and the expression
contains a user-defined function (UDF).
Nullable
NO The key column is not an expression or the expression
does not contain a user-defined function, or this is not
an SQL index.
Nullable NO The index does not have a search condition, or this is not
an SQL index
INDEX_SEARCH_CONDITION_ SPARSE_UDF VARCHAR(3) If the index search condition contains a user-defined function.
HAS_UDF Nullable NO The index is not sparse or does not contain a user-
defined function, or this is not an SQL index
Examples
• Examine all the files in APPLIB1.
• List the files that native logical files in APPLIB1 are based on.
System Column
Column name Name Data Type Description
TABLE_SCHEMA TABSCHEMA VARCHAR(128) Name of the SQL schema that contains the table.
Nullable Contains the null value if the table is not a source file.
Nullable Contains the null value if the table is not a source file.
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP Timestamp of the last change that occurred to the
member or partition.
LAST_USED_TIMESTAMP LASTUSED TIMESTAMP Timestamp of the last time the member or partition
was used directly by an application for native record
Nullable I/O or SQL operations.
Contains the null value if the member or partition has
never been used.
DAYS_USED_COUNT DAYSUSED INTEGER The number of days the member or partition was
used directly by an application for native record I/O
or SQL operations since the last time the usage
statistics were reset. If the member or partition
has never been used since the last time the usage
statistics were reset, contains 0.
LAST_RESET_TIMESTAMP LASTRESET TIMESTAMP The timestamp of the last time the usage statistics
were reset for the table. For more information see the
Nullable Change Object Description (CHGOBJD) command.
Contains the null value if the member or partition's
last used timestamp has never been reset.
System Column
Column name Name Data Type Description
NUMBER_DISTRIBUTED_PARTITIONS DSTPARTS INTEGER If the table is a distributed table, contains the total
number of partitions.
Nullable
Contains the null value if the table is not a distributed
table.
LOWINCLUSIVE LOWINCL CHAR(1) Indicates whether the low key value for the partition
is inclusive.
Nullable
N The low key value is not inclusive.
LOWVALUE LOWVALUE VARGRAPHIC(1024) A string representation of the low key value for a
CCSID 1200 range partition.
HIGHINCLUSIVE HIGHINCL CHAR(1) Indicates whether the high key value for the partition
is inclusive.
Nullable
N The high key value is not inclusive.
HIGHVALUE HIGHVALUE VARGRAPHIC(1024) A string representation of the high key value for a
CCSID 1200 range partition.
OVERFLOW OVERFLOW BIGINT The estimated number of rows that have overflowed
to variable length segments. If the table does not
contain variable length or LOB columns, contains 0.
AVGROWSIZE AVGROWSIZE BIGINT Average length (in bytes) of a row in this table. If the
table has variable length or LOB columns, contains
-1.
DATA_SIZE SIZE BIGINT Total size (in bytes) of the data space in the member
or partition.
VARIABLE_LENGTH_SIZE VLSIZE BIGINT Size (in bytes) of the variable-length data space
segments in the member or partition.
COLUMN_STATS_SIZE CSTATSSIZE BIGINT Size (in bytes) of the column statistics in the member
or partition.
MAINTAINED_TEMPORARY_INDEX_SIZE MTISIZE BIGINT Size (in bytes) of all maintained temporary indexes
over the member or partition.
System Column
Column name Name Data Type Description
NUMBER_DISTINCT_INDEXES DISTINCTIX INTEGER The number of distinct indexes built over the member
or partition. This does not include maintained
temporary indexes.
OPEN_OPERATIONS OPENS BIGINT Number of full opens of the member or partition since
the last IPL.
BLOCKED_INSERT_OPERATIONS BLKIOPS BIGINT Number of blocked insert operations for the member
or partition since the last IPL.
LOGICAL_READS LGLREADS BIGINT Number of logical read operations for the member or
partition since the last IPL.
PHYSICAL_READS PHYREADS BIGINT Number of physical read operations for the member
or partition since the last IPL.
RANDOM_READS RANREADS BIGINT Number of random read operations for the member
or partition since the last IPL.
NEXT_IDENTITY_VALUE NEXTVALUE DECIMAL(31,0) The next identity value. In some cases, this value may
be an estimate.
Nullable
Contains the null value if the table does not have an
identity column.
0 No memory preference.
0 No media preference.
1 Table is volatile.
System Column
Column name Name Data Type Description
APPLY_STARTING_RECEIVER APYRCVLIB VARCHAR(10) The library containing the starting journal receiver.
_LIBRARY Nullable Contains the null value if
APPLY_STARTING_RECEIVER is null.
APPLY_STARTING_RECEIVER APYRCVNAME VARCHAR(10) Indicates that the partition was saved and
subsequently restored. If the table was journaled
Nullable when the partition was saved, the starting journal
receiver name will indicate the journal receiver to
start with if APYJRNCHG is then used.
Contains the null value if PARTIAL_TRANSACTION
has a value of R. Once an APYJRNCHG is performed,
the apply information is cleared.
Example
Examine some statistical information for all members of all files in APPLIB1.
VALIDATE_DATA ( library-name ,
LIBRARY_NAME =>
file-name
FILE_NAME =>
)
, member-name
MEMBER_NAME =>
library-name An character string expression that specifies the name of the library containing file-
name.
The VALIDATE_DATA_FILE table function validates all members in a physical file. It is identical to
VALIDATE_DATA except it only has library-name and file-name parameters.
The VALIDATE_DATA_LIBRARY table function validates all members in all physical files in a library. It is
identical to VALIDATE_DATA except it only has a library-name parameter.
The result of the function is a table containing a row for each row in a member that has invalid data in at
least one column. The columns of the result table are described in the following table. The result columns
are nullable.
Table 83. VALIDATE_DATA, VALIDATE_DATA_FILE, and VALIDATE_DATA_LIBRARY table function
RELATIVE_RECORD_NUMBER BIGINT The relative record number (RRN) of the row in MEMBER_NAME with the
invalid data.
SQL_WARNING INTEGER The SQLCODE of the warning that indicated this error.
REASON_CODE INTEGER The reason code from the warning that indicated this error.
COLUMN_NAME VARCHAR(128) The name of the column with the invalid data.
WARNING_TEXT VARCHAR(1000) The text from the warning that indicated this error.
Note
This function is provided in the SYSTOOLS schema as an example of how to examine all the rows in a table
by using an SQL table function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source
can be extracted and used as a model for building similar functions, or to create a customized version
within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Validate the content of all members in FILE1. If no rows are returned, all the data appears to be good.
IBM i Services
There are many system services that can be accessed through system-provided SQL views, procedures,
and functions. These provide an SQL interface to access, transform, order, and subset the information
without needing to code to a system API.
Information about the supported IBM i releases, including the database PTF groups where each service
was introduced or enhanced, is available in the IBM i Technology Updates wiki. See this page for all the
details: https://www.ibm.com/support/pages/node/1119123
ACTIVATION_GROUP_INFO (
job-name
JOB_NAME =>
, internal-job-id
INTERNAL_JOB_ID =>
)
, ignore-errors
IGNORE_ERRORS =>
job-name A character string that identifies the qualified name of a job in the form job-number/
job-user/job-name.
The special value of '*' indicates the current job.
If job-name is provided, internal-job-id must be omitted.
internal-job- A binary string that contains an internal job identifier. This can be passed for
id quicker performance. This value is returned in the INTERNAL_JOB_ID column by the
ACTIVE_JOB_INFO table function.
If internal-job-id is provided, job-name must be omitted.
ignore-errors A character string that identifies what to do when an error is encountered.
NO An error is returned.
YES A warning is returned.
No row is returned when an error is encountered. This is the default.
The result of the function is a table containing one row for every activation group for the job with the
format shown in the following table. All columns are nullable.
Table 84. ACTIVATION_GROUP_INFO table function
ACTIVATION_GROUP_NAME VARCHAR(10) The name of the activation group. Can contain one of the following
special values:
NUMBER_OF_ACTIVATIONS INTEGER The total number of program activations in this activation group.
PROGRAM_LIBRARY VARCHAR(10) The name of the library that contains the program that caused this
activation group to be created.
Contains the null value when PROGRAM is null.
PROGRAM VARCHAR(10) The name of the program that caused this activation group to be
created.
Contains the null value when the activation group is one of the
default activation groups or if the program no longer exists in the
system.
PROGRAM_TYPE VARCHAR(6) The type of program that caused this activation group to be
created.
PGM A program.
SHARED_ACTIVATION_GROUP VARCHAR(3) Whether the activation group is shared. A shared activation group
is an activation group that belongs to more than one job at the
same time.
STATIC_STORAGE_SIZE DECIMAL(20,0) The total amount of static storage allocated to the activation group,
in bytes. If the size exceeds 4,294,967,295 bytes, 4,294,967,295
will be returned.
NUMBER_OF_HEAPS INTEGER The total number of heaps that are allocated by this activation
group.
HEAP_STORAGE_SIZE DECIMAL(20,0) The total amount of heap storage that is allocated to the
activation group, in bytes. If the size exceeds 4,294,967,295
bytes, 4,294,967,295 will be returned.
Example
• List the activation group information for the current job.
• List the activation group information for a job based on its internal job identifier.
ADD_USER_INDEX_ENTRY ( user-index
, user-index-library
USER_INDEX_LIBRARY =>
, replace , entry
REPLACE => ENTRY =>
)
, key
KEY =>
user- A character string containing the name of the user index where an entry is to be added.
index
user- A character string containing the name of the library where the user index is located. Can be
index- one of the following special values:
library
*CURLIB The current library is used.
*LIBL The library list is used.
NO For a non-keyed index, the new entry must be unique. If the entry is already in the
index, an error is returned.
For a keyed index, insert the entry only if the key is not already in the user index. If the
entry does not exist, the key and entry data will be inserted into the user index. If the
entry is already in the index, an error is returned.
YES For a non-keyed index, this value is not supported.
For a keyed index, replace the entry portion of the index entry if the key is already in
the user index. If the entry does not exist, the key and entry data will be inserted into
the user index.
entry A string that specifies the data for the index entry. This parameter is required.
key A string that specifies the key for the index entry. This parameter must be provided for a
keyed user index. The length of the key cannot exceed the defined key length.
• For ADD_USER_INDEX_ENTRY, the input value is a character string.
• For ADD_USER_INDEX_ENTRY_BINARY, the input value will be considered a binary string.
If the index is not keyed, this parameter must be omitted.
Example
• Add a new entry to a non-keyed user index.
• Add a new entry to a keyed user index. Allow the new entry to overwrite an existing entry if the key
value already exists.
BINDING_DIRECTORY_INFO view
The BINDING_DIRECTORY_INFO view returns information about the object entries in binding directories.
The values returned for the columns in the view are similar to the values returned by the Display Binding
Directory (DSPBNDDIR) CL command
Authorization: The caller must have:
• *USE authority to the library containing the binding directory, and
• *OBJOPR and *READ authority to the binding directory.
To return the create timestamp for a binding directory entry, the caller must have:
• *EXECUTE authority to the library containing the binding directory entry, and
• Some authority to the binding directory entry.
The following table describes the columns in the view. The system name is BNDDIR_INF. The schema is
QSYS2.
Table 85. BINDING_DIRECTORY_INFO view
ENTRY_LIBRARY ENTRY_LIB VARCHAR(10) The library containing ENTRY. Can contain the special value
*LIBL.
ENTRY_TYPE ENTRY_TYPE VARCHAR(7) The object type of the binding directory entry.
ENTRY_ACTIVATION ENTRY_ACT VARCHAR(6) The activation control of the bound service program.
Nullable
*DEFER Activation of the bound service program may be
deferred until a function it exports is called.
ENTRY_CREATE_TIMESTAMP ENTRY_TS TIMESTAMP(0) The timestamp when the object was created.
Nullable Contains the null value if the entry timestamp is not available.
Examples
• Return a list of the entries for all binding directories in library TESTLIB that start with 'TEST'.
• List all of the binding directories that have the entry MYLIB/HELLO, type *MODULE.
SELECT BINDING_DIRECTORY,
BINDING_DIRECTORY_LIBRARY
FROM QSYS2.BINDING_DIRECTORY_INFO
WHERE ENTRY = 'HELLO'
AND ENTRY_LIBRARY = 'MYLIB'
AND ENTRY_TYPE = '*MODULE'
ORDER BY 1, 2;
BOUND_MODULE_INFO view
The BOUND_MODULE_INFO view returns information about modules bound into an ILE program or
service program.
The values returned for the columns in the view are closely related to the values returned for *MODULE
detail on the DSPPGM (Display Program) and DSPSRVPGM (Display Service Program) CL commands and
the List ILE Program Information (QBNLPGMI) and the List Service Program Information (QBNLSPGM)
APIs.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the program or service program, and
• *READ authority to the program or service program.
The following table describes the columns in the view. The system name is MODULE_INF. The schema is
QSYS2.
Table 86. BOUND_MODULE_INFO view
*PGM A program.
BOUND_MODULE_LIBRARY BDMODLIB VARCHAR(10) The library containing the module bound into
PROGRAM_NAME at bind time.
MODULE_CREATE_TIMESTAMP CREATE_TS TIMESTAMP(0) The timestamp when the module was created.
SOURCE_FILE_LIBRARY SRCLIB VARCHAR(10) The name of the library that contains the source
file used to create the module.
Nullable
Contains the null value if no source file was used
to create the module.
SOURCE_FILE SRCFILE VARCHAR(10) The name of the source file used to create the
module.
Nullable
Contains the null value if no source file was used
to create the module.
SOURCE_FILE_MEMBER SRCMBR VARCHAR(10) The name of the member in the source file.
SOURCE_CHANGE_ SRC_CHGTS TIMESTAMP(0) The timestamp when the source that was used to
TIMESTAMP create this module was last changed.
Nullable
Contains the null value if no source file was used
to create the module.
MODULE_CCSID TGTCCSID INTEGER The coded character set identifier (CCSID) for this
module.
SORT_SEQUENCE_LIBRARY SRTSEQ_LIB VARCHAR(10) The name of the library that contained the sort
sequence table used when the module was
Nullable compiled. This does not apply to SQL statements
in the module. Can contain the following special
values:
SORT_SEQUENCE SRTSEQ VARCHAR(10) The name of the sort sequence table used when
the module was compiled. This does not apply to
Nullable SQL statements in the module. Can contain the
following special values:
LANGUAGE_ID LANGID VARCHAR(7) The language identifier used when the module
was compiled. This does not apply to SQL
Nullable statements in the module. Can contain the
following special value:
DEBUG_DATA DEBUG_DATA VARCHAR(4) Whether debug data was generated when this
module was created. If debug data exists, the
module may be debugged using the source
debugger.
OBJECT_CONTROL_LEVEL OBJSSI CHAR(8) The object control level for the module at the time
it was bound into PROGRAM_NAME.
Nullable
Contains the null value if there is no object control
level for the module.
CREATION_DATA CREATEDATA VARCHAR(6) Whether the bound module has all the
creation data and if that data is observable or
unobservable.
TERASPACE_STORAGE_ENABLED TERASPACE VARCHAR(4) The teraspace storage capability for this bound
module.
STORAGE_MODEL STGMDL VARCHAR(10) Where the automatic and static storage for this
bound module is allocated at run time.
PROFILING_DATA PRFDTA VARCHAR(10) The profiling data attribute for this bound module.
ALLOW_RTVCLSRC RTVCLSRC VARCHAR(4) Whether the module has CL source data that can
be retrieved from the program.
LIC_OPTIONS LICOPT VARGRAPHIC(500) CCSID The Licensed Internal Code options that are in
1200 use by the module.
PTF_NUMBER PTF CHAR(5) The program temporary fix (PTF) that resulted in
the creation of the module.
Nullable
Contains the null value for user-created modules.
APAR_ID APAR_ID CHAR(6) The module was changed as the result of the
authorized program analysis report (APAR) with
Nullable this identification number.
Contains the null value if the module was not
changed at bind time.
SQL_RELATIONAL_DATABASE RDB VARCHAR(18) The default relational database that was specified
on the SQL precompile. Can contain the following
Nullable special value:
*NONE No commit.
SQL_NAMING NAMING VARCHAR(4) The convention used for naming objects in SQL
statements.
Nullable
*SQL The SQL naming convention is used.
SQL_SORT_SEQUENCE_LIBRARY SQL_SSEQLB VARCHAR(10) The name of the library that is used to locate the
SQL sort sequence table. The following special
Nullable values can be returned:
SQL_SORT_SEQUENCE SQL_SRTSEQ VARCHAR(10) The sort sequence table name specified when
the module was compiled. The following special
Nullable values can be returned:
SQL_DEFAULT_SCHEMA DFTRDBCOL VARCHAR(10) The schema name used for unqualified names of
tables, views, indexes, and SQL packages in static
Nullable statements.
Contains the null value if there is no default
schema name or if the module does not contain
SQL statements.
SQL_DYNAMIC_USER_PROFILE DYNUSRPRF VARCHAR(10) The user profile used for dynamic SQL
statements. The following special values can be
Nullable returned:
SQL_ALLOW_COPY_DATA ALWCPYDTA VARCHAR(9) Whether a copy of the data can be used in the
implementation of an SQL query.
Nullable
*NO A copy of the data is not allowed.
SQL_PACKAGE_LIBRARY SQLPKGLIB VARCHAR(10) The name of the library the SQL package is in.
Examples
• Find any bound modules that include source changes from the last 7 days.
SELECT *
FROM QSYS2.BOUND_MODULE_INFO
WHERE PROGRAM_LIBRARY = 'QGPL'
AND SOURCE_CHANGE_TIMESTAMP > CURRENT TIMESTAMP - 7 DAYS
ORDER BY SOURCE_CHANGE_TIMESTAMP DESC;
• Find bound modules in APPLIB that were built from source that does not reside in the IFS.
SELECT *
FROM QSYS2.BOUND_MODULE_INFO
WHERE PROGRAM_LIBRARY = 'APPLIB'
AND SOURCE_FILE_LIBRARY <> 'QTEMP'
AND SOURCE_STREAM_FILE_PATH IS NULL
ORDER BY SOURCE_FILE_LIBRARY, SOURCE_FILE, SOURCE_FILE_MEMBER;
*PGM A program.
BOUND_SERVICE_PROGRAM_LIBRARY BDSRVPGMLB VARCHAR(10) The name of the library containing the service
program bound to PROGRAM_NAME at bind time.
This is the library name in which the activation
expects to find the service program at run time.
Can contain the following special value:
Example
• Examine whether service programs in APPLIB are taking advantage of deferred service program
activation.
CHANGE_USER_SPACE ( user-space
, user-space-library
USER_SPACE_LIBRARY =>
, data
DATA =>
, start-position
START_POSITION =>
)
, force
FORCE =>
user-space A character string containing the name of the user space to be changed.
user- A character string containing the name of the library containing the user space to be
space- changed. Can be one of the following special values:
library
*CURLIB The job's current library is used.
*LIBL The library list is used.
data The data to be written to the user space. The string can be up to 16,773,120 bytes long.
• For CHANGE_USER_SPACE, the input value will be converted to a character string using
the job CCSID.
• For CHANGE_USER_SPACE_BINARY, the input value will be considered a binary string.
start- An integer value that indicates the position in the user space where data will be written.
position The first position in the user space is position 1. If this parameter is omitted, 1 will be used.
force A character string that indicates whether changes made to the user space should be forced
to auxiliary storage.
ASYNC Force changes asynchronously. This interrupts normal system management and
ensures that the user space is written to auxiliary storage.
NO Do not force changes. Normal system management writes the changes to
auxiliary storage. This is the default.
Example
• Modify the content of user space USRSPC1 in APPLIB, placing the specified string starting at the 500th
byte in the space.
CHANGE_USER_SPACE_ATTRIBUTES procedure
The CHANGE_USER_SPACE_ATTRIBUTES procedure changes the attributes of a user space (*USRSPC)
object.
The values used by the procedure are closely related to the values handled by the Change User Space
Attributes (QUSCUSAT) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the user space, and
• *CHANGE and *OBJMGT authority to the user space.
CHANGE_USER_SPACE_ATTRIBUTES ( user-space
USER_SPACE =>
, user-space-library
USER_SPACE_LIBRARY =>
, size
SIZE =>
, extendable
EXTENDABLE =>
, initial-value
INITIAL_VALUE =>
)
, transfer-size
TRANSFER_SIZE =>
user-space A character string containing the name of the user space to be changed.
user-space- A character string containing the name of the library containing the user space to be
library changed. Can be one of the following special values:
size An integer value specifying the size, in bytes, of the user space object. This value must
be from 1 byte to 16,773,120 bytes. If the value is smaller than the current size of the
space, the user space is truncated. If it is larger, the space is extended.
If this parameter is omitted, the size is not changed.
extendable An character string that indicates whether the user space can be automatically
extended.
Example
• Truncate user space USRSPC1 in APPLIB to a size of 200 bytes.
CLEAR_DATA_QUEUE procedure
The CLEAR_DATA_QUEUE procedure clears all messages from the specified data queue or clears
messages that match the key provided.
This procedure provides function similar to the Clear Data Queue (QCLRDTAQ) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the data queue, and
• *OBJOPR and *READ authority to the data queue.
, data-queue-library
DATA_QUEUE_LIBRARY =>
, key-data
KEY_DATA =>
)
, key-order
KEY_ORDER =>
data- A character or graphic string containing the name of the data queue.
queue
data- A character or graphic string containing the name of the library containing the data queue.
queue- Can be one of the following special values:
library
*CURLIB The job's current library is used.
*LIBL The library list is used. This is the default.
key-data A character string containing the data to use as the key for selecting messages to be
removed from the data queue. This parameter can only be specified for a keyed data queue.
If this parameter is not specified, all messages will be cleared from the data queue.
The length of key-data must be the length specified on the KEYLEN parameter
on the Create Data Queue (CRTDTAQ) command. The KEY_LENGTH column of the
QSYS2.DATA_QUEUE_INFO view contains this value.
When this parameter is specified, key-order must also be specified.
key-order The comparison criteria between the keys of messages on the data queue and the key-data
parameter. Valid values are:
EQ Equal
GE Greater than or equal
GT Greater than
LE Less than or equal
LT Less than
NE Not equal
Example
Clear all entries from data queue DQ1 in library TESTLIB.
COMMAND_LIBRARY CMD_LIB VARCHAR(10) The name of the library in which the command
resides.
PROXY_TARGET_COMMAND_LIBRARY PRXTGT_LIB VARCHAR(10) The name of the library in which the proxy target
command resides. Can contain the special value
Nullable *LIBL.
Contains the null value if PROXY_COMMAND is
NO.
PROXY_TARGET_COMMAND PRXTGT_CMD VARCHAR(10) The name of the proxy target command. This
could be another proxy command.
Nullable
Contains the null value if PROXY_COMMAND is
NO.
COMMAND_PROCESSING_PROGRAM_LIBRARY CPP_LIB VARCHAR(10) The name of the library in which the command
processing program resides. Can contain the
Nullable special value *LIBL.
Contains the null value if
COMMAND_PROCESSING_PROGRAM contains
the special value *REXX, or if PROXY_COMMAND
is YES.
SOURCE_FILE_LIBRARY SRCLIB VARCHAR(10) The name of the library in which the source file
resides.
Nullable
Contains the null value if a stream file was used
to create the command, or if PROXY_COMMAND is
YES.
SOURCE_FILE SRCFILE VARCHAR(10) The name of the source file that contains the
source file member used to create the command.
Nullable
Contains the null value if a stream file was used
to create the command, or if PROXY_COMMAND is
YES.
SOURCE_FILE_MEMBER SRCMBR VARCHAR(10) The name of the source file member that contains
the command definition statements used to
Nullable create the command.
Contains the null value if a stream file was used
to create the command, or if PROXY_COMMAND is
YES.
VALIDITY_CHECKING_PROGRAM_LIBRARY VLD_LIB VARCHAR(10) The name of the library in which the validity
checking program resides.
Nullable
Contains the null value if
VALIDITY_CHECKING_PROGRAM contains the
null value, or if PROXY_COMMAND is YES.
VALIDITY_CHECKING_PROGRAM_STATE VLD_STATE VARCHAR(7) The state the validity checking program is called
from.
Nullable
*SYSTEM The validity checking program is
called from the system state.
PROMPT_TEXT_MESSAGE_FILE_LIBRARY PMT_LIB VARCHAR(10) The name of the library in which the prompt
message file resides. Can contain the special
Nullable value *LIBL.
Contains the null value if
PROMPT_TEXT_MESSAGE_FILE contains the null
value, or if PROXY_COMMAND is YES.
PROMPT_TEXT_MESSAGE_FILE PMT_MSGF VARCHAR(10) The name of the message file that contains the
prompt text for this command.
Nullable
Contains the null value if no message file was
specified for prompt text, or if PROXY_COMMAND
is YES.
RETRIEVE_PROMPT_MESSAGE RTVPMTMSG VARCHAR(8) Whether text messages used by the command are
retrieved from the prompt message file when the
Nullable command is prompted.
PROMPT_OVERRIDE_PROGRAM_LIBRARY PMTOVR_LIB VARCHAR(10) The name of the library in which the prompt
override program resides.
Nullable
Contains the null value if
PROMPT_OVERRIDE_PROGRAM contains the null
value, or if PROXY_COMMAND is YES.
PROMPT_OVERRIDE_PROGRAM PMTOVR_PGM VARCHAR(10) The name of the prompt override program that
replaces default values (on the prompt display)
Nullable with the current actual values for the parameter.
Contains the null value if no prompt override
program is specified, or if PROXY_COMMAND is
YES.
PROMPT_OVERRIDE_PROGRAM_STATE PMTOVR_ST VARCHAR(7) The state the prompt override program is called
from.
Nullable
*SYSTEM The prompt override program is
called from the system state.
MESSAGE_FILE_LIBRARY MSGF_LIB VARCHAR(10) The name of the library in which the message file
resides. Can contain the special value *LIBL.
Nullable
Contains the null value if PROXY_COMMAND is
YES.
MESSAGE_FILE MSGF VARCHAR(10) The name of the message file from which
messages identified on the Dependency (DEP)
Nullable command definition statements are retrieved.
Contains the null value if PROXY_COMMAND is
YES.
HELP_PANEL_GROUP_LIBRARY PNLGRP_LIB VARCHAR(10) The name of the library in which the panel group
resides. Can contain the special value *LIBL.
Nullable
Contains the null value if HELP_PANEL_GROUP
contains the null value, or if PROXY_COMMAND
is YES.
HELP_PANEL_GROUP PNLGRP VARCHAR(10) The name of the panel group in which the online
help information exists for this command.
Nullable
Contains the null value if no help panel
group is defined for this command, or if
PROXY_COMMAND is YES.
HELP_IDENTIFIER HELP_ID VARCHAR(10) The root name for all help section identifiers for
this command. All help sections in the help panel
Nullable group associated with this command will begin
with this name.
Contains the null value if no help identifier is
specified, or if PROXY_COMMAND is YES.
HELP_SEARCH_INDEX_LIBRARY HELP_LIB VARCHAR(10) The name of the library in which the help search
index resides. Can contain the special value
Nullable *LIBL.
Contains the null value if HELP_SEARCH_INDEX is
null, or if PROXY_COMMAND is YES.
HELP_SEARCH_INDEX HELP_INDEX VARCHAR(10) The name of the help search index for this
command.
Nullable
Contains the null value if no help search index is
specified, or if PROXY_COMMAND is YES.
CURRENT_LIBRARY_NAME CURLIB VARCHAR(10) The name of the library used as the current
library during the processing of this command.
Nullable Can contain the following special values:
PRODUCT_LIBRARY_NAME PRODLIB VARCHAR(10) The name of the library that is used as the
product library during the processing of the
Nullable command. Can contain the following special
value:
ALLOW_LIMITED_USER ALWLMTUSR VARCHAR(3) Whether a user whose profile is set for limited
capabilities is allowed to use the command by
Nullable typing it in the command line on a menu.
DEBUG_MODE DEBUG_MODE VARCHAR(3) Whether the command is valid for debug mode
operations.
Nullable
NO The command is not valid for debug mode
operations.
SERVICE_MODE SVC_MODE VARCHAR(3) Whether the command is valid for service mode
operations.
Nullable
NO The command is not valid for service
mode operations.
ALLOW_RUN_BATCH_PGM ALLOWBMOD VARCHAR(3) Whether the command can be used in a batch ILE
CL program.
Nullable
NO The command is not allowed to run in a
batch ILE CL program.
CCSID CCSID INTEGER The value of the coded character set identifier
(CCSID) associated with this command. It is the
Nullable value of the job CCSID when this command was
created.
Contains the null value if PROXY_COMMAND is
YES.
MULTITHREADED_JOB_ACTION JOB_ACTION VARCHAR(7) The action to take in a multithreaded job for this
command.
Nullable
*MSG Send an informational message and
run the command.
Example
• List all the proxy commands in QSYS.
SELECT *
FROM QSYS2.COMMAND_INFO
WHERE COMMAND_LIBRARY = 'QSYS'
AND PROXY_COMMAND = 'YES';
, user-index-library
USER_INDEX_LIBRARY =>
, entry-type
ENTRY_TYPE =>
, maximum-entry-length
MAXIMUM_ENTRY_LENGTH =>
, key-length
KEY_LENGTH =>
, index-size
INDEX_SIZE =>
, replace
REPLACE =>
, index-attribute
INDEX_ATTRIBUTE =>
, optimization
OPTIMIZATION =>
, immediate-update
IMMEDIATE_UPDATE =>
, track-usage
TRACK_USAGE =>
, text-description
TEXT_DESCRIPTION =>
, public-authority
PUBLIC_AUTHORITY =>
)
, object-domain
OBJECT_DOMAIN =>
user-index A character string containing the name of the user index to be created.
entry-type A character string that indicates the type of entries for the user index.
maximum- An integer value that specifies the length of entries in the user index.
entry-length When entry-type is FIXED, valid values are 1 to 2000.
When entry-type is VARIABLE, this parameter is ignored and the value 2000 is used.
key-length An integer value that specifies the length of the key to be used for any insertions into
the user index.
To define a non-keyed index, the value must be 0. This is the default.
To define a keyed index, the value can be 1 to maximum-entry-length.
index-size A character string that indicates the maximum size of the user index.
4 GB The maximum size of the user index is 4 gigabytes. This is the default.
1 TB The maximum size of the user index is 1 terabyte.
replace A character string that indicates whether an existing user index by this name is to be
replaced.
NO Do not replace an existing user index of the same name and library. This is the
default.
YES Replace an existing user index of the same name and library.
If the user index already exists, it is replaced by a new user index with the same
name and library and keeps the original object's authorities.
index-attribute A character string that specifies the user-provided object attribute to assign to the
user index. It can be up to ten characters long. The string will be folded to uppercase.
optimization The optimization method used for user index maintenance.
immediate- Whether the updates to the index are written to auxiliary storage on each update to the
update index.
track-usage The usage tracking setting for the user index. Usage tracking provides machine
checkpoints to improve recognition that the index is bad. If a user index is found
to be a state of partial change, it will be marked as damaged.
text-description A character string that describes the user index. It can be up to 50 characters long.
object-domain The domain into which the user space is created. Refer to the API documentation for
more details.
*DEFAULT The system decides into which domain the object should be created. This
is the default.
*SYSTEM Create the user index object into the system domain.
*USER Attempt to create the user index object into the user domain.
If the library you are creating the user index into does not appear in the
QALWUSRDMN system value, the user index cannot be created into the
user domain.
Example
• Create user space USRIX1 in APPLIB to contain variable-length entries. The key is 5 characters long.
Assign *EXCLUDE public authority to the *USRIDX object.
CREATE_USER_SPACE procedure
The CREATE_USER_SPACE procedure creates or replaces a user space (*USRSPC) object.
The values used by the procedure are closely related to the values handled by the Create User Space
(QUSCRTUS) API.
Authorization: The caller must have:
• *READ and *ADD authority to the library where the user space is being created.
• If a user space is being replaced, the caller must have *OBJMGT, *OBJEXIST, and *READ authorities to
the existing user space.
, user-space-library
USER_SPACE_LIBRARY =>
, size
SIZE => , replace
REPLACE =>
, text-description
TEXT_DESCRIPTION =>
, public-authority
PUBLIC_AUTHORITY =>
, extendable
EXTENDABLE =>
, initial-value
INITIAL_VALUE =>
, object-attribute
OBJECT_ATTRIBUTE =>
, transfer-size
TRANSFER_SIZE =>
)
, object-domain
OBJECT_DOMAIN =>
user-space A character string containing the name of the user space to be created.
user-space- A character string containing the name of the library where the user space is to be
library created. Can be the following special value:
size The initial size of the user space being created. This value must be from 1 byte to
16,773,120 bytes.
The size of the user space that is created could be larger than the specified value.
replace A character string that indicates whether an existing user space by this name is to be
replaced.
text- A character string that describes the user space. It can be up to 50 characters long.
description
public- The authority given to a newly created user space for users who do not have a specific
authority private or group authority to the user space. This option is ignored if replace has a value
of YES and an existing user space is replaced.
*ALL The public authority allows users to perform all operations on the
user space.
authorization-list- The user space is secured by the specified authorization list, and
name its public authority is set to *AUTL.
*CHANGE The public authority allows users to read the object description
and provides read, add, update, and delete authority to the user
space.
*EXCLUDE The public authority prevents users from accessing the user
space in any way.
*LIBCRTAUT The public authority is taken from the CRTAUT value for the
library when the object is created. This is the default.
*USE The public authority allows users to read the user space.
extendable A character string that indicates whether the user space can be automatically extended.
NO The user space is not automatically extendable. The user space maximum size
matches the initial size.
YES The user space is automatically extendable. The size of the user space
automatically grows as data is written beyond its current size. This is the default.
initial-value The initial value of all bytes in the user space as a binary value. A value of BX'00' will
achieve the best performance. This is the default.
object- A character string that specifies the user-provided object attribute to assign to the user
attribute space. It can be up to ten characters long. The string will be folded to uppercase.
transfer-size An integer value that indicates the number of pages to be transferred between main
storage and auxiliary storage. This is only a request, as system processing can use a
value of its choice in some circumstances. Allowable values are from 0 to 32 pages. A
value of 0 indicates that the default transfer size for the user space should be used. The
default is 0.
A larger transfer size may allow for better performance of applications processing the
user space.
object- The domain into which the user space is created.
domain
*DEFAULT The system decides into which domain the object should be created. This
is the default.
*SYSTEM Create the user space object into the system domain.
*USER Attempt to create the user space object into the user domain.
Example
• Create user space USRSPC1 in APPLIB with an initial size of 1000 bytes. Assign *EXCLUDE public
authority to the *USRSPC object.
DATA_AREA_INFO ( data-area-name
DATA_AREA_NAME =>
, data-area-library
DATA_AREA_LIBRARY =>
)
, ignore-errors
IGNORE_ERRORS =>
data-area- A character or graphic string expression that identifies the data area.
name
Can contain the following special values:
data-area- A character or graphic string expression that identifies the library containing the data area.
library If data-area-library is not specified, *LIBL is used. If data-area-name is one of the special
values, data-area-library is ignored.
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
The result of the function is a table containing one row with the format shown in the following table. All
the columns are nullable.
Table 89. DATA_AREA_INFO table function
DECIMAL_POSITIONS INTEGER Specifies the number of digits to the right of the decimal point for a
decimal data area.
Contains the null value if not a decimal data area.
DATA_AREA_BINARY_VALUE VARBINARY(2000) The value currently assigned to the data area as binary data.
Example
• Return the current value of the TESTDATA data area. Use the library list to locate the data area.
DATA_AREA_INFO view
The DATA_AREA_INFO view returns the values of data areas.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
Data Area (RTVDTAARA) CL command and the Retrieve Data Area (QWCRDTAA) API.
Authorization: The caller must have:
DECIMAL_POSITIONS SCALE INTEGER Specifies the number of digits to the right of the
decimal point for a decimal data area.
Nullable
Contains the null value if not a decimal data area
or if this is a DDM data area that was unable to
access the data.
DATA_AREA_VALUE VALUE VARCHAR(2000) The value currently assigned to the data area as
character data.
Nullable
For a decimal data area, the SQL default decimal
point is used. See Decimal point.
Contains the null value if this is a DDM data area
that was unable to access the data.
DATA_AREA_BINARY_VALUE BIN_VALUE VARBINARY(2000) The value currently assigned to the data area as
binary data.
Nullable
Contains the null value if this is a DDM data area
that was unable to access the data.
Example
• Return a list of values for all data areas in MYLIB.
DATA_QUEUE_ENTRIES ( data-queue
DATA_QUEUE =>
, data-queue-library
DATA_QUEUE_LIBRARY =>
, selection-type
SELECTION_TYPE =>
, key-data
KEY_DATA =>
)
, key-order
KEY_ORDER =>
data-queue A character or graphic string containing the name of the data queue.
data- A character or graphic string containing the name of the library containing the data queue.
queue- Can be one of the following special values:
library
*CURLIB The job's current library is used.
*LIBL The library list is used. This is the default.
selection- A character string indicating how the messages are to be returned. If this parameter is
type omitted, ALL is used.
ALL All messages are to be returned in the order based on the type of data queue.
FIFO queues are returned in FIFO order, LIFO queues are returned in LIFO
order, and keyed queues are returned in ascending key order.
key-data A character string containing the data to use as the key for receiving a message from the
data queue. This parameter is required for a keyed data queue. It must not be specified for
a non-keyed data queue.
The length of key-data must be the length specified on the KEYLEN parameter
on the Create Data Queue (CRTDTAQ) command. The KEY_LENGTH column of the
QSYS2.DATA_QUEUE_INFO view contains this value.
When this parameter is specified, key-order must also be specified.
key-order The comparison criteria between the keys of messages on the data queue and the key-
data parameter. Valid values are:
The result of the function is a table containing one or more rows with the format shown in the following
table. If no messages are selected, no rows are returned. All the columns are nullable.
Table 91. DATA_QUEUE_ENTRIES table function
ORDINAL_POSITION INTEGER The relative position of this row in the result data set.
DATA_QUEUE_LIBRARY VARCHAR(10) The library in which the data queue was found.
MESSAGE_DATA CLOB(64512) The message received from the data queue as character data.
MESSAGE_DATA_UTF8 CLOB(64512) The message received from the data queue represented as character data in
CCSID 1208.
CCSID 1208
MESSAGE_DATA_BINARY BLOB(64512) The message received from the data queue in binary form. This is the raw form of
the data.
KEY_DATA VARCHAR(256) For a keyed data queue. the key value of the returned message. This is the actual
key value, which could be different than the key-data parameter value.
Contains the null value if this is not a keyed data queue.
MESSAGE_ENQUEUE_TIMESTAMP TIMESTAMP(0) The date and time that the message was placed on the data queue.
Example
Look at all the messages in data queue DQ1 in TESTLIB.
DATA_QUEUE_INFO view
The DATA_QUEUE_INFO view returns a row for every data queue.
The information returned is similar to the information available through the Retrieve Data Queue
Description (QMHQRDQD) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the data queue, and
• *OBJOPR and *READ authority to the data queue.
The following table describes the columns in the view. The system name is DTAQ_INFO. The schema is
QSYS2.
Table 92. DATA_QUEUE_INFO view
DATA_QUEUE_TYPE DTAQ_TYPE VARCHAR(8) This will be set to one of the following values:
MAXIMUM_MESSAGE_LENGTH MSG_LENGTH INTEGER The maximum length allowed for messages. This
is the value that was specified with the MAXLEN
Nullable keyword on the CRTDTAQ command.
Contains the null value for a DDM data queue.
KEYED Keyed
KEY_LENGTH KEY_LENGTH INTEGER The length of the message reference key for a keyed
data queue, in bytes. Values are from 1 to 256.
Nullable
Contains the null value if this is not a keyed queue or
is a DDM data queue.
INCLUDE_SENDER_ID SENDER_ID VARCHAR(3) Indicates if the queue was created to include the
sender ID with sent messages.
Nullable
NO The sender ID is not included when data is
sent to the data queue.
MAXIMUM_MESSAGES MAX_MSGS INTEGER The maximum number of messages that will fit into
the data queue.
Nullable
Contains the null value for a DDM data queue.
INITIAL_MESSAGE_ALLOCATION INIT_ALOC INTEGER The number of messages that will fit into the storage
allocated for the data queue when it is created or
Nullable when it is automatically reclaimed.
Contains the null value for a DDM data queue.
CURRENT_MESSAGE_ALLOCATION CUR_ALOC INTEGER The number of entries that will fit into the data
queue before it is extended. When the queue is
Nullable extended, additional storage is allocated for the
queue. The data queue can be extended until it
reaches the value for the maximum number of
entries allowed.
Contains the null value for a DDM data queue.
AUTOMATIC_RECLAIM RECLAIM VARCHAR(3) Whether or not the data queue has the amount of
storage allocated for the queue reclaimed when the
Nullable queue is empty.
LAST_RECLAIM_TIMESTAMP RECLAIM_TS TIMESTAMP The date and time that the last automatic reclaim
was done.
Nullable
Contains the null value for a DDM data queue or
when no reclaim has occurred for a standard data
queue.
REMOTE_DATA_QUEUE_LIBRARY RMT_DTAQL VARCHAR(10) The name of the library for the remote data queue
on the target system. This is the data queue name
Nullable that was specified on the RMTDTAQ parameter of
the CRTDTAQ command. Can contain the following
special values:
REMOTE_DATA_QUEUE RMT_DTAQ VARCHAR(10) The name of the remote data queue on the
target system. This is the data queue name that
Nullable was specified on the RMTDTAQ parameter of the
CRTDTAQ command.
Contains the null value for a standard data queue.
REMOTE_LOCATION REMOTE_LOC VARCHAR(8) The name of the remote location that is used with
this object. This is the name that was specified
Nullable on the RMTLOCNAME parameter of the CRTDTAQ
command. Can contain the following special value:
RELATIONAL_DATABASE_NAME RDBNAME VARCHAR(18) The name of the relational database entry that
identifies the target system or target ASP group.
Nullable This is the name that was specified on the RDB
parameter of the CRTDTAQ command.
Contains the null value for a standard data queue
or a data queue that is not an RDB type DDM data
queue.
APPC_DEVICE_DESCRIPTION APPC_DEVD VARCHAR(10) The name of the APPC device description on the
source system that is used with this DDM data
Nullable queue. This is the name that was specified on the
DEV parameter of the CRTDTAQ command. Can
contain the following special value:
LOCAL_LOCATION LOCAL_LOC VARCHAR(8) The name of the local location. This is the name
that was specified on the LCLLOCNAME parameter of
Nullable the CRTDTAQ command. Can contain the following
special values:
MODE MODE VARCHAR(8) The mode name used with the remote location name
to communicate with the target system. This is the
Nullable name that was specified on the MODE parameter of
the CRTDTAQ command. Can contain the following
special value:
REMOTE_NETWORK_ID REMOTE_NET VARCHAR(8) The remote network identifier in which the remote
location used to communicate with the target
Nullable system. This is the name that was specified on the
RMTNETID parameter of the CRTDTAQ command.
Can contain the following special values:
Example
Find the number of messages currently on data queue DQ1 in TESTLIB.
DB_TRANSACTION_INFO view
The DB_TRANSACTION_INFO view returns one row for each commitment definition.
The values returned for the columns in the view are similar to the values returned by the Work with
Commitment Definitions (WRKCMTDFN) CL command and by the Database Transactions and Global
Transactions lists in ACS.
Authorization: None required when the creator of the commitment definition matches the effective
user of the thread. Otherwise, the caller must have *JOBCTL special authority or be authorized to the
QIBM_DB_SQLADM or QIBM_DB_SYSMON function usage identifier.
The following table describes the columns in the view. The system name is TRANS_INFO. The schema is
QSYS2.
Table 93. DB_TRANSACTION_INFO view
COMMITMENT_DEFINITION_ID CMTDEF_ID VARCHAR(10) FOR BIT The ID associated with the commitment
DATA definition. Can contain the following special
values:
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name that is using commitment
control.
LOGICAL_UNIT_OF_WORK_ID LUWID VARCHAR(39) The identifier (ID) of the current logical unit
of work (LUW). This value can be used to
find associated commitment definitions on this
system and on other systems. The logical unit of
work ID (LUWID) is a character string containing
the network-qualified logical unit (LU) name, the
instance number, and the sequence number.
The network-qualified LU name consists of a
network ID with a maximum of 8 characters, a
period delimiter, followed by a LU name with a
maximum of 8 characters. The instance number is
a 12 character value, each character representing
a single hexadecimal digit. The sequence number
is a decimal value with values ranging from 1
through 65535.
LOGICAL_UNIT_OF_WORK_STATE LUW_STATE VARCHAR(20) The current state of the logical unit of work (LUW).
STATE_TIMESTAMP STATE_TIME TIMESTAMP(0) The timestamp when the logical unit of work
started or became undecided.
Nullable
Contains the null value if the commitment
definition has performed no work and is not
undecided.
LOCK_SPACE_ID LOCKID CHAR(20) The lock space identifier for this commitment
definition.
ASPGRP ASPGRP VARCHAR(10) The ASP group for this commitment definition. If
*SYSBAS, the commitment definition resides on
the system auxiliary storage pool.
USER_NAME USER_NAME VARCHAR(10) The user profile that started the transaction.
ROLE ROLE VARCHAR(19) Indicates the role that this location is playing in
the transaction program network.
Nullable
AGENT This location is a leaf in the
transaction program network
and it has no subordinate
locations.
MIRROR_ERROR_IASP MIRROR_EI INTEGER The IASP number of the IASP where commitment
control detected a Db2 Mirror error.
Nullable
Contains the null value if MIRROR_ACTIVE is NO
or if commitment control has not detected a Db2
Mirror error for an IASP.
MIRROR_TRACKING_IASP MIRROR_TI INTEGER The IASP number of the IASP where commitment
control detected the Db2 Mirror state was
Nullable TRACKING.
Contains the null value if MIRROR_ACTIVE is NO
or if commitment control has not detected an
IASP where the Db2 Mirror state is TRACKING.
SERVER_JOB_NAME SERVER_JOB VARCHAR(28) Qualified job name of the database server job of
which this commitment definition is a part.
Nullable
Contains the null value if the commitment
definition is not part of a database server job.
LOCK_WAIT_TIME LOCK_WAIT INTEGER The maximum number of seconds that the system
waits to acquire a lock requested on behalf of this
commitment definition. Lock wait time values that
are specified or defaulted using system interfaces
other than the xa_open API are used if they are
smaller than this value, or if this value is zero.
SQL_HOLD_COMMIT SQL_HOLD VARCHAR(3) Indicates the SQL HOLD value used on the call to
COMMIT.
DEFAULT_JOURNAL_LIBRARY DFT_JRNLIB VARCHAR(10) The name of the library in which the default
journal is located.
Nullable
Contains the null value if there is no default
journal.
DEFAULT_JOURNAL_NAME DFT_JRN VARCHAR(10) The name of the default journal that was specified
when the commitment definition was created. All
Nullable logical unit of work (LUW) entries are placed in
this journal.
Contains the null value if there is no default
journal.
NOTIFY_OBJECT_LIBRARY NOTIFY_LIB VARCHAR(10) The name of the library in which the notify object
for the commitment definition can be located.
Nullable
Contains the null value if there is no notification
object.
NOTIFY_OBJECT_MEMBER NOTIFY_MBR VARCHAR(10) The name of the database file member that is the
notify object for the commitment definition.
Nullable
Contains the null value if there is no notification
object or NOTIFY_OBJECT_TYPE is not *FILE.
VOTE_READ_ONLY_PERMITTED VOTE_RO VARCHAR(3) Indicates whether this system can vote read-only
in response to a commit operation started on
another system. Note: If this system votes read-
only, control is not returned to the application
until this system receives a message from the
starting system containing an indicator that the
next logical unit of work has started. The length
of the delay in regaining control depends on the
application running on the starting system. This
value is set to NO when commitment control is
started and can be changed using the Change
Commitment Options (QTNCHGCO) API.
END_JOB_ACTION ENDJOB_ACT VARCHAR(8) Indicates what this system does if the logical
unit of work is in an undecided state and the job
Nullable is ending abnormally. This value is set to WAIT
when commitment control is started and can be
changed using the Change Commitment Options
(QTNCHGCO) API.
ACCEPT_VOTE_RELIABLE ACCEPT_VR VARCHAR(3) Indicates whether this system accepts the vote
reliable indicator if it is received from its agents
during the prepare wave of a commit operation.
The vote reliable indicator indicates that it is
unlikely that a heuristic decision will be made
at the agent if a failure occurs before the
committed wave completes. If an agent sends
the vote reliable indicator, and this location
accepts it, performance is improved because one
communications flow is eliminated and control is
returned to the application before the committed
wave is completed for that agent. However, if a
heuristic decision is made at that agent which
causes heuristic damage, the application at this
location will not receive an error message if the
Accept vote reliable commitment option is set to
YES. This value is set to YES when commitment
control is started and can be changed using the
Change Commitment Options (QTNCHGCO) API.
If the commitment definition has a Wait for
outcome value of Wait or inherits a value of Wait,
the value of the Accept vote reliable commitment
option is ignored, and the system behaves as
though the Accept vote reliable commitment
option is No.
XA_TRANSACTION_MANAGER XA_MANAGER VARCHAR(10) The name of the transaction manager that started
the XA transaction branch represented by this
Nullable commitment definition.
Contains the null value if the commitment
definition is not a *TNSOBJ scoped commitment
definition or if the transaction manager name was
not specified for the commitment definition.
XA_XID_FORMAT_ID XA_FMTID VARBINARY(4) The hex value of the format identifier portion of
the XA transaction identifier (XID).
Nullable
Contains the null value if the commitment
definition is not a *TNSOBJ scoped commitment
definition.
XA_XID_GLOBAL_TRANSACTION_ID XA_GTRID VARBINARY(64) The hex value of the global transaction identifier
(GTRID) portion of the XA transaction identifier
Nullable (XID).
Contains the null value if the commitment
definition is not a *TNSOBJ scoped commitment
definition.
XA_XID_BRANCH_QUALIFIER XA_BQUAL VARBINARY(64) The hex value of the branch qualifier (BQUAL)
portion of the XA transaction identifier (XID).
Nullable
Contains the null value if the commitment
definition is not a *TNSOBJ scoped commitment
definition.
XA_OPEN_SQL_HOLD XA_SQLHOLD CHAR(1) Indicates how SQL cursors are affected by some
XA operations. Specified on the db2xa_open() API
Nullable xainfo string SQLHOLD keyword.
E • db2xa_commit():
Cursors declared WITH HOLD are held
open. Cursors not declared WITH HOLD
are closed.
• db2xa_rollback():
All cursors are closed.
• db2xa_end():
Cursors declared WITH HOLD are held
open. Cursors not declared WITH HOLD
are closed.
L • db2xa_commit():
If the relational database resides on an
IBM i, all cursors are left open.
Otherwise, cursors declared WITH HOLD
are left open and cursors not declared
WITH HOLD are closed.
• db2xa_rollback():
If the relational database resides on an
IBM i, all cursors are left open.
Otherwise, all cursors are closed.
• db2xa_end():
All cursors are held open.
N • db2xa_commit():
Cursors declared WITH HOLD are held
open. Cursors not declared WITH HOLD
are closed.
• db2xa_rollback():
All cursors are closed.
• db2xa_end():
All cursors are held open.
XA_LOCK_SHARING XA_LOCKSHR VARCHAR(3) Specifies whether locks are shared with loosely
coupled transaction branches. A loosely coupled
Nullable transaction branch is one with a transaction
identifier (XID) that has the same global
transaction identifier (GTRID) but a different
branch qualifier (BQUAL).
Example
• Show all jobs that have local work that has not been committed. The rows that are returned are not
ordered.
SELECT *
FROM QSYS2.DB_TRANSACTION_INFO
WHERE LOCAL_CHANGES_PENDING = 'YES';
• Show all jobs that have a commitment definition. Order the returned rows by job name, then job user,
then by job number.
SELECT *
FROM QSYS2.DB_TRANSACTION_INFO
ORDER BY SUBSTR(SUBSTR(JOB_NAME,8),POSSTR(SUBSTR(JOB_NAME,8),'/')+1), --job name
SUBSTR(JOB_NAME,8,POSSTR(SUBSTR(JOB_NAME,8),'/')-1), -- job user
SUBSTR(JOB_NAME,1,6) -- job number
;
DB_TRANSACTION_JOURNAL_INFO ( lock-space-id )
LOCK_SPACE_ID =>
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 94. DB_TRANSACTION_JOURNAL_INFO table function
JOURNAL_LIBRARY VARCHAR(10) The name of the library that contains the journal.
COMMIT_CYCLE DECIMAL(21,0) The commit cycle identifier of the current logical unit
of work (LUW) for this journal. The commit cycle
identifier is the sequence number of the journal entry
that corresponds to the beginning of the current LUW
for the commitment definition.
Contains the null value if no changes have been made
to local database files under commitment control, and
no user journal entries have been sent to this journal
on behalf of an API resource that is journaled to this
journal during this LUW.
RECORD_ROLLBACK_STARTED TIMESTAMP(0) The timestamp when record level rollback started for
the journal.
Contains the null value if a rollback has not started.
INDEX_CLEANUP_STARTED TIMESTAMP(0) The timestamp when the index cleanup started for the
journal.
Contains the null value if cleanup has not started.
Example
• Show the status of journal resources under commitment control for a specific lock space ID.
DB_TRANSACTION_OBJECT_INFO ( lock-space-id )
LOCK_SPACE_ID =>
lock-space-id A character string that contains the lock space identifier of the commitment definition to
use.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 95. DB_TRANSACTION_OBJECT_INFO table function
ORDINAL_POSITION INTEGER The relative position of this row in the result data set.
This indicates the order in which the object changed,
with 1 being the oldest row.
OBJECT_LIBRARY VARCHAR(10) The name of the library that contains the object.
OBJECT_NAME VARCHAR(10) The name of the object under commitment control for
the commitment definition.
Example
• View all the objects associated with a given commit definition.
DB_TRANSACTION_RECORD_INFO ( lock-space-id )
LOCK_SPACE_ID =>
lock-space-id A character string that contains the lock space identifier of the commitment definition to
use.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 96. DB_TRANSACTION_RECORD_INFO table function
LIBRARY_NAME VARCHAR(10) The name of the library that contains the file.
FILE_NAME VARCHAR(10) The name of the local database file under commitment
control for the commitment definition.
FILE_CHANGES_COMMITTED BIGINT The total number of record level changes to the file
that have been committed.
Returns the value 32768 when more than 32767
changes have been committed.
Contains the null value if an IPL has been performed
on the system since the commitment definition was
created.
FILE_CHANGES_ROLLED_BACK BIGINT The total number of record level changes to the file
that have been rolled back.
Returns the value 32768 when more than 32767
changes have been rolled back.
Contains the null value if an IPL has been performed
on the system since the commitment definition was
created.
CONCURRENT_ACCESS_RESOLUTION VARCHAR(7) The concurrent access resolution setting for this file.
JOURNAL_NAME VARCHAR(10) The journal in which changes to the file are recorded.
Can contain the following special value:
COMMIT_CYCLE DECIMAL(21,0) The commit cycle identifier of the current logical unit
of work (LUW) for this file's journal. The commit cycle
identifier is the sequence number of the journal entry
that corresponds to the beginning of the current LUW
for the commitment definition.
Contains the null value if no changes have been made
to local database files under commitment control, and
no user journal entries have been sent to this journal
on behalf of an API resource that is journaled to the
file's journal during this LUW.
Example
• View all the files associated with a given commit definition.
• View all the files with pending changes for a given commit definition.
ENVIRONMENT_VARIABLE_INFO view
The ENVIRONMENT_VARIABLE_INFO view contains information about environment variables.
The values returned for the columns in the view are similar to the values returned by the WRKENVVAR
CL command or Get All System-Level Environment Variables API. Refer to the API for more detailed
information.
Authorization: None required.
The following table describes the columns in the view. The system name is ENV_VARS. The schema is
QSYS2.
ENVIRONMENT_VARIABLE_CCSID VAR_CCSID INTEGER The CCSID value associated with the environment
variable.
Example
Look at all system level environment variables and their values for this connection:
ERRNO_INFO ( errno )
ERRNO =>
Note
This function is provided in the SYSTOOLS schema as an example of how to embed a C language interface
in an SQL scalar function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can
be extracted and used as a model for building similar helper functions, or to create a customized version
within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Return information for errno 3025.
VALUES SYSTOOLS.ERRNO_INFO(3025);
EXIT_POINT_INFO view
The EXIT_POINT_INFO view returns information about exit points.
The values returned for the columns in the view are closely related to the values returned by the
Work with Registration Information (WRKREGINF) CL command and by the Retrieve Exit Information
(QUSRTVEI, QusRetrieveExitInformation) API.
Authorization: None required.
The following table describes the columns in the view. The system name is EXIT_POINT. The schema is
QSYS2.
Table 98. EXIT_POINT_INFO view
TEXT_DESCRIPTION TEXT VARCHAR(132) The descriptive text for the exit point.
Example
• List all the security exit points.
EXIT_PROGRAM_INFO view
The EXIT_PROGRAM_INFO view returns information about exit programs.
The values returned for the columns in the view are closely related to the values returned by the
Work with Registration Information (WRKREGINF) CL command and by the Retrieve Exit Information
(QUSRTVEI, QusRetrieveExitInformation) API.
Authorization: None required.
The following table describes the columns in the view. The system name is EXIT_PGM. The schema is
QSYS2.
Table 99. EXIT_PROGRAM_INFO view
EXIT_POINT_FORMAT EXIT_FMT CHAR(8) The exit point format name associated with the
exit point.
REGISTERED REGISTERED VARCHAR(3) Whether the exit point is registered with the
registration facility.
COMPLETE COMPLETE VARCHAR(3) Whether the information returned for the exit
point is complete and accurate. Incomplete
information may occur when the exit point's
retrieve preprocessing program indicates that
the information it returned is incomplete or
inaccurate.
EXIT_PROGRAM_NUMBER NUMBER INTEGER The exit program number associated with the exit
program. This number determines the processing
sequence of exit programs associated with an exit
point, where the lowest number is processed first.
TEXT_DESCRIPTION TEXT VARCHAR(132) The descriptive text for the exit program .
EXIT_PROGRAM_DATA DATA VARCHAR(2048) The data that is associated with the exit program.
EXIT_PROGRAM_DATA_CCSID DATA_CCSID INTEGER The coded character set identifier (CCSID) to use
for working with the exit program data.
Nullable
Contains the null value when
EXIT_PROGRAM_DATA is null.
THREADSAFE THREADSAFE VARCHAR(3) The thread safety status of the exit program entry.
MULTITHREADED_JOB_ACTION JOB_ACTION VARCHAR(6) The action to take when calling an exit program in
a multithreaded job.
Example
• List all the exit programs associated with security exit points.
SELECT *
FROM QSYS2.EXIT_PROGRAM_INFO
WHERE EXIT_POINT_NAME LIKE 'QIBM_QSY%'
ORDER BY EXIT_POINT_NAME, EXIT_PROGRAM_NUMBER;
, spreadsheet-query
SPREADSHEET_QUERY =>
, library-name
LIBRARY_NAME =>
, file-name
FILE_NAME =>
, spreadsheet-type
SPREADSHEET_TYPE =>
)
, column-headings
COLUMN_HEADINGS =>
path-name A character string containing the name of the path where the result spreadsheet file
is to be written. An existing file is overwritten.
spreadsheet- A character string containing a query to run that identifies the rows to be included in
query the spreadsheet. The query can be up to 4000 characters long. Objects referenced in
the query must be fully qualified.
If this parameter is omitted, library-name and file-name must be specified.
library-name The name of the library containing file-name. QTEMP, *LIBL, and *CURLIB are not
supported.
file-name A character string containing the name of the database file that contains the rows
and columns of data to include in the spreadsheet. The file must be in SYSBASE.
If spreadsheet-query is specified, values for library-name and file-name are ignored.
spreadsheet- A character string containing the type of spreadsheet to generate. The supported
type values are csv, ods, txt, xls, and xlsx. These values must be provided in lower
case.
If this parameter is omitted, csv is used.
column-headings A character string that specifies whether a heading row is included in the
spreadsheet result.
The result of the function is an integer. If the function is successful, it returns a value of 1. If the function
encounters an error, it returns a value of -1.
Example
• Create a spreadsheet that contains the data from MYLIB/A.
VALUES SYSTOOLS.GENERATE_SPREADSHEET(
PATH_NAME => '/usr/fileA_spreadsheet',
FILE_NAME => 'A',
LIBRARY_NAME => 'MYLIB');
• Create a spreadsheet that contains the data from a query. Return column names in the first row of the
spreadsheet.
VALUES SYSTOOLS.GENERATE_SPREADSHEET(
PATH_NAME => '/usr/query_spreadsheet',
SPREADSHEET_QUERY => 'select order_number, customer, balance
from orders where shipped = ''YES''',
COLUMN_HEADINGS => 'COLUMN');
GETENV ( environment-variable-name
ENVIRONMENT_VARIABLE_NAME =>
The result of the function is a variable-length character string that contains the value of the environment
variable, from 0 to 1024 characters in length. If the environment variable is not found, the function
returns the null value.
Note
This function is provided in the SYSTOOLS schema as an example of how to embed a C interface within
SQL PL code. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be extracted
and used as a model for building similar helper functions, or to create a customized version within a
user-specified schema.
Example
• Get the value of MY_ENVVAR for the current job.
VALUES SYSTOOLS.GETENV('MY_ENVVAR');
LPRINTF procedure
The LPRINTF procedure writes an informational message to the joblog. It is severity 0 and has no
message identifier.
Authorization: See Note below.
LPRINTF ( print-string )
PRINT_STRING =>
print-string A character or graphic string containing the information to be written to the joblog. It can be
up to 30,720 characters long.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to write to the joblog using
an SQL procedure. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be
extracted and used as a model for building similar procedures, or to create a customized version within a
user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Write a message to the joblog.
PROGRAM_EXPORT_IMPORT_INFO view
The PROGRAM_EXPORT_IMPORT_INFO view returns the data and procedure that are exported or
imported for an ILE program or service program.
The values returned for the columns in the view are closely related to the values returned for *PROCEXP,
*DTAEXP, *ACTGRPEXP, and *ACTGRPIMP detail on the DSPSRVPGM (Display Service Program) CL
command and *ACTGRPEXP and *ACTGRPIMP detail on the DSPPGM (Display Program) CL command.
It is similar to the information returned by the List Service Program Information (QBNLSPGM) and List
Program Information (QBNLPGMI) APIs.
Authorization: The caller must have:
*PGM A program.
CCSID 1200
DATA_ITEM_SIZE DATA_SIZE INTEGER The size of the data item export, in bytes.
Example
• Show all the procedure exports for service program APP_PGM1 in APPLIB.
SELECT *
FROM QSYS2.PROGRAM_EXPORT_IMPORT_INFO
WHERE PROGRAM_LIBRARY = 'APPLIB' AND
PROGRAM_NAME = 'APP_PGM1' AND
OBJECT_TYPE = '*SRVPGM' AND
SYMBOL_USAGE = '*PROCEXP';
• Find the service program in QSYS that exports printf to joblog (Qp0zLprintf).
SELECT *
FROM QSYS2.PROGRAM_EXPORT_IMPORT_INFO
WHERE PROGRAM_LIBRARY = 'QSYS' AND SYMBOL_NAME = 'Qp0zLprintf';
*PGM A program.
TEXT_DESCRIPTION TEXT VARCHAR(50) The user text, if any, used to briefly describe the
program or service program.
Nullable
Contains the null value if there is no text
description.
PROGRAM_ATTRIBUTE ATTRIBUTE VARCHAR(10) For an ILE program, the ILE language used for the
module containing the program entry procedure
Nullable (PEP).
For a service program, the language in which the
modules of the service program are written.
For an OPM program, the language the program is
written in.
Contains the null value is there is no attribute
value or if a service program contains modules
generated by different compilers.
USER_PROFILE USRPRF VARCHAR(6) The value specified for the USRPRF option on the
command used to create the program or service
program.
USE_ADOPTED_AUTHORITY USEADPAUT VARCHAR(4) The value specified for the USEADPAUT option
on the command used to change the program or
service program.
EARLIEST_POSSIBLE_RELEASE EARLY_REL CHAR(6) The version, release, and modification level of the
earliest release the program or service program is
allowed to run on, in VvRrMm format. The target
release (TGTRLS) parameter of the command can
affect this value.
RELEASE_CREATED_ON CREATE_ON CHAR(6) The version, release, and modification level of the
operating system, in VvRrMm format, on which
Nullable the program or service program was created.
Contains the null value for OPM programs.
TARGET_RELEASE TGTRLS CHAR(6) This is the release specified on the target release
(TGTRLS) parameter of the command.
Nullable
Contains the null value for OPM programs.
ASSOCIATED_SPACE_SIZE ASSOC_SIZE INTEGER The size (in bytes) of the associated space used
by this program or service program.
PAGING_POOL POOL VARCHAR(8) The paging pool used for the program or service
program object.
PAGING_AMOUNT PAGEAMOUNT VARCHAR(8) The paging behavior for the program or service
program.
The following columns apply to ILE programs and service programs. They will contain the null value for OPM programs.
PROGRAM_ENTRY_PROCEDURE_ PEP_LIB VARCHAR(10) The library name that contained the module that
MODULE_LIBRARY contained the program entry procedure for this
Nullable program when the bind was done.
Contains the null value if this is a service program.
PROGRAM_ENTRY_PROCEDURE_MODULE PEP_MODULE VARCHAR(10) The module name that contains the program
entry procedure for this program.
Nullable
Contains the null value if this is a service program.
ACTIVATION_GROUP ACTGRP VARCHAR(10) The name of the activation group in which this
program or service program runs. If the activation
Nullable group already exists when the program or service
program is called, it runs in the existing activation
group. If the activation group does not exist, a
new activation group is created and the program
or service program runs in it. Can contain the
following special values:
PROFILING_DATA PRF_DATA VARCHAR(10) Specifies the profiling data attribute for this
program or service program.
Nullable
*APYALL Block order and procedure
order profiling data are applied
to this program or service
program. The collection of
profiling data is no longer
enabled.
STORAGE_MODEL STGMDL VARCHAR(10) Where the automatic and static storage for this
program or service program is allocated at run
Nullable time.
NUMBER_OF_UNRESOLVED_REFERENCES UNRESOLVED INTEGER The number of symbols that could not be resolved
at Create Program (CRTPGM) or Create Service
Nullable Program (CRTSRVPGM) command time.
MINIMUM_STATIC_STORAGE_SIZE MIN_STATIC BIGINT The minimum static storage size, in bytes, that
this program or service program needs in order to
Nullable run.
MAXIMUM_STATIC_STORAGE_SIZE MAX_STATIC BIGINT The maximum static storage size, in bytes, that
this program or service program may need in
Nullable order to run.
PROGRAM_SIZE PGM_SIZE INTEGER The total size of the program or service program,
in kilobytes.
Nullable
MAXIMUM_PROGRAM_SIZE MAXPGMSIZE INTEGER The maximum size that an ILE program or service
program can be, in kilobytes.
Nullable
MODULES MODULES INTEGER The number of modules bound into this program
or service program.
Nullable
MAXIMUM_STRING_DIRECTORY_SIZE MAXSTRDIR INTEGER The maximum size that the string directory can be
in an ILE program or service program.
Nullable
EXPORT_SOURCE_LIBRARY EXP_SRCLIB VARCHAR(10) The name of the library that contains the export
source file. Can contain the following special
Nullable value:
EXPORT_SOURCE_FILE EXP_SRCF VARCHAR(10) The name of the export source file that contains
the export source file member.
Nullable
Contains the null value if this is not a service
program, if there is no export source, if the export
source was not specified using a source file, or if
you are not authorized to this information.
EXPORT_SOURCE_FILE_MEMBER EXP_SRCM VARCHAR(10) The name of the member in the export source file
that was used to create this service program.
Nullable
Contains the null value if EXPORT_SOURCE_FILE
is null.
EXPORT_SOURCE_STREAM_FILE EXP_STMF VARGRAPHIC(5000) The path name of the stream file that contains the
CCSID 1200 export source for this service program.
DATA_EXPORTS DATAEXP INTEGER The number of data items exported from this
service program.
Nullable
Contains the null value if this is not a service
program.
MAXIMUM_DATA_EXPORTS MAXDATAEXP INTEGER The maximum number of data items that can be
exported by a service program.
Nullable
Contains the null value if this is not a service
program.
EXPORT_SIGNATURES EXP_SIG BLOB(557038) The list of export signatures for this service
program. Each signature is a binary string with a
Nullable length of 16. A single hexadecimal 00 character
separates values.
The current export signature of this service
program is the first one in the list.
Contains the null value if this is not a service
program.
The following columns apply to OPM programs. They will contain the null value for ILE programs and service programs.
SOURCE_FILE_LIBRARY SRCLIB VARCHAR(10) The name of the library that contains the source
file used to create the program..
Nullable
Contains the null value if no source file was used
to create the program.
SOURCE_FILE SRCFILE VARCHAR(10) The name of the source file used to create the
program.
Nullable
Contains the null value if no source file was used
to create the program.
SOURCE_FILE_MEMBER SRCMBR VARCHAR(10) The name of the member in the source file.
SOURCE_FILE_CHANGE_ SRCF_CHGTS TIMESTAMP(0) The timestamp of when the member in the source
TIMESTAMP file was last updated.
Nullable
Contains the null value if no source file was used
to create the program.
SORT_SEQUENCE_LIBRARY SRTSEQ_LIB VARCHAR(10) The name of the library that contained the sort
sequence table used when the module was
Nullable compiled. This does not apply to SQL statements
in the module. Can contain the following special
values:
SORT_SEQUENCE SRTSEQ VARCHAR(10) The name of the sort sequence table used when
the program was compiled. This does not apply to
Nullable SQL statements in the program. Can contain the
following special values:
LANGUAGE_ID LANGID VARCHAR(7) The language identifier used when the program
was compiled. This does not apply to SQL
Nullable statements in the program. Can contain the
following special value:
OBSERVABLE OBSERVABLE VARCHAR(6) Whether the OPM program contains creation data
and if that data is observable or unobservable. All
Nullable observable creation data is needed to re-create
the program using CHGPGM. All creation data
(either observable or unobservable) is needed to
convert the program during restore.
LOG_COMMANDS LOGCMD VARCHAR(4) The value specified for the LOG parameter of the
CRTCLPGM command.
Nullable
*JOB Logging of commands in a running CL
program depends on the status of the
job's logging flag.
UPDATE_PASA UPDPASA VARCHAR(10) The compiler may have allowed you to control this
attribute through the GENOPT parameter of the
Nullable command used to create the program.
CLEAR_PASA CLRPASA VARCHAR(10) The compiler may have allowed you to control this
attribute through the GENOPT parameter of the
Nullable command used to create the program.
b A blank character.
Nullable
STATIC_STORAGE_SIZE STATIC_STG INTEGER The size (in bytes) of the static storage used by
the program.
Nullable
AUTOMATIC_STORAGE_SIZE AUTO_STG INTEGER The size (in bytes) of the automatic storage used
by this program.
Nullable
SQL_RELATIONAL_DATABASE RDB VARCHAR(18) The default relational database that was specified
on the SQL precompile. Can contain the following
Nullable special value:
*NONE No commit.
SQL_NAMING NAMING VARCHAR(4) The convention used for naming objects in SQL
statements.
Nullable
*SQL The SQL naming convention is used.
SQL_SORT_SEQUENCE_LIBRARY SQL_SSEQLB VARCHAR(10) The name of the library that is used to locate the
SQL sort sequence table. The following special
Nullable values can be returned:
SQL_SORT_SEQUENCE SQL_SRTSEQ VARCHAR(10) The sort sequence table name specified when
the program was compiled. The following special
Nullable values can be returned:
SQL_DEFAULT_SCHEMA DFTRDBCOL VARCHAR(10) The schema name used for unqualified names of
tables, views, indexes, and SQL packages in static
Nullable statements.
Contains the null value if there is no default
schema name or if the program does not contain
SQL statements.
SQL_DYNAMIC_USER_PROFILE DYNUSRPRF VARCHAR(10) The user profile used for dynamic SQL
statements. The following special values can be
Nullable returned:
SQL_ALLOW_COPY_DATA ALWCPYDTA VARCHAR(9) Whether a copy of the data can be used in the
implementation of an SQL query.
Nullable
*NO A copy of the data is not allowed.
SQL_PACKAGE_LIBRARY SQLPKGLIB VARCHAR(10) The name of the library the SQL package is in.
Examples
• Summarize the activation group usage for all ILE programs in APPLIB.
PUTENV ( environment-variable-name
ENVIRONMENT_VARIABLE_NAME =>
, environment-variable-value )
ENVIRONMENT_VARIABLE_VALUE =>
The result of the function is an integer. The function returns the following values:
0 The operation was successful.
non-zero The operation failed. The return value corresponds to the errno value from the API which
describes the failure.
Note
This function is provided in the SYSTOOLS schema as an example of how to embed a C interface within
SQL PL code. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be extracted
and used as a model for building similar helper functions, or to create a customized version within a
user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Set the value of MY_ENVVAR for the current job.
QCMDEXC ( CL-command-string )
Examples
• Add a library to the library list.
QCMDEXC ( command )
COMMAND =>
command A character string containing a CL command. The maximum length is 32000 characters.
The result of the function is an integer. If the command is successful, the function returns a value of 1. If
the command execution fails, the function returns a value of -1.
Example
Hold any jobs that started running an SQL statement more than 2 hours ago.
SELECT JOB_NAME,
CASE WHEN QSYS2.QCMDEXC('HLDJOB ' CONCAT JOB_NAME) = 1 THEN 'Job Held'
ELSE 'Job not held'
END AS HLDJOB_RESULT
FROM TABLE (QSYS2.ACTIVE_JOB_INFO (DETAILED_INFO=> 'ALL'))
WHERE SQL_STATEMENT_START_TIMESTAMP < CURRENT TIMESTAMP - 2 HOURS;
RECEIVE_DATA_QUEUE ( data-queue
DATA_QUEUE =>
, data-queue-library
DATA_QUEUE_LIBRARY =>
, remove
REMOVE =>
, wait-time
WAIT_TIME =>
, key-data
KEY_DATA =>
)
, key-order
KEY_ORDER =>
data- A character or graphic string containing the name of the data queue.
queue
data- A character or graphic string containing the name of the library containing the data queue.
queue- Can be one of the following special values:
library
*CURLIB The job's current library is used.
*LIBL The library list is used. This is the default.
remove A character or graphic string indicating whether the message is to be removed from the data
queue after it is received.
wait-time The amount of time to wait, in seconds and milliseconds, if no entries exist on the data
queue. The value can be from -99999 to 99999.000.
• Any value less than zero indicates to wait forever.
• A value of zero means to continue processing immediately. This is the default.
• A positive value indicates the length of time to wait. The milliseconds part of the time is
ignored for any value over 100 and for DDM data queues.
EQ Equal
GE Greater than or equal
GT Greater than
LE Less than or equal
LT Less than
NE Not equal
The result of the function is a table containing one row or no rows with the format shown in the following
table. All the columns are nullable.
Table 102. RECEIVE_DATA_QUEUE table function
MESSAGE_DATA CLOB(64512) The message received from the data queue as character data.
MESSAGE_DATA_UTF8 CLOB(64512) CCSID The message received from the data queue represented as character data in
1208 CCSID 1208.
MESSAGE_DATA_BINARY BLOB(64512) The message received from the data queue in binary form. This is the raw form of
the data.
KEY_DATA VARCHAR(256) For a keyed data queue. the key value of the returned message. This is the actual
key value, which could be different than the key-data parameter value.
Contains the null value if this is not a keyed data queue.
Example
Get the message from data queue DQ1 in TESTLIB with key 456.
REMOVE_USER_INDEX_ENTRY ( user-index
, user-index-library
USER_INDEX_LIBRARY =>
, operation
OPERATION =>
, remove-value
REMOVE_VALUE =>
, remove-value-end
REMOVE_VALUE_END =>
)
, max-remove
MAX_REMOVE =>
user-index A character string containing the name of the user index for the removal of entries.
user-index- A character string containing the name of the library where the user index is located. Can
library be one of the following special values:
operation The operation to be used for comparing remove-value and remove-value-end and the index
value.
If the index is keyed, the complete entry consists of the key followed by the entry
data. If the length of remove-value is less than or equal to the length of the key, the
comparison only applies to the key. If the length of remove-value is greater than the key,
the comparison will include some or all of the entry data as well.
If the index is not keyed, the comparison applies to the value of the entry data.
remove- A string that specifies the value to compare with the index value to determine whether an
value index entry is to be removed.
• For REMOVE_USER_INDEX_ENTRY, the input value will be converted to a character string
using the job CCSID.
• For REMOVE_USER_INDEX_ENTRY_BINARY, the input value will be considered a binary
string.
This parameter is ignored when operation is FIRST or LAST. It is required for all other
operation values.
remove- A string that specifies the value to compare with the index value as the upper bound for
value-end BETWEEN. The lengths of remove-value and remove-value-end must be the same.
• For REMOVE_USER_INDEX_ENTRY, the input value will be converted to a character string
using the job CCSID.
• For REMOVE_USER_INDEX_ENTRY_BINARY, the input value will be considered a binary
string.
This parameter is ignored when operation is not BETWEEN. It is required when operation is
BETWEEN.
max- An integer value that specifies the maximum number of user index entries satisfying the
remove remove comparison that should be removed. A value of -1 can be used to remove all index
entries that satisfy the remove comparison. The default is -1.
The result of the function is a table containing one row for each index entry that was removed with the
format shown in the following table. All columns are nullable.
Table 103. REMOVE_USER_INDEX_ENTRY table function
ORDINAL_POSITION INTEGER The relative position of this row in the set of removed index entries.
USER_INDEX_LIBRARY VARCHAR(10) The name of the library where the user index was found.
REMOVED_ENTRY VARCHAR(2000) The data for the index entry that was removed, in character form. The
value includes both the key and the entry data.
REMOVED_ENTRY_BINARY VARBINARY(2000) The data for the index entry that was removed, in binary form. This is
the raw bytes of data. The value includes both the key and the entry
data.
Example
• Remove all index entries with a key value less than '00173'.
SEND_DATA_QUEUE ( message-data
SEND_DATA_QUEUE_UTF8
, data-queue
DATA_QUEUE =>
, data-queue-library
DATA_QUEUE_LIBRARY =>
, key-data
KEY_DATA =>
)
, asynchronous
ASYNCHRONOUS =>
message-data The data to send to the message queue. The string can be up to 64512 characters
long.
• For SEND_DATA_QUEUE, the input value will be converted to a character string with
the job CCSID.
• For SEND_DATA_QUEUE_BINARY, the input value will be converted to a binary
string.
• For SEND_DATA_QUEUE_UTF8, the input value will be converted to a UTF-8 string.
data-queue A character or graphic string containing the name of the data queue.
data-queue- A character or graphic string containing the name of the library containing the data
library queue. Can be one of the following special values:
key-data A character string containing the key data to send to the data queue. This parameter
is required for a keyed data queue. It must not be specified for a non-keyed data
queue.
Example
Send a message to data queue DQ1 in TESTLIB with key 456.
SEND_EMAIL ( to-email
TO_EMAIL =>
, subject , body
SUBJECT => BODY =>
, attachment
ATTACHMENT =>
, cc-email
CC_EMAIL =>
)
, bcc-email
BCC_EMAIL =>
to-email A character string containing one or more email addresses. Addresses must be separated
by a comma. Blanks included before or after each comma are ignored.
The total number of email addresses provided with the to-email, cc-email, and bcc-email
parameters cannot exceed 20.
subject A character string up to 255 characters long containing the subject of the email.
The result of the function is an integer. If the command is successful, the function returns a value of 1. If
the command returns an error, the function returns a value of -1.
Note
This function is provided in the SYSTOOLS schema as an example of how send an email using the
SNDSMTPEMM CL command in an SQL scalar function. Similar to other Db2 for i provided tools within
SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or
to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Examples
• Send an email to a user with an attachment.
SERVICES_INFO table
The SERVICES_INFO table returns information about system-supplied services.
Authorization: The caller must have:
• *EXECUTE authority to QSYS2, and
• *OBJOPR and *READ authority to the QSYS2/SERV_INFO file.
System Column
Column Name Name Data Type Description
Nullable • *FILE
• *SRVPGM
Contains null for procedures, functions, and global variables.
LATEST_DB2_GROUP_LEVEL GROUPLVL INTEGER The Db2 for i PTF Group level which most recently changed this
service.
Nullable
Contains null if the service has not been enhanced in a PTF in this
release.
System Column
Column Name Name Data Type Description
INITIAL_DB2_GROUP_LEVEL INITIALLVL INTEGER The Db2 for i PTF Group level where this service was introduced.
Nullable Contains null if this service was available in the base for this
release.
EARLIEST_POSSIBLE_RELEASE MINRLS VARCHAR(6) The earliest release, in VxRxMx format, where a version of this
service is available.
EXAMPLE EXAMPLE VARCHAR(5000) An example SQL script that uses this service.
Example
Show all the available PTF services:
SQL_DB2_GROUP_LEVEL Indicates the use of SQL language features. For example, new SQL
statements or query clauses surface as dependencies upon having a
certain Db2 PTF Group level (or higher) installed before the statement
can be run.
This is an SQL syntax level and is an accurate indication of the
dependency level.
To check all programs in APPLIB for potential SQL syntax and IBM i Service dependencies, execute the
following query. Only programs created after the SERVICES_INFO table was introduced will report this
information.
To see more detailed information about which services are used in a program, including the name of each
service and the Db2 PTF Group level required for the service, perform the following steps:
1. STRDBG UPDPROD(*YES)
2. Precompile your program or build your SQL procedure, function, or trigger.
• To have informational messages written to the listing, add SET OPTION OUTPUT=*PRINT to your
SQL routine or specify the OUTPUT(*PRINT) parameter on the CRTSQLxxx or RUNSQLSTM CL
commands
3. For each reference to a service, message SQL7901 will be written to the joblog and, optionally, to the
precompile listing.
If you precompile with a TGTRLS of 7.1 or later, a message will be issued for each of the earlier
releases as well with an indication of the Db2 PTF Group level that is needed on that release. If the
service is not supported for a release, message SQL795B will be issued.
This information can be used to determine whether your application contains any content that might
require a certain level of Db2 PTF Group. If you need to deploy your application to a different partition or
an earlier release, this feedback can alert you to potential dependencies.
After you have created one or more objects using the steps above, you can query your job log to see if any
messages were issued that might need to be addressed.
Here is one more query to help tie this information together. It will tell you the Db2 PTF Group level that is
on a partition.
SET_PASE_SHELL_INFO procedure
The SET_PASE_SHELL_INFO procedure provides the ability to set the path to the PASE shell for the
specified user or the path to the default shell returned for users that do not have a configured shell.
The path set by this procedure is returned in the pw_shell field in struct pw from PASE APIs such as
Get User Information for User Name (getpwnam) and Get User Information for User ID (getpwuid). It
is also returned by the QSYS2.USER_INFO view . If a user does not have a path set, the default shell
path is returned; if the default shell is not set, an empty string is returned. The pw_shell field is used
by PASE applications that need to execute shells for a user, such as the OpenSSH server. The OpenSSH
server will start this application as the initial program when the user logs in. If it is not set it will use /
QOpenSys/usr/bin/bsh instead.
Authorization:
• If AUTHORIZATION_NAME is *CURRENT or matches the caller of this procedure, no authorization is
needed.
• Otherwise, the caller must have:
– *SECADM special authority, and
– *OBJMGT and *USE authorities to the user profile identified by AUTHORIZATION_NAME.
, shell-path )
SHELL_PATH =>
authorization- A character or graphic string expression that identifies an existing user profile name.
name Can also be one of the following special values:
shell-path A character or graphic string expression that specifies the path to a PASE shell. The
string must begin with a forward slash (/).
If shell-path is blanks, the empty string, or NULL, the shell path is removed for the
user. Once the path is removed, the value specified for *DEFAULT (if any) will apply to
this user.
Examples
• Set the current user's shell to BASH shipped by 5733-OPS.
CALL QSYS2.SET_PASE_SHELL_INFO('*CURRENT',
'/QOpenSys/QIBM/ProdData/OPS/tools/bin/bash');
• Set the default shell to be ksh for any users that do not have an explicit shell set.
SPLIT ( input-list ,
INPUT_LIST => DELIMITER =>
delimiter )
, escape
ESCAPE =>
input-list An expression that contains a list to be deconstructed. The value is cast to CLOB(2G).
delimiter A character string expression that defines the separator between list elements. The value is
cast to VARCHAR(32672).
escape A character string expression with a length of 1 that defines a character that is used to escape
a delimiter sequence. If this parameter is provided, any delimiter sequence of characters
immediately proceeded by this character will not be interpreted as a delimiter. The escape
character will be removed from the returned element value.
ORDINAL INTEGER The relative position of this element in the input string. The first row has a
value of 1.
Note
This function is provided in the SYSTOOLS schema as an example of how to break a string apart at
a delimiting character by using an SQL table function. Similar to other Db2 for i provided tools within
SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or
to create a customized version within a user-specified schema.
Example
• Return a list of all authorities collected for all users for objects in the APP1 schema. First, a common
table expression breaks the detailed authority lists into separate rows for each authority using the
SPLIT table function. Then, all the authorities for the object are recombined into a single list for
each user, removing duplicate authorities and listing them alphabetically, using the LISTAGG aggregate
function.
WITH EXPANDED_AUTHS AS (
SELECT AUTHORIZATION_NAME, OBJECT_NAME, VARCHAR(TRIM(ELEMENT), 10) AS AUTH
FROM QSYS2.AUTHORITY_COLLECTION,
TABLE(SYSTOOLS.SPLIT(DETAILED_REQUIRED_AUTHORITY, ' '))
WHERE OBJECT_SCHEMA = 'APP1'
AND CHECK_ANY_AUTHORITY = 0)
SELECT AUTHORIZATION_NAME, OBJECT_NAME,
LISTAGG(DISTINCT AUTH, ' ') WITHIN GROUP(ORDER BY AUTH)
FROM EXPANDED_AUTHS
GROUP BY AUTHORIZATION_NAME, OBJECT_NAME
ORDER BY AUTHORIZATION_NAME, OBJECT_NAME;
, thread-id
THREAD_ID =>
)
, ignore-errors
IGNORE_ERRORS =>
job-name The qualified job name to return stack information. Can contain the following special value:
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
NO An error is returned.
YES A warning is returned.
No rows are returned when an error is encountered. This is the default.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 106. STACK_INFO table function
Contains the null value unless ALL was specified for the thread-id
input parameter.
ORDINAL_POSITION INTEGER A unique number for each row corresponding to a thread where 1 is
the first invocation entry for this thread and the highest number is the
most recent invocation entry for this thread.
PROGRAM_LIBRARY_NAME VARCHAR(10) The name of the library in which the program is located.
Nullable Contains the null value if the program is not located in a library or if
the program library name is not available.
STATEMENT_IDENTIFIERS VARCHAR(109) The high-level language statement identifier. If this column contains
Nullable the character representation of a number, the number is right-
adjusted and padded on the left with zeros (for example,
'0000000246'). If the call stack entry is for an integrated language
environment (ILE) procedure, more than one statement identifier may
exist. If more than one statement identifier is returned, each identifier
will be ten characters long with a single blank between them. Up to
ten identifiers will be returned.
Returns the null value if a statement identifier cannot be determined.
PROGRAM_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) device in which the
Nullable program is located. Can contain the following special value:
Contains the null value if the name of the ASP cannot be determined.
PROGRAM_ASP_NUMBER INTEGER The numeric identifier of the ASP containing the program.
Nullable
1 The program is in the system ASP.
MODULE_NAME VARCHAR(10) The module containing the integrated language environment (ILE)
Nullable procedure.
Contains the null value if this is not an ILE program or if the module
name is not available.
MODULE_LIBRARY_NAME VARCHAR(10) The name of the library in which the module is located.
Nullable Contains the null value if this is not an ILE program or if the module
library name is not available.
PROCEDURE_NAME VARCHAR(4096) The name of the procedure at this level of the call stack.
Nullable Returns the null value if this is not an ILE program or if the procedure
name cannot be determined.
ACTIVATION_GROUP_NUMBER DECIMAL(20,0) The number of the activation group within which the program or
Nullable procedure is running. This is an internal number that uniquely
identifies the activation group within the job.
Contains the null value if this is not an ILE program or incomplete
information is available.
ACTIVATION_GROUP_NAME VARCHAR(10) The name of the activation group within which the program or
Nullable procedure is running. Can contain the following special values:
JAVA_LINE_NUMBER INTEGER The line number where the invocation was interrupted.
Nullable Contains the null value if no line number can be determined.
JAVA_BYTE_CODE_OFFSET INTEGER The offset in bytes from the beginning of the Java method byte codes
Nullable to the resume point for the invocation.
Contains the null value if no Java byte code offset can be determined.
JAVA_CLASS_NAME DBCLOB(64000) CCSID 1200 The name of the Java class at this level of the call stack.
Nullable Returns the null value if the class name cannot be determined.
JAVA_METHOD_NAME DBCLOB(64000) CCSID 1200 The name of the Java method at this level of the call stack.
Nullable Returns the null value if the method name cannot be determined.
JAVA_METHOD_SIGNATURE DBCLOB(64000) CCSID 1200 The signature of the Java method at this level of the call stack.
Nullable Returns the null value if the signature cannot be determined.
JAVA_FILE_NAME DBCLOB(64000) CCSID 1200 The name of the Java file and directory that provides the location of
Nullable where the Java class was loaded at this level of the call stack. If the
Java class was loaded from a .jar or .zip file, then the location will be
the path to and the name of the .jar or .zip file. If the class was loaded
from a .class file, then the location will be the directory from which
the class was loaded.
Returns the null value if the file name cannot be determined.
JAVA_SOURCE_FILE_NAME DBCLOB(64000) CCSID 1200 The name of the Java source file at this level of the call stack.
Nullable Returns the null value if the source file name cannot be determined.
PASE_LINE_NUMBER BIGINT The line number where the invocation was interrupted.
Nullable Contains the null value if no line number can be determined.
PASE_INSTRUCTION_ADDRESS DECIMAL(20,0) The IBM PASE for i memory address for the instruction that will run
Nullable when execution resumes for the invocation.
PASE_INSTRUCTION_OFFSET BIGINT The offset in bytes from the beginning of the start of the procedure to
Nullable the instruction that is either the suspend point for the invocation or
the resume point for the invocation.
PASE_KERNEL_CODE VARCHAR(3) Whether the invocation is running IBM PASE for i kernel code.
Nullable
NO The current invocation is not IBM PASE for i kernel code.
PASE_BIT_CODE INTEGER Whether the invocation is running 32-bit or 64-bit IBM PASE for i
Nullable code.
PASE_ALTERNATE_RESUME_POINT VARCHAR(3) Whether the current entry is a second entry for a given invocation.
Nullable This flag is only used when the system can not reliably determine
which of two possible resume points will be used when an invocation
resumes execution.
PASE_PROCEDURE_NAME DBCLOB(4000) CCSID 1200 The name of the procedure at this level of the call stack.
Nullable Returns the null value if the procedure name cannot be determined.
PASE_LOAD_MODULE_NAME DBCLOB(1000) CCSID 1200 The name of the load module at this level of the call stack.
Nullable Returns the null value if the load module name cannot be determined.
PASE_LOAD_MODULE_PATH DBCLOB(4000) CCSID 1200 The path to the load module at this level of the call stack.
Nullable Returns the null value if the load module path cannot be determined.
PASE_SOURCE_PATH_AND_FILE DBCLOB(1000) CCSID 1200 The path and name for the source file used to create the procedure.
Nullable Returns the null value if the path and name for the source file cannot
be determined.
LIC_INSTRUCTION_OFFSET BIGINT The offset in bytes from the beginning of the start of the procedure to
Nullable the instruction that is either the suspend point for the invocation or
the resume point for the invocation.
LIC_PROCEDURE_NAME VARCHAR(4096) The name of the procedure at this level of the call stack.
Nullable Returns the null value if the procedure name cannot be determined.
LIC_LOAD_MODULE_NAME VARCHAR(64) The name of the load module at this level of the call stack.
Nullable Returns the null value if the load module name cannot be determined.
Example
• Find out whether ILE program MYPGM is on the stack for the current thread.
• Create a table that contains the stack for all of the threads in a specific job.
USER_INDEX_ENTRIES ( user-index
USER_INDEX =>
)
, user-index-library
USER_INDEX_LIBRARY =>
user-index A character or graphic string containing the name of the user index.
user-index- A character or graphic string containing the name of the library containing the user
library index. Can be one of the following special values:
The result of the function is a table containing one or more rows with the format shown in the following
table. All the columns are nullable.
Table 107. USER_INDEX_ENTRIES table function
ORDINAL_POSITION INTEGER The relative position of this row in the result data set.
USER_INDEX_LIBRARY VARCHAR(10) The library in which the user index was found.
KEY VARCHAR(2000) The key for the index entry in character form.
Contains the null value if the user index is not keyed.
KEY_BINARY VARBINARY(2000) The key for the index entry in binary form. This is the raw form of the data.
Contains the null value if the user index is not keyed.
ENTRY VARCHAR(2000) The data for the index entry in character form.
Contains the null value if the entry contains only a key value.
ENTRY_BINARY VARBINARY(2000) The data for the index entry in binary form. This is the raw form of the data.
Contains the null value if the entry contains only a key value.
Example
Look at all the entries in user index IX1 in TESTLIB.
USER_INDEX_INFO view
The USER_INDEX_INFO view returns the attributes of user indexes.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
User Index Attributes (QUSRUIAT) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the user index, and
• *USE authority to the user index.
The following table describes the columns in the view. The system name is USRIDX_INF. The schema is
QSYS2.
Table 108. USER_INDEX_INFO view
MAXIMUM_ENTRY_LENGTH MAX_LENGTH INTEGER The maximum entry length any user index entry
can have.
NO No immediate update
OPTIMIZATION OPTIMIZE VARCHAR(10) The optimization method used for user index
maintenance.
KEY_INSERTION KEYED VARCHAR(3) Whether inserts into the index are by key.
NO No insertion by key
ENTRIES_ADDED ADDED INTEGER The number of entries added to the user index.
ENTRIES_REMOVED REMOVED INTEGER The number of entries removed from the user
index.
Example
• Return a list of attributes for all user indexes in MYLIB.
)
, user-space-library
USER_SPACE_LIBRARY =>
user-space A character or graphic string containing the name of the user space.
user-space- A character or graphic string containing the name of the library containing the user
library space. Can be one of the following special values:
The result of the function is a table containing one row with the format shown in the following table. All
the columns are nullable.
Table 109. USER_SPACE table function
USER_SPACE_LIBRARY VARCHAR(10) The library in which the user space was found.
DATA CLOB(16M) The data from the user space as character data.
DATA_BINARY BLOB(16M) The data from the user space in binary form. This is the raw form of the data.
Example
Look at the untranslated contents of user space USERSPC1 in TESTLIB.
USER_SPACE_INFO view
The USER_SPACE_INFO view returns the attributes of user spaces.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
User Space Attributes (QUSRUSAT) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the user space, and
• *USE authority to the user space.
The following table describes the columns in the view. The system name is USRSPC_INF. The schema is
QSYS2.
Table 110. USER_SPACE_INFO view
SIZE SIZE INTEGER The size of the user space object in bytes.
INITIAL_VALUE INITIAL BINARY(1) The initial value to which future extensions of the
user space will be set.
Example
• Return a list of user spaces in MYLIB.
WATCH_DETAIL ( session-id )
SESSION_ID =>
session-id A character or graphic string expression that contains the session identifier that the watch
details are returned for.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 111. WATCH_DETAIL table function
The following columns apply when DETAIL_TYPE is MESSAGE. They will contain the null value when DETAIL_TYPE is LICLOG or PAL.
MESSAGE_QUEUE_LIBRARY VARCHAR(10) The name of the library where the message queue is located.
Contains the null value if MESSAGE_QUEUE is *JOBLOG.
MESSAGE_QUEUE VARCHAR(10) The name of the message queue to watch. Can contain the following
special value:
MESSAGE_JOB_NAME VARCHAR(10) The job name of the job to be watched. Can contain the following
special values:
*ALL All jobs with the specified job user name are watched.
MESSAGE_JOB_USER VARCHAR(10) The user name of the job to be watched. Can contain the following
special values:
*ALL All jobs with the specified job name are watched.
MESSAGE_JOB_NUMBER VARCHAR(6) The job number to further qualify the job name and user name. Can
contain the following special value:
*ALL All jobs with the specified job name and user name are
watched.
Contains the null value if a generic job name or a generic user name
qualifier is specified, or if MESSAGE_QUEUE is not *JOBLOG.
MESSAGE_SEVERITY INTEGER The severity code, ranging from 0 through 99, of the message to be
watched.
MESSAGE_RELATIONAL_OPERATOR CHAR(3) The relational operator against which the message severity code is
compared.
*EQ Equal
MESSAGE_COMPARISON_DATA VARCHAR(72) CCSID 65535 The comparison data to be used if a message matching the specified
message is added to the specified message queue or log. If the
message data, the "From program" or the "To program" includes the
specified text, the watched for condition is true.
Contains the null value if no message comparison data was specified.
The following columns apply when DETAIL_TYPE is LICLOG. They will contain the null value when DETAIL_TYPE is MESSAGE or PAL.
LIC_MAJOR_CODE CHAR(4) The LIC log major code to be watched. A hexadecimal digit or a
question mark can be specified for each character in the four-digit code.
A question mark is a wildcard character that will match any digit in that
position. Up to three wildcard characters can be specified. Can contain
the following special value:
*ALL Any LIC log entry major code will be considered to be a match.
LIC_MINOR_CODE CHAR(4) The LIC log minor code to be watched. A hexadecimal digit or a
question mark can be specified for each character in the four-digit code.
A question mark is a wildcard character that will match any digit in that
position. Up to three wildcard characters can be specified. Can contain
the following special value:
*ALL Any LIC log entry minor code will be considered to be a match.
LIC_COMPARISON_DATA VARCHAR(72) CCSID 65535 The comparison data to be used if a log entry matching the specified
major and minor codes is added to the licensed internal code (LIC)
log. If this text is found in the LIC log entry data field specified by
the LIC log compare against field, the watched for condition is true.
This text is case sensitive. If *ALL is specified in the LIC log compare
against field, the LIC log fields which will be compared are TDE number,
task name, server type, job name, user ID, job number, thread ID,
exception ID, LIC module compile binary timestamp, module offset, LIC
module RU name, LIC module name, LIC module entry point name. The
comparison data cannot be used to match across two fields, and can
match an entire field or a substring of any field. The prefix MCH may
be specified to compare only against the exception ID field and avoid
possible substring matches with the other fields.
Contains the null value if no LIC log comparison data was specified.
LIC_COMPARE_AGAINST VARCHAR(10) The part of the LIC log the data specified in LIC_COMPARISON_DATA is
to be compared against.
Contains the null value if no LIC log comparison data was specified.
The following columns apply when DETAIL_TYPE is PAL. They will contain the null value when DETAIL_TYPE is MESSAGE or LICLOG.
PAL_COMPARISON_DATA VARCHAR(10) CCSID 65535 The comparison data to be used if a PAL entry matching the specified
system reference code was created. If the data specified by PAL
compare against field matches the specified text, the watched for
condition is true. This text is case sensitive. Question marks (?) and
asterisk (*) wildcard characters can be specified in the text string. A
question mark is a single-character wildcard character and will match
any character in the same position. For example, '??123' will match
any value that is five characters long and ends with '123'. Multiple
question mark wildcard characters can be specified for the comparison
data value. An asterisk is a multiple-character wildcard character. A
single asterisk wildcard character can be specified at the end of the
comparison data value. For example, 'ABC*' will match any value that
begins with the letters 'ABC'.
Contains the null value if no PAL comparison data was specified.
PAL_COMPARE_AGAINST VARCHAR(9) The part of the PAL the data specified in PAL_COMPARISON_DATA is to
be compared against.
Example
• List all the watches that my user profile started with the STRWCH command including the detailed
information.
SELECT *
FROM QSYS2.WATCH_INFO W, TABLE(QSYS2.WATCH_DETAIL(W.SESSION_ID)) D
WHERE W.WATCH_SESSION_TYPE = '*STRWCH' AND
W.USER_ID = USER;
WATCH_INFO view
The WATCH_INFO view returns information about watch sessions on the system.
The values returned for the columns in the view are closely related to the values returned by the
WRKWCH (Work with Watches) CL command and by the Retrieve Watch List (QSCRWCHL) and Retrieve
Watch Information (QSCRWCHI) API.
Authorization: The caller must have:
• *USE authority to the QSYS/QSCRWCHL and QSYS/QSCRWCHI programs, and
• – *SERVICE special authority, or
– Authorization to the QIBM_SERVICE_WATCH and QIBM_SERVICE_TRACE function usage identifiers.
The following table describes the columns in the view. The system name is WATCH_INFO. The schema is
QSYS2.
ORIGIN ORIGIN VARCHAR(9) The name of the command or the API that started
the watch.
ORIGIN_JOB ORIGIN_JOB VARCHAR(28) The qualified job name that started the watch
session.
START_TIMESTAMP WCH_START TIMESTAMP The timestamp of when the watch was started.
USER_ID USER_ID VARCHAR(10) The name of the user that started the watch
session.
WATCH_SESSION_TYPE WCH_TYPE VARCHAR(7) Identifies the type of watch according to its origin.
JOB_RUN_PRIORITY PRIORITY INTEGER The priority for the job where the watch session
work will be run.
WATCH_PROGRAM_LIBRARY WCH_PGMLIB VARCHAR(10) The name of the library where the watch program
is located.
Nullable
Contains the null value if WATCH_PROGRAM is
null.
WATCH_PROGRAM WCH_PGM VARCHAR(10) The name of the program called to notify that a
specified watch event occurred.
Nullable
Contains the null value if a watch program is not
specified or not found.
WATCH_PROGRAM_CALL_START CALL_START VARCHAR(3) Whether the watch program will be called before
starting watching for any event.
Nullable
NO The watch program will not be called
before starting watching for any event.
WATCH_PROGRAM_CALL_END CALL_END VARCHAR(3) Whether the watch program will be called when
the watch session is ending.
Nullable
NO The watch program will not be called
when the watch session is ending.
TIME_LIMIT TIME_LIMIT INTEGER The time limit, in minutes, for watching for a
message, a LIC log entry, or a PAL entry. A non-
Nullable null value is only returned for watch sessions
started by a trace command.
When the specified amount of time has elapsed,
the program identified by the WATCH_PROGRAM
column is called, the watch is ended, and
message CPI3999 is sent to the history log.
Contains the null value if the watch session was
started by a trace command and did not specify
a time limit or for sessions not started by a trace
command.
TIME_INTERVAL INTERVAL INTEGER The interval of time, in seconds, of how often the
trace exit program is called.
Nullable
Contains the null value if the watch session was
started by a trace command and did not specify
an interval or for sessions not started by a trace
command.
Example
• List all the service monitor watches that are currently active.
SELECT *
FROM QSYS2.WATCH_INFO
WHERE WATCH_SESSION_TYPE = '*SRVMON' AND
STATUS = 'ACTIVE';
MEDIA_LIBRARY_INFO view
The MEDIA_LIBRARY_INFO view returns information that can also be seen through the Work with Media
Library Status (WRKMLBSTS) command interface.
Authorization: None required.
DEVICE_STATUS DEVICE_STS VARCHAR(20) The status of the device. The most common values are:
DEVICE_TYPE DEVICE_TYP VARCHAR(10) The type of device. Contains the special value *RSRCNAME
if the device type is determined by the resource in the
RESOURCE_NAME column.
DEVICE_MODEL DEVICE_MDL VARCHAR(10) The model number of the device. Contains the special value
*RSRCNAME if the device model is determined by the resource
in the RESOURCE_NAME column.
RESOURCE_ALLOCATION ALLOC_PRTY VARCHAR(4) The priority of a job when requesting a resource. 1 is highest
_PRIORITY priority, 99 is lowest. Can contain the following special value:
INITIAL_MOUNT_WAIT_TIME INIT_WAIT VARCHAR(6) The maximum amount of time a request will wait for allocation
of a tape resource for the initial mount. Contains either a
numeric string representing the number of minutes or one of
the following special values:
END_OF_VOLUME_MOUNT_WAIT END_WAIT VARCHAR(6) The maximum amount of time a request will wait for allocation
_TIME of a tape resource for the end of volume mount. Contains either
a numeric string representing the number of minutes or one of
the following special values:
Example
Return information about all media library devices.
SAVE_FILE_LIBRARY SAVF_LIB VARCHAR(10) Name of the library that contains the save file.
OBJECTS_SAVED OBJECTS INTEGER The number of objects saved for the library.
MEMBERS_SAVED MEMBERS INTEGER The number of members saved for the library.
ACCESS_PATHS_SAVED ACC_PATHS INTEGER The number of logical file access paths saved for the
library.
SPOOLED_FILES_SAVED SPLFS INTEGER The number of spooled files saved in the save file.
SAVE_COMMAND SAVE_CMD VARCHAR(9) The save command that was used for the save
operation.
Nullable
QSYS Contents of the save file were
created by the operating system by
using a function other than the CL
commands.
SAVE_TIMESTAMP SAVED TIMESTAMP(0) The date and time when the objects were saved.
DATA_COMPRESSED COMPRESSED VARCHAR(3) Whether the data was saved in compressed format.
SYNCHRONIZATION_ID SYNC_ID VARCHAR(10) The name that was used to synchronize checkpoints
for more than one save while active operation.
Nullable
Contains the null value if the save file is empty,
SAVE_COMMAND is SAV, or if no synchronization
name was used for the save.
EARLIEST_POSSIBLE_RELEASE EARLY_REL CHAR(6) The earliest release level of the operating system on
which the objects can be restored in VxRxMx format.
Nullable
Contains the null value if the save file is empty or
SAVE_COMMAND is SAV.
LIBRARY_NAME LIBRARY VARCHAR(10) The name of the library from which the objects were
saved.
Nullable
Contains the null value if the save file is empty or
SAVE_COMMAND is SAV.
PRIVATE_AUTHORITIES PRIV_AUTHS VARCHAR(3) Whether the save operation specified that private
authorities should be saved with the objects.
Nullable
NO Objects were saved without their private
authorities.
SERIAL_NUMBER SERIAL VARCHAR(8) The serial number of the system on which the save
was performed.
Nullable
Contains the null value if the serial number is not
available or the save file is empty or SAVE_COMMAND
is SAV.
SAVE_FILE_RECORDS SAVF_REC BIGINT The number of records used to contain the saved
information in the save file.
Nullable
Contains the null value if SAVE_COMMAND is SAV.
IASP_NUMBER IASPNUMBER INTEGER The auxiliary storage pool (ASP) of the library when it
was saved.
Nullable
Contains the null value if the save file is empty or
SAVE_COMMAND is SAV.
IASP_NAME IASPNAME VARCHAR(10) The name of the independent auxiliary storage pool
(ASP) device of the library when it was saved. Can
Nullable contain the special value *SYSBAS.
Contains the null value if the save file is empty or
SAVE_COMMAND is SAV.
Example
• Find all the save files in library BACKUP used to save objects from APPLIB.
SAVE_FILE_OBJECTS ( save-file
SAVE_FILE =>
, save-file-library
SAVE_FILE_LIBRARY =>
, object-name-filter
OBJECT_NAME_FILTER =>
, object-type-filter
OBJECT_TYPE_FILTER =>
, detailed-info
DETAILED_INFO =>
)
, ignore-errors
IGNORE_ERRORS =>
object-name- A character or graphic string expression that identifies the object name to be returned.
filter The name can be a generic name.
The string can contain the following special value:
object-type- A character or graphic string expression that contains a system object type for the
filter objects to be returned.
The string can contain the following special value:
If this parameter is not specified, information for all object types is returned.
detailed-info A character or graphic string expression that indicates the type of information to be
returned.
NONE Only information about the object is returned. This is the default.
FILE Additional information is returned for *FILE objects. For every file, one row is
returned for each member.
OUTQ Additional information is returned for *OUTQ objects. For every output queue,
one row is returned for each spooled file.
ALL Additional information is returned for *FILE and *OUTQ objects.
For a file, one row is returned for each member in the file.
For an output queue, one row is returned for each spooled file in the output
queue.
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 115. SAVE_FILE_OBJECTS table function
SAVE_FILE_LIBRARY VARCHAR(10) Name of the library that contains the save file.
LIBRARY_NAME VARCHAR(10) The name of the library from which the object was saved.
OBJECT_NAME VARCHAR(10) The name of the saved object. Contains the system name for a DLO
object.
SAVE_TIMESTAMP TIMESTAMP(0) The date and time at which the object was saved.
OBJECT_SIZE BIGINT The size of the object, in bytes. This value will be a rounded value for an
object larger than 999,999,999 bytes.
DATA_SAVED VARCHAR(3) Whether the data for this object was saved with the object.
NO The data was not saved. The object's storage was freed by a
previous save command before this save operation.
YES The data was saved. The object's storage was not freed by a
previous save command before this save operation.
DLO_NAME VARCHAR(20) The name of the document, folder, or mail object that was saved.
Contains the null value if there is no document library object.
IASP_NUMBER INTEGER The auxiliary storage pool (ASP) of the library when the object was
saved.
IASP_NAME VARCHAR(10) The name of the independent auxiliary storage pool (ASP) device of the
library when the object was saved.
Member information
MEMBER_NAME VARCHAR(10) The name of the file member that was saved.
Contains the null value if DETAILED_INFO is NO or OUTQ or if
OBJECT_TYPE is not *FILE.
SPOOLED_FILE_NUMBER INTEGER The number of the spooled file in the job that owns it.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
QUALIFIED_JOB_NAME VARCHAR(28) The fully-qualified job name that owns the spooled file.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
JOB_NAME VARCHAR(10) The name of the job that owns the spooled file.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
JOB_USER VARCHAR(10) The name of the user who owns the spooled file.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
JOB_NUMBER VARCHAR(6) The number of the job that owns the spooled file.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
SYSTEM_NAME VARCHAR(8) The name of the system where the job that owns the spooled file ran.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
CREATE_TIMESTAMP TIMESTAMP(0) The date and time when the spooled file was created.
Contains the null value if DETAILED_INFO is NO or FILE or if
OBJECT_TYPE is not *OUTQ.
Example
• List all the spooled files saved in the MYLIB/SAVF1 save file.
SAVE_FILE_OBJECTS view
The SAVE_FILE_OBJECTS view returns information about the objects in a save file. Information about
Integrated File System objects is not returned.
The SAVE_FILE_OBJECTS table function can be used to return detailed information about database file
(*FILE) members and output queue (*OUTQ) spooled files that were saved.
The information returned is similar to the detail available through the Display Save File (DSPSAVF) CL
command and the List Save File (QSRLSAVF) API.
Authorization: The caller must have:
• *USE authority to the library containing the save file, and
• *USE authority to the save file.
The following table describes the columns in the view. The system name is SAVF_OBJ. The schema is
QSYS2.
Table 116. SAVE_FILE_OBJECTS view
SAVE_FILE_LIBRARY SAVF_LIB VARCHAR(10) Name of the library that contains the save file.
LIBRARY_NAME LIBNAME VARCHAR(10) The name of the library from which the object was
saved.
OBJECT_NAME NAME VARCHAR(10) The name of the saved object. Contains the system
name for a DLO object.
SAVE_TIMESTAMP SAVED TIMESTAMP(0) The date and time at which the object was saved.
OBJECT_SIZE OBJ_SIZE BIGINT The size of the object, in bytes. This value will be a
rounded value for an object larger than 999,999,999
bytes.
DATA_SAVED DATA VARCHAR(3) Whether the data for this object was saved with the
object.
DLO_NAME DLO_NAME VARCHAR(20) The name of the document, folder, or mail object that
was saved.
Nullable
Contains the null value if there is no document library
object.
FOLDER_PATH FOLDER VARCHAR(63) The name of the folder that was saved.
IASP_NUMBER IASPNUMBER INTEGER The auxiliary storage pool (ASP) of the library when
the object was saved.
IASP_NAME IASP_NAME VARCHAR(10) The name of the independent auxiliary storage pool
(ASP) device of the library when the object was
saved.
Example
• Find all the save files used to save any *FILE objects with names that begin with 'CUST'. Since this can
be a long-running query, submit it as a batch job. The RUNSQL CL command is used to run the SQL
statement and return the results in a table in MYLIB.
SBMJOB CMD(RUNSQL
SQL('CREATE TABLE MYLIB.SAVF_CUST AS (
SELECT SAVE_FILE_LIBRARY, SAVE_FILE, LIBRARY_NAME, OBJECT_NAME, SAVE_TIMESTAMP
FROM QSYS2.SAVE_FILE_OBJECTS
WHERE OBJECT_NAME LIKE ''CUST%'') WITH DATA')
COMMIT(*NONE)) JOB(SAVFLIST)
TAPE_CARTRIDGE_INFO view
The TAPE_CARTRIDGE_INFO view returns information about tape cartridges.
This information is similar to the information available through the Display Tape Cartridge (DSPTAPCTG)
CL command and the Retrieve Cartridge Information (QTARCTGI) API.
Authorization: The caller must have *USE authority to the device description.
The following table describes the columns in the view. If a device cannot be allocated to access its
information, a row containing only the device name is returned. The system name is TAPE_INFO. The
schema is QSYS2.
Table 117. TAPE_CARTRIDGE_INFO view
BAR CODE The cartridge ID was read from the bar code
label on the cartridge.
VOLUME_ID VOLUME_ID VARCHAR(6) The volume identifier for the cartridge that was read from the
tape volume labels. Can contain the following special value:
Nullable
*NL The volume is a non-labeled tape.
MEDIA_TYPE MEDIA_TYPE VARCHAR(2) The media type read from the bar code label on the cartridge.
Nullable Contains the null value if the media type is not available.
CATEGORY_SYSTEM CAT_SYSTEM VARCHAR(8) The name of the system that owns the category assigned to the
cartridge.
Nullable
Contains the null value if the cartridge is assigned to a category
that does not have an owner.
CHANGE_TIMESTAMP CHANGED TIMESTAMP(0) The timestamp when the cartridge was last used for output
operations.
Nullable
Contains the null value if a change timestamp is not available.
REFERENCE_TIMESTAMP REFERENCED TIMESTAMP(0) The timestamp the cartridge was last used for input or output
operations.
Nullable
Contains the null value if the cartridge has not been used.
LOCATION LOCATION VARCHAR(10) The current location of the cartridge. This can be either a slot
number or a tape resource name.
Nullable
Contains the null value if the cartridge is located in a storage slot
but the slot number is not known, or if the cartridge is located in
a tape drive but the drive location is not known.
OWNER_ID OWNER_ID VARCHAR(17) The owner ID specified when the tape was initialized. This
information is read from the tape volume labels. Can contain
Nullable the following special values:
Contains the null value if the cartridge write protect status is not
known.
ENCODING ENCODING VARCHAR(6) The encoding of the tape volume. The encoding of a tape volume
is determined when the Initialize Tape (INZTAP) command is
Nullable used.
Example
Return information about all tape cartridges that do not currently have a status of AVAILABLE.
Communication Services
These services provide communication information.
ACTIVE_DB_CONNECTIONS ( job-name )
JOB_NAME =>
job-name An expression that contains the qualified job name for which connection information is to be
returned. The special value of '*' indicates the current job.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
CONNECTION_USAGE VARCHAR(21) The connection usage of the local server (job-name) side of
the connection.
REMOTE_HOST_NAME VARCHAR(255) The name of the remote system for this connection.
REMOTE_JOB_NAME VARCHAR(28) The qualified job name of the remote job that is connected
to job-name.
Contains the null value if the remote server is not an IBM i.
NRG_NAME VARCHAR(15) The Network Redundancy Group (NRG) used for this
connection.
Contains the null value if CONNECTION_TYPE is not DB2
MIRROR.
SNA_DEVICE_NAME VARCHAR(10) The name of the device used to communicate with the
remote location.
Contains the null value if CONNECTION_TYPE is not SNA.
SNA_LOCAL_LOCATION_NAME VARCHAR(8) Indicates the local location name by which this system is
identified to the system on which the RDB is located.
Contains the null value if CONNECTION_TYPE is not SNA.
SNA_REMOTE_LOCATION_NAME VARCHAR(8) The name of the remote location where the remote file
exists.
Contains the null value if CONNECTION_TYPE is not SNA.
ACTIVATION_GROUP_NUMBER BIGINT Activation group number for job making the connection.
Contains the null value if CONNECTION_USAGE is
APPLICATION SERVER.
ACTIVATION_GROUP_NAME VARCHAR(10) Activation group name for job making the connection.
Contains the null value if the activation group has no name
or if CONNECTION_USAGE is APPLICATION SERVER.
COMMIT_PROTOCOL VARCHAR(9) The commitment control protocol used for this connection.
Example
• List all the connections that are active for a specific job.
ADD_TIME_SERVER procedure
The ADD_TIME_SERVER procedure adds a Network Time Protocol (NTP) server to the NTP configuration
list.
The ADD_TIME_SERVER procedure requires 5770SS1 Option 33 - Portable Application Solutions
Environment (PASE).
Authorization: The caller must have:
• *IOSYSCFG special authority, and
• *RW authority to /QIBM/UserData/OS400/TCPIP/NTP/ntp.conf
ADD_TIME_SERVER ( time-server
TIME_SERVER =>
, preferred-indicator )
PREFERRED_INDICATOR =>
time-server A character or graphic string that identifies the DNS name of the NTP server to be
added to the configuration.
preferred- A character or graphic string that indicates whether this NTP server should be
indicator considered a preferred time server.
Example
CHANGE_OBJECTCONNECT procedure
The CHANGE_OBJECTCONNECT procedure changes, starts, or stops the ObjectConnect over IP server.
The procedure is similar to the Change ObjectConnect Attrs (CHGOBJCA) CL command.
If the subsystem description parameter is changed while the ObjectConnect over IP server is running, the
change takes effect the next time the server is restarted.
This procedure requires that Option 22 of the IBM i operating system is installed.
Authorization: The caller must have *IOSYSCFG special authority.
The caller must have *USE authority to the QSYS/STRTCPSVR command when changing STATE to 'START'.
The caller must have *USE authority to the QSYS/ENDTCPSVR command when changing STATE to 'END'.
The caller must have additional authority when changing SUBSYSTEM_DESCRIPTION_LIBRARY or
SUBSYSTEM_DESCRIPTION.
• The caller must have *READ, *ADD, and *EXECUTE authorities to the library containing the subsystem
description.
• If the subsystem description does not exist, the caller must have *USE authority to the QSYS/CRTSBSD
CL command.
• If the subsystem description exists, the caller must have *READ, *OBJMGT and *OBJOPR authorities to
the subsystem description.
• If the job queue referenced by the subsystem description exists, the caller must have *READ, *OBJMGT
and *OBJOPR authorities to the job queue.
If the subsystem description and job queue exist, the QOBJC user profile will be granted *USE authority to
these objects.
, auto-start
AUTO_START =>
, minimum-jobs
MINIMUM_JOBS =>
, maximum-jobs
MAXIMUM_JOBS =>
, inactive-time
INACTIVE_TIME =>
, send-buffer
SEND_BUFFER =>
, receive-buffer
RECEIVE_BUFFER =>
, subsystem-description-library
SUBSYSTEM_DESCRIPTION_LIBRARY =>
, subsystem-description
SUBSYSTEM_DESCRIPTION =>
)
, authentication-type
AUTHENTICATION_TYPE =>
state A character or graphic string that indicates how to change the state of the
ObjectConnect over IP server. If this parameter is omitted, the state of the
ObjectConnect over IP server does not change.
auto-start A character or graphic string that indicates how to start the ObjectConnect over IP
server. If this parameter is omitted, the auto start setting does not change. The initial
configuration default value is YES.
minimum-jobs An integer value that specifies the minimum number of server jobs that are started
by the ObjectConnect receiver job to accept client connections. If this parameter
is omitted, the minimum number of server jobs does not change. The initial
configuration default value is 1 and the maximum value is 999.
maximum-jobs An integer value that specifies the maximum number of server jobs that are started
by the ObjectConnect receiver job to accept client connections. If this parameter
is omitted, the maximum number of server jobs does not change. The initial
configuration default value is 5 and the maximum value is 32767.
inactive-time An integer value that specifies the length of time in minutes a server job will stay
inactive before ending. If this parameter is omitted, the server inactive time does not
change. The initial configuration default value is 30 and the maximum value is 1440.
send-buffer An integer value that specifies the size of the TCP send buffer, in bytes, that the
data connection will use to send data over the network. If this parameter is omitted,
the TCP send buffer size does not change. The initial configuration default value is
262144, the minimum value is 512 and maximum value is 8388608.
receive-buffer An integer value that specifies the size of the TCP receive buffer, in bytes, that
the data connection will use to receive data from the network. If this parameter is
omitted, the TCP receive buffer size does not change. The initial configuration default
value is 8388608, the minimum value is 512 and maximum value is 8388608.
subsystem- A character or graphic string that contains the library name where subsystem-
description- description resides. The library can be QSYS for IBM shipped subsystem QUSRWRK
library or any user library. The library must exist. If this parameter is omitted, the subsystem
library does not change.
subsystem- A character or graphic string that indicates the subsystem where the ObjectConnect
description server will run in. The subsystem can be IBM shipped subsystem QSYS/QUSRWRK or
a user-provided subsystem description. When the subsystem-description parameter
is provided, the subsystem-description-library parameter must also be provided.
If the user-provided subsystem description exists, the QOBJC user profile will be
granted *USE authority to the object. If the subsystem description does not exist,
it will be created along with a job queue having same name. If this parameter is
omitted, the subsystem does not change. The initial configuration default value is
QSYS/QUSRWRK.
authentication- A character or graphic string that indicates which authentication type can be used
type by the ObjectConnect over IP server to authenticate the incoming ObjectConnect
connection request. If this parameter is omitted, the authentication type does not
change. The initial configuration default value is ANY.
ANY The ObjectConnect over IP server can use any of the supported
authentication types to authenticate an incoming ObjectConnect
connection request.
KERBEROS The ObjectConnect over IP server can use Kerberos to authenticate
an incoming ObjectConnect connection request.
PASSWORD The ObjectConnect over IP server can use the user profile and
password to authenticate an incoming ObjectConnect connection
request.
Example
• Start the ObjectConnect over IP server.
DNS_LOOKUP ( search-name
SEARCH_NAME =>
)
, domain-server
DOMAIN_SERVER =>
search-name A character string containing the fully qualified domain name of the host to be resolved.
domain-server A character string containing either a host name or an IP address for the domain name
server, or an IP address string for it.
If this parameter is omitted, the IPv4 or IPv6 configured name servers from
CHGTCPDMN are used.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 119. DNS_LOOKUP table function
IPV4 The address is specified using the IPv4 address space type.
IPV6 The address is specified using the IPv6 address space type.
AUTHORITATIVE VARCHAR(3) Indicates whether the DNS response containing the IP address was an
authoritative answer.
Example
• Determine the IP address for the ibm.com® hostname.
DNS_LOOKUP_IP ( ip-address )
IP_ADDRESS =>
ip-address A character string containing the IP address to be resolved to a hostname. The IP address
can be in either IPv4 or IPv6 format.
The result of the function is a varying length character string that contains the corresponding hostname. If
a hostname cannot be determined, the null value is returned.
Example
• Determine the hostname for IP address 129.42.38.10. The result is ibm.com.
VALUES QSYS2.DNS_LOOKUP_IP('129.42.38.10');
ENV_SYS_INFO view
The ENV_SYS_INFO view contains information about the current server.
Authorization: None required.
The following table describes the columns in the view. The system name is ENVSYSINFO. The schema is
SYSIBMADM.
Table 120. ENV_SYS_INFO view
Nullable
Nullable
Nullable
TOTAL_CPUS TOTAL_CPUS INTEGER The maximum number of virtual processors defined within the
LPAR configuration.
Nullable
CONFIGURED_CPUS CONFIGCPUS INTEGER The number of virtual processors currently available to the
partition.
Nullable
Nullable
Example
HTTP_SERVER_INFO view
The HTTP_SERVER_INFO view returns information for HTTP Server for IBM i (powered by Apache). Only
information for enabled and active functions is returned.
The values returned for the result columns of the table function are similar to the values shown by Real
Time Server Statistics in the IBM Web Administration for i GUI.
Authorization: None required.
The following table describes the columns in the view. The system name is HTTP_SRVR. The schema is
QSYS2.
Table 121. HTTP_SERVER_INFO view
SERVER_TOTAL_REQUESTS TOT_REQ BIGINT Total number of requests to the server since the
server was started.
SERVER_TOTAL_RESPONSES TOT_RESP BIGINT Total number of responses from the server since
the server was started.
HTTP_FUNCTION HTTP_FUNC VARCHAR(20) HTTP server function or associated server for the
remaining statistical information columns. A row
is only returned for a function if the function is
enabled.
PROXY Proxy
NONCACHE_RESPONSES NC_RESP BIGINT Number of responses that did not come from
cache.
BYTES_RECEIVED BYTES_RCV BIGINT Total number of bytes received for all requests.
BYTES_SENT BYTES_SENT BIGINT Total number of bytes sent for all requests.
Example
• Examine information about the server functions associated with the ADMIN server.
NETSTAT_INFO view
The NETSTAT_INFO view returns information about IPv4 and IPv6 network connections.
The values returned for the columns in the view are closely related to the values returned by List
Network Connections API and Retrieve Network Connection Data API. Refer to the APIs for more detailed
information.
Authorization: None required.
The following table describes the columns in the view. The system name is NS_INFO. The schema is
QSYS2.
REMOTE_PORT RMT_PORT INTEGER The remote host port number. A value of 0 means that the
connection is a listening or UDP socket, so this field does not
apply.
REMOTE_PORT_NAME RMT_NAME VARGRAPHIC(14) The remote host well-known port name or the name from the
CCSID 1200 service table entry.
LOCAL_ADDRESS LOCAL_ADDR VARCHAR(45) The local address of this connection on this system.
For IPv4:
• The address is in IPv4 address format. A value of 0.0.0.0
indicates that either the system is waiting for a connection to
open or that a UDP socket is being used.
For IPv6:
• The address is in IPv6 address format. A value of :: means the
local application specified that any local internet address can
be used.
LOCAL_PORT_NAME LOCAL_NAME VARGRAPHIC(14) The local system well-known port name or the name from the
CCSID 1200 service table entry.
IDLE_TIME IDLE_TIME DECIMAL(19,3) The length of time, in seconds, since the last activity on this
connection.
BIND_USER BIND_USER VARCHAR(10) The user profile of the job on the local system which first
performed a sockets API bind() of the socket.
BYTES_SENT_REMOTELY BYTES_OUT BIGINT The number of bytes sent to the remote host.
BYTES_RECEIVED_LOCALLY BYTES_IN BIGINT The number of bytes received from the remote host.
NUMBER_OF_ASSOCIATED_JOBS NUM_JOBS INTEGER The number of jobs associated with this connection.
LINE_DESCRIPTION LINE_DES VARCHAR(10) The local system line description associated with this connection.
VIRTUAL_LAN_ID LAN_ID VARCHAR(4) The virtual LAN identifier associated with this connection. Can
also contain the following special value:
Nullable
NONE No virtual LAN identifier is associated with this
connection.
CONNECTION_TRANSPORT_ CNNTRANSPT VARCHAR(5) The transport that a connection is using. Values are:
LAYER • IPS
• TCPIP
IP_OPTIONS IP_OPTIONS BINARY(40) The hex value of IP datagram options that may have been
specified for a connection.
Nullable
Contains null if this is an IPv6 connection or if no IP datagram
options have been specified.
ROUND_TRIP_TIME ROUND_TRIP BIGINT The smoothed round-trip time interval in milliseconds. This is a
measure of the time required for a segment on the connection
Nullable to arrive at its destination, to be processed, and to return an
acknowledgment to the client.
Contains null if PROTOCOL is UDP.
ROUND_TRIP_VARIANCE ROUND_VAR BIGINT The variance in milliseconds from the previous round-trip time.
CURRENT_RETRANSMISSIONS CT_RETRANS BIGINT The number of times the local system retransmitted the current
segment without receiving an acknowledgment.
Nullable
Contains null if PROTOCOL is UDP.
TOTAL_RETRANSMISSIONS TL_RETRANS BIGINT The total number of times the local system retransmitted a
segment because an acknowledgement was not received. This is
Nullable a cumulative count of all segments resent during the entire time
the connection has been active.
Contains null if PROTOCOL is UDP.
TCP_CONNECTIONS_ TCPCONN BIGINT The number of TCP connections for which the current state is
CURRENTLY_ESTABLISHED either ESTABLISHED or CLOSE-WAIT.
Nullable
Contains null if PROTOCOL is UDP.
TCP_ACTIVE_OPENS TCPACTOPN BIGINT The number of times TCP connections have made a direct
transition to the SYN-SENT state from the CLOSED state. This
Nullable number is an indication of the number of times this local system
opened a connection to a remote system.
Contains null if PROTOCOL is UDP.
TCP_PASSIVE_OPENS TCPPSVOPN BIGINT The number of times TCP connections have made a direct
transition to the SYN-RECEIVED state from the LISTEN state. This
Nullable number is an indication of the number of times a remote system
opened a connection to this system.
Contains null if PROTOCOL is UDP.
TCP_FAILED_OPENS TCPFAILOPN BIGINT The total number of times TCP connections have made direct
transitions to a CLOSED state from either the SYN-SENT state or
Nullable the SYN-RECEIVED state and/or to LISTEN from SYN-RECEIVED.
Contains null if PROTOCOL is UDP.
TCP_ESTABLISHED_AND_THEN_ TCPESTRST BIGINT The number of times TCP connections have made a direct
RESET transition to the CLOSED state from either the ESTABLISHED
Nullable state or the CLOSE-WAIT state.
Contains null if PROTOCOL is UDP.
TCP_SEGMENTS_SENT TCPSEGSENT BIGINT The total number of segments sent, including those on current
connections but excluding those containing only retransmitted
Nullable octets.
Contains null if PROTOCOL is UDP.
TCP_SEGMENTS_ TCPSEGRTRN BIGINT The number of TCP segments transmitted containing one or more
RETRANSMITTED previously transmitted octets.
Nullable
Contains null if PROTOCOL is UDP.
TCP_SEGMENTS_RESET TCPSEGRST BIGINT The number of TCP segments sent containing the RST flag.
TCP_SEGMENTS_RECEIVED TCPSEGRCV BIGINT The total number of segments received, including those received
in error. This count includes segments received on currently
Nullable established connections.
Contains null if PROTOCOL is UDP.
TCP_SEGMENTS_RECEIVED_ TCPSEGRCVE BIGINT The total number of segments received in error (for example, bad
ERROR TCP checksums).
Nullable
Contains null if PROTOCOL is UDP.
OUTGOING_BYTES_BUFFERED BYTES_OUTB BIGINT The current number of bytes that an application has requested to
send, but TCP has not yet sent. If TCP has sent the bytes to the
Nullable remote system but has not yet received an acknowledgment, the
bytes are considered 'not sent'. They are included in this count.
Contains null if PROTOCOL is UDP.
USER_SEND_NEXT USRSNDNXT BIGINT The sequence number of the next byte of data to be sent by the
client application.
Nullable
Contains null if PROTOCOL is UDP.
SEND_NEXT SEND_NEXT BIGINT The sequence number of the next byte of data that the local TCP
application sends to the remote TCP application.
Nullable
Contains null if PROTOCOL is UDP.
SEND_UNACKNOWLEDGED SNDUNACK BIGINT The sequence number of the last segment sent that was not
acknowledged. This is the smallest sequence number of the send
Nullable window.
Contains null if PROTOCOL is UDP.
OUTGOING_PUSH_NUMBER OUTPSHNBR BIGINT The sequence number of the last byte of push data in the
outgoing stream. This value is zero if no push data is in the
Nullable outgoing data stream.
Contains null if PROTOCOL is UDP.
OUTGOING_URGENCY_NUMBER OUTURGNBR BIGINT The sequence number of the last byte of urgent data in the
outgoing data stream. This value is zero if no urgent data is in
Nullable the outgoing data stream.
Contains null if PROTOCOL is UDP.
OUTGOING_WINDOW_NUMBER OUTWINNBR BIGINT The largest sequence number in the send window of the
connection. The local TCP application cannot send data bytes
Nullable with sequence numbers greater than the outgoing window
number.
Contains null if PROTOCOL is UDP.
INCOMING_BYTES_BUFFERED BYTES_INB BIGINT The current number of bytes that are received and buffered by
TCP. These bytes are available to be read by an application.
Nullable
Contains null if PROTOCOL is UDP.
RECEIVE_NEXT RCVNEXT BIGINT The next sequence number the local TCP is expecting to receive.
USER_RECEIVE_NEXT USRRCVNXT BIGINT The sequence number of the next byte to be passed to the
application by TCP.
Nullable
Contains null if PROTOCOL is UDP.
INCOMING_PUSH_NUMBER INPSHNBR BIGINT The sequence number of the last byte of pushed data in the
incoming data stream. This value is zero if no push data is in the
Nullable incoming data stream.
Contains null if PROTOCOL is UDP.
INCOMING_URGENCY_NUMBER INURGNBR BIGINT The sequence number of the last byte of urgent data in the
incoming data stream. This value is zero if no urgent data is in
Nullable the incoming data stream.
Contains null if PROTOCOL is UDP.
INCOMING_WINDOW_NUMBER INWINNBR BIGINT The largest sequence number in the incoming window of this
connection. Data bytes in the incoming stream having sequence
Nullable numbers larger than this number are not accepted.
Contains null if PROTOCOL is UDP.
MAXIMUM_WINDOW_SIZE MAXWINSIZ BIGINT The largest size of the send window, in bytes, during the entire
time the connection has been active.
Nullable
Contains null if PROTOCOL is UDP.
LAST_UPDATE LSTUPD BIGINT The sequence number of the incoming segment used for the last
window update that occurred on the connection.
Nullable
Contains null if PROTOCOL is UDP.
LAST_UPDATE_ACKNOWLEDGED LSTUPDACK BIGINT The acknowledgment number of the incoming segment used for
the last window update that occurred on the connection.
Nullable
Contains null if PROTOCOL is UDP.
CONGESTION_WINDOW CONGESTWIN BIGINT The number of segments that are sent on the next transmission.
If an acknowledgment is received, the number is increased. If
Nullable an acknowledgment is not received, the number is reset to the
smallest allowable number.
Contains null if PROTOCOL is UDP.
MAXIMUM_SEGMENT_SIZE MAXSEGSIZ BIGINT The size in bytes of the largest segment that may be transmitted
on this connection.
Nullable
Contains null if PROTOCOL is UDP.
INITIAL_SEND_SEQUENCE_ SNDSEQNBR BIGINT The first sequence number sent on this connection.
NUMBER Nullable Contains null if PROTOCOL is UDP.
INITIAL_RECEIVE_SEQUENCE_ RCVSEQNBR BIGINT The first sequence number received on this connection.
NUMBER Nullable Contains null if PROTOCOL is UDP.
UDP_DATAGRAMS_SENT UDPSENT BIGINT The total number of UDP datagrams sent from all connections
since TCP/IP was started.
Nullable
Contains null if PROTOCOL is TCP.
UDP_DATAGRAMS_RECEIVED UDPRCV BIGINT The total number of UDP datagrams received, including those
received in error. This count includes datagrams received on
Nullable currently established connections.
Contains null if PROTOCOL is TCP.
UDP_DATAGRAMS_NOT_ UDPNDPNF BIGINT The total number of received UDP datagrams for UDP users for
DELIVERED_PORT_ which there was no application at the destination port.
Nullable
NOT_FOUND Contains null if PROTOCOL is TCP.
UDP_DATAGRAMS_NOT_ UDPNDOTHER BIGINT The number of received UDP datagrams that could not be
DELIVERED_OTHER delivered for reasons other than the lack of an application at the
Nullable destination port.
Contains null if PROTOCOL is TCP.
SOCKET_STATE SOCSTATE VARCHAR(13) The current state of the socket. Values are:
• BOUND
• CONNECTED
• CONNECTING
• DISCONNECTED
• ERROR
• LISTENING
• UNBOUND
• UNINITIALIZED
SOCKET_BROADCAST SOCBROAD VARCHAR(3) Indicates if messages can be sent to the broadcast address.
SOCKET_BYPASS_ROUTE SOCBYPASS VARCHAR(3) Indicates if the normal routing mechanism is being bypassed.
SOCKET_ERROR SOCERROR INTEGER Indicates if there any pending errors in the socket. A value of zero
indicates no pending errors. Otherwise, the value indicates the
Nullable error number.
Contains null if value is not specified.
SOCKET_LINGER SOCLINGER VARCHAR(3) Indicates whether the system attempts to deliver any buffered
data or if the system discards it when a close() is issued.
Nullable
NO The system attempts to send buffered data with an
infinite wait time.
SOCKET_LINGER_TIME SOCLTIME BIGINT The time, in seconds, the system will wait to send buffered data.
SOCKET_OUT_OF_BAND_DATA SOCOUTBAND VARCHAR(3) Indicates if out-of-band data is received inline with normal data.
SOCKET_RECEIVE_LOW_WATER_ SOCRCVSZ BIGINT The size of the receive low-water mark. The default size is 1.
MARK_SIZE Nullable Contains null if value is not specified or if socket is not type
SOCK_STREAM.
SOCKET_REUSE_ADDRESS SOCREUSE VARCHAR(3) Indicates if the local socket address can be reused.
Example
Return information about all network connections for user QLWISVR.
Related information
Internet Protocol version 6
NETSTAT_INTERFACE_INFO view
The NETSTAT_INTERFACE_INFO view returns information about IPv4 and IPv6 interfaces.
The values returned for the columns in the view are closely related to the values returned by List Network
Interfaces API. Refer to the API for more detailed information.
Authorization: None required.
The following table describes the columns in the view. The system name is NS_INTER. The schema is
QSYS2.
For IPv6:
• The address is in IPv6 address format.
Can contain the special value:
NETWORK_ADDRESS NET_ADDR VARCHAR(45) The internet address of the IP network or subnetwork to which the
interface is attached.
For IPv4:
• The address is in IPv4 address format.
For IPv6:
• The address is in IPv6 address format.
SUBNET_MASK SUBNET_MSK VARCHAR(15) The subnet mask for the network, subnet, and host address
fields of the internet address that defines the subnetwork for an
Nullable interface.
Contains null if this is an IPv6 connection.
PREFIX_LENGTH PRE_LEN INTEGER The prefix length defines how many bits of the IPv6 internet
address are in the prefix. It specifies how many of the left-most
Nullable bits of the address make up the prefix. The prefix length is used to
generate network and host addresses.
Contains null if this is an IPv4 connection.
LINE_DESCRIPTION LINE_DES VARCHAR(10) The name of the communications line description that identifies
the physical network associated with an interface. Can contain the
following special values:
INTERFACE_LINE_TYPE LINE_TYPE VARCHAR(6) The type of line used by the interface. Only supported line types
are listed here; obsolete values could be returned for inactive
configurations.
NONE Line is not defined. This value is used for the following
interfaces: *LOOPBACK, *VIRTUALIP, *OPC. There is
no line type value for this interface.
INTERFACE_SOURCE SOURCE VARCHAR(9) Specifies how this interface was added to the protocol stack.
SERVICE_TYPE SRVC_TYPE VARCHAR(9) The type of service that defines how the internet hosts and routers
should make trade-offs between throughput, delay, reliability, and
Nullable cost.
VIRTUAL_LAN_ID LAN_ID VARCHAR(4) The virtual LAN to which this interface belongs according to IEEE
standard 802.1Q. Can also contain the following special value:
MAXIMUM_TRANSMISSION_ MTU VARCHAR(10) The maximum transmission unit (MTU) value specified for this
UNIT interface. Either an integer value or this special value:
LIND The interface is not currently active and the MTU was
specified as *LIND.
CONFIGURED_MAXIMUM_ CFG_MTU VARCHAR(10) The configured maximum transmission unit value specified for this
TRANSMISSION_UNIT interface. Either an integer value or this special value:
LIND The interface is not currently active and the MTU was
specified as *LIND.
AUTOSTART AUTOSTART VARCHAR(3) Specifies whether the interface is automatically started when the
protocol stack is activated.
DAD_MAX_TRANSMITS DAD_MAX BIGINT The maximum number of duplicate address detection (DAD)
transmissions the protocol stack will send out on this interface.
Nullable
Contains null if this is an IPv4 connection.
DIRECTED_BROADCAST_ DIRBRDADR VARCHAR(15) The Internet address, in dotted decimal notation, used to
ADDRESS broadcast to all systems attached to the same network or
Nullable subnetwork as this interface.
Contains null if this is an IPv6 connection or if interface is attached
to a network that does not support a broadcast operation.
ASSOCIATED_LOCAL_ ASCLCLINT VARCHAR(15) The Internet address, in dotted decimal notation, of the local
INTERFACE interface that has been associated with this interface.
Nullable
Contains null if this is an IPv6 connection or if no association has
been made between this interface and another local interface.
CHANGE_STATUS CHGSTS VARCHAR(6) The status of the most recent change to this interface in the
dynamic tables used by the TCP/IP protocol stack.
Nullable
ADD Add interface request processed.
PACKET_RULES PKT_RULES VARCHAR(17) The kind of packet rules data available for this line.
NETWORK_FULL_NAME NET_FNAME VARCHAR(24) The complete name of the network that this interface is a part of.
ALIAS_NAME ALIAS_NAME VARGRAPHIC(50) Name given to the interface to use as an alternate to the IP
CCSID 1200 address.
DHCP_CREATED DHCPCRT VARCHAR(3) Specifies whether this interface was created using Dynamic Host
Configuration Protocol (DHCP).
Nullable
NO This interface was not created using DHCP.
DHCP_DYNAMIC_DNS_ DHCPDYNDNS VARCHAR(3) Specifies whether dynamic updates to Domain Name System
UPDATES (DNS) tables are enabled or not.
Nullable
NO DNS updates are disabled.
DHCP_LEASE_EXPIRATION DHCPLEXP TIMESTAMP(0) The timestamp when the DHCP lease will expire.
DHCP_LEASE_OBTAINED DHCPLOBT TIMESTAMP(0) The timestamp when the DHCP lease was obtained or renewed.
DHCP_USE_UNIQUE_ID DHCPUSEUID VARCHAR(3) Whether the DHCP unique identifier (DUID) is used as the client
identification for the Dynamic Host Configuration Protocol (DHCP).
Nullable
NO The hardware (MAC) address is used for the client ID.
YES The DHCP unique identifier is used for the client ID or this
is an IPv6 connection.
DHCP_SERVER_UNIQUE_ID DHCPSRVUID VARCHAR(30) Specifies the DHCP unique identifier (DUID) of the DHCP server
from which the IP address was obtained.
Nullable
Contains null if this is an IPv4 connection or if interface was not
created by DHCP.
DHCP_SERVER_ADDRESS DHCPSRVADD VARCHAR(15) The Internet address, in dotted decimal notation, of the DHCP
server from which the DHCP lease was obtained or renewed.
Nullable
Contains null if this is an IPv6 connection or if interface was not
created by DHCP.
PREFERRED_INTERFACE_ PREFDFTRTE VARCHAR(3) This field describes whether the preferred proxy interfaces are
DEFAULT_ROUTE based on the system's default route.
Nullable
NO The default route is not used to determine the preferred
interface.
PREFERRED_PHYSICAL_LINE_ PREFLINLST VARCHAR(159) A list of up to 10 preferred physical line list entries. Each entry in
LIST the list is formatted as LINE_DESCRIPTION:VIRTUAL_LAN_ID.
Nullable The line description can be up to 10 characters long. The virtual
LAN ID can be up to 4 characters long. When there is more than
one preferred physical line, a single blank separates entries.
Contains null if this is an IPv4 connection.
ADDRESS_TYPE ADDR_TYPE VARCHAR(9) The type of IPv6 address that is assigned to this network interface.
ADDRESS_CLASS ADDR_CLASS VARCHAR(9) The class of IPv6 address that is assigned to this network
interface.
Nullable
PUBLIC The interface is a public one.
ADDRESS_PREFERRED_LIFETIME ADDPLIFE BIGINT The length of time that a "valid" address is preferred, in seconds. A
negative value indicates that the address preferred lifetime expired
Nullable that number of seconds ago.
Contains null if this is an IPv4 connection or if this address has an
infinite preferred lifetime.
ADDRESS_VALID_LIFETIME ADDVLIFE BIGINT The length of time, in seconds, that an address remains in a "valid"
state. A negative value indicates that the address valid lifetime
Nullable expired that number of seconds ago.
Contains null if this is an IPv4 connection or if this address has an
infinite valid lifetime.
ADDRESS_PREFERRED_ ADDPFRLE TIMESTAMP(0) The timestamp when this address will no longer be in the preferred
LIFETIME_EXPIRATION state. If the timestamp is in the future, the address is still
Nullable preferred. If the timestamp is in the past, then this address is no
longer preferred.
Contains null if this is an IPv4 connection or if this address has an
infinite preferred lifetime which never expires.
ADDRESS_VALID_LIFETIME_ ADDVLDLE TIMESTAMP(0) The timestamp when this address will expire or did expire. If the
EXPIRATION timestamp is in the future, the address has not expired yet. If the
Nullable timestamp is in the past, then this address has expired and is
still being returned for a short period of time to indicate that the
interface ceased to function because its valid lifetime expired.
Contains null if this is an IPv4 connection or if this address has an
infinite valid lifetime which never expires.
ON_LINK ON_LINK VARCHAR(3) Whether or not this interface and all IPv6 addresses with the same
prefix are on the same link.
Nullable
NO Addresses with the same prefix are not assumed to be on
the same link.
PROXY_ARP_ENABLED PRXARPENB VARCHAR(3) Indicates whether Proxy ARP is currently active for this interface.
PROXY_ARP_ALLOWED PRXARPALW VARCHAR(3) Indicates whether Proxy ARP has been configured to be allowed or
not allowed.
Nullable
NO Proxy ARP not allowed.
CURRENT_PROXY_AGENT_LINE PRXAGT VARCHAR(10) Name of the communication line description that is used with
the IPv6 interface for virtual IP address (VIPA) proxy Neighbor
Nullable Discovery.
Contains null if this is an IPv4 connection or if no association has
been made between this interface and another physical interface.
CURRENT_PROXY_AGENT_ PRXAGTLAN VARCHAR(4) The virtual LAN to which the proxy agent line belongs according
LINE_VIRTUAL_LAN_ID to IEEE standard 802.1Q. Can also contain the following special
Nullable value:
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP(0) The timestamp of the most recent change to this interface in the
dynamic tables used by the protocol stack.
Nullable
Contains null if the interface has never been changed.
Example
Return information about all interfaces which are using Virtual Ethernet protocol..
Related information
Internet Protocol version 6
NETSTAT_JOB_INFO view
The NETSTAT_JOB_INFO view returns information about jobs using IPv4 and IPv6 network connections.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
Network Connection Data (QtocRtvNetCnnDta) API.
Authorization: None required.
The following table describes the columns in the view. The system name is NS_JOB. The schema is
QSYS2.
Table 124. NETSTAT_JOB_INFO view
REMOTE_PORT RMT_PORT INTEGER The remote host port number. A value of 0 means that the
connection is a listening or UDP socket, so this field does not
apply.
REMOTE_PORT_NAME RMT_NAME VARGRAPHIC(14) The remote host well-known port name or the name from the
CCSID 1200 service table entry.
LOCAL_ADDRESS LOCAL_ADDR VARCHAR(45) The local address of this connection on this system.
For IPv4:
• The address is in IPv4 address format. A value of 0.0.0.0
indicates that either the system is waiting for a connection to
open or that a UDP socket is being used.
For IPv6:
• The address is in IPv6 address format. A value of :: means the
local application specified that any local internet address can
be used.
LOCAL_PORT_NAME LOCAL_NAME VARGRAPHIC(14) The local system well-known port name or the name from the
CCSID 1200 service table entry.
AUTHORIZATION_NAME USER_NAME VARCHAR(10) The effective user profile of the thread for which information is
being retrieved. This name may differ from the user portion of
Nullable the job name.
Contains null when SLIC_TASK_NAME is not null or if JOB_NAME
is the special value *SIGNON.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name. Can also contain the following special
value:
Nullable
*SIGNON This connection is a telnet connection and the
system is performing sign-on processing or is
displaying a sign-on prompt on it.
JOB_USER JOB_USER VARCHAR(10) The user profile that started the job.
INTERNAL_JOB_ID JOB_ID BINARY(16) A value that can be used by system APIs to speed the process of
locating the job on the system.
Nullable
Contains null if JOB_NAME is the special value *SIGNON or if
SLIC_TASK_NAME is not null.
Example
Return information about all jobs using IPv4 network connections.
Related information
Internet Protocol version 6
NETSTAT_ROUTE_INFO view
The NETSTAT_ROUTE_INFO view returns information about IPv4 and IPv6 routes.
The values returned for the columns in the view are closely related to the values returned by List Network
Routes API. Refer to the API for more detailed information.
Authorization: None required.
The following table describes the columns in the view. The system name is NS_ROUTE. The schema is
QSYS2.
Table 125. NETSTAT_ROUTE_INFO view
ROUTE_DESTINATION ROUTE_DEST VARCHAR(45) The Internet Protocol address of the ultimate destination reached
by this route.
For IPv4:
• The address is in IPv4 address format. When used in
combination with the subnet mask and the type of service
values, the route destination identifies a route to a network or
system. A value of 0.0.0.0 means that the route destination is
the default route.
For IPv6:
• The address is in IPv6 address format. When used in
combination with the prefix length, the route destination
identifies a route to a network or host.
SUBNET_MASK SUBNET_MSK VARCHAR(15) The actual value of the subnet mask for the route destination in
dotted-decimal notation. A value of 0.0.0.0 means no value is
Nullable defined.
Contains null if this is an IPv6 connection.
NEXT_HOP NEXT_HOP VARCHAR(45) The internet address of the first system on the path from your
system to the route destination.
For IPv4:
• The address is in IPv4 address format.
For IPv6:
• The address is in IPv6 address format.
Can contain the following special value:
PREFIX_LENGTH PRE_LEN INTEGER The prefix length defines how many bits of the route destination
IPv6 address are in the prefix. It specifies how many of the left-
Nullable most bits of the address make up the prefix. The prefix length is
used to generate network and host addresses.
Contains null if this is an IPv4 connection.
For IPv4:
For IPv6:
INACTIVE This route is not in the route search path and is not
being used.
ROUTE_MAXIMUM_ ROUTE_MTU VARCHAR(10) The maximum transmission unit (MTU) value for this route in
TRANSMISSION_UNIT bytes. Can be either a number or one of the following special
values:
For IPv4:
IFC The route is not currently active and the MTU was
specified as *IFC.
For IPv6:
ROUTE_SOURCE ROUTE_SRC VARCHAR(18) Specifies how this route was added to the routing table.
For IPv6:
SERVICE_TYPE SRVC_TYPE VARCHAR(9) The type of service that defines how the internet hosts and
routers should make trade-offs between throughput, delay,
Nullable reliability, and cost.
ROUTE_PROTOCOL ROUTE_PTCL VARCHAR(7) Specifies the protocol that was used to generate this route.
ROUTE_PREFERENCE ROUTE_PREF VARCHAR(6) The preference of this route during route selection.
LOCAL_BINDING_TYPE LOCALTYPE VARCHAR(7) The type of line to which this route is bound.
Nullable • DYNAMIC
• STATIC
Contains null if this is an IPv6 connection.
LOCAL_BINDING_NETWORK_ LOCALADDR VARCHAR(15) The Internet address, in dotted decimal notation, of the IP
ADDRESS network or subnetwork that the interface is attached to.
Nullable
Contains null if this is an IPv6 connection.
LOCAL_BINDING_SUBNET_MASK LOCALMASK VARCHAR(15) The subnet mask for the network, subnet, and host address fields
for the local binding network address, in dotted decimal notation,
Nullable that defines the subnetwork for an interface.
Contains null if this is an IPv6 connection.
LOCAL_BINDING_LINE_ LOCALLINE VARCHAR(10) The name of the communications line description or virtual line
DESCRIPTION (L2TP) that identifies the network associated with an interface.
Can contain the following special values:
LOCAL_BINDING_LINE_STATUS LOCALLSTS VARCHAR(8) The current operational status of the communications line to
which this route is bound.
Nullable
ACTIVE The line is operational.
LOCAL_BINDING_LINE_TYPE LOCALLTYPE VARCHAR(6) The type of line used by the interface. Only supported line types
are listed here; obsolete values could be returned for inactive
configurations.
LOCAL_BINDING_VIRTUAL_ LOCALLAN VARCHAR(4) The virtual LAN to which this route is bound. Can also contain the
LAN_ID following special value:
ROUTE_PRECEDENCE ROUTE_PRCD INTEGER Priority of route. Values are 1 to 10, with the lowest priority being
1.
Nullable
Contains null if this is an IPv6 connection.
DUPLICATE DUPLICATE VARCHAR(6) Indicates whether this route is a duplicate of another route in the
routing table or not, and also whether there are any routes which
Nullable are duplicates of this route.
EXPIRATION EXPIRATION TIMESTAMP(0) The timestamp when this route will expire or did expire. If the
timestamp is in the future, the route has not expired yet. If the
Nullable timestamp is in the past, then this route has expired and is still
being returned for a short period of time to indicate that the route
ceased to function because its lifetime expired.
Contains null if this is an IPv4 connection or if the route will never
expire.
PPP_CONFIGURATION_PROFILE PPPCFGPRF VARCHAR(10) The name of the Point-to-Point Protocol (PPP) configuration
profile associated with this route.
Nullable
Contains null if this is an IPv4 connection or if Point-to-Point
Protocol is not being used with this route.
PPP_INTERNET_ADDRESS PPPINTADD VARCHAR(45) The internet address, in IPv6 address format, to which this Point-
to-Point route is bound.
Nullable
Contains null if this is an IPv4 connection or if Point-to-Point
Protocol is not being used with this route.
PPP_DIAL_ON_DEMAND_ PPPDODPRF VARCHAR(10) The name of the Dial-on-demand Remote Peer Enabled Point-to-
PROFILE Point profile associated with this route.
Nullable
Contains null if this is an IPv4 connection or if Point-to-Point
Protocol is not being used with this route.
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP(0) The timestamp of the most recent change to this route in the
dynamic tables used by the protocol stack.
Nullable
Contains null if the interface has never been changed.
Example
Return information about all routes which are available for use.
Related information
Internet Protocol version 6
NETWORK_ATTRIBUTE_INFO view
The NETWORK_ATTRIBUTE_INFO view returns a single row containing information about the network
attributes of the system.
The information returned is similar to the detail available through the Display Network Attributes
(DSPNETA) CL command, the Retrieve Network Attributes (RTVNETA) CL command, and the Retrieve
Network Attributes (QWCRNETA) API.
Authorization: None required.
The following table describes the columns in the view. The system name is NET_ATTR. The schema is
QSYS2.
Table 126. NETWORK_ATTRIBUTE_INFO view
HOST_NAME HOST_NAME VARCHAR(8) Name of the system where this information was
generated. This is the name set by CHGNETA.
CONTROL_POINT CTL_POINT VARCHAR(8) The local control point name for the system.
LOCATION LOCATION VARCHAR(8) The default local location name for the system.
MODE MODE VARCHAR(8) The default mode name for the system.
DATA_COMPRESSION DTACPR VARCHAR(10) Whether data compression is used when the system
is an SNA end node. This value is used by
mode descriptions that specify *NETATR for data
compression.
If data compression is requested by the remote
system, the data compression levels used by the
session are the lower of the requested levels and the
configured levels.
INTERMEDIATE_DATA_ DTACPRINM VARCHAR(10) The level of data compression to request when the
COMPRESSION system is an SNA intermediate node.
SERVER_NETWORK_IDS SRV_NETIDS VARCHAR(248) CCSID 1208 The advanced peer-to-peer networking (APPN)
network node servers for an APPN node type of
Nullable *ENDNODE or *BEXNODE.
This list is returned as an array within a JSON object.
The array can contain up to five elements and is
identified by NET_IDS.
Each entry in the JSON array contains two JSON
objects:
• An object with a name of "NET_ID" and a value of a
network ID.
• An object with a name of "CTL_POINT" and a value
of the corresponding control point.
The special value of *LCLNETID for a network ID. This
indicates that the value of NETWORK_ID at the time
the node server is referred to is be used.
A special value of *ANY applies to the control
point. This indicates that the first network node that
offers services will become the network node server.
Any network node with the same network ID as
that specified for NETWORK_ID can be a potential
network node server.
Contains the null value when
SERVER_NETWORK_ID_COUNT is 0 or
APPN_NODE_TYPE is not *ENDNODE.
SERVER_NETWORK_ID SRV_NETID VARCHAR(9) The server network ID for the first entry in the
SERVER_NETWORK_IDS list. The special value of
Nullable *LCLNETID indicates that the value of NETWORK_ID
at the time the node server is referred to is be used.
Contains the null value when
SERVER_NETWORK_ID_COUNT is 0 or
APPN_NODE_TYPE is not *ENDNODE.
SERVER_CONTROL_POINT SRV_CTLPT VARCHAR(8) The server control point for the first entry in the
SERVER_NETWORK_IDS list. A special value of *ANY
Nullable indicates that the first network node that offers
services will become the network node server.
Any network node with the same network ID as
that specified for NETWORK_ID can be a potential
network node server.
Contains the null value when
SERVER_NETWORK_ID_COUNT is 0 or
APPN_NODE_TYPE is not *ENDNODE.
ALERT_STATUS ALERT_STS VARCHAR(9) Alert status controls the creation of local alerts.
ALERT_PRIMARY_FOCAL_POIN ALERT_PRIM VARCHAR(4) Whether the system is an alert primary focal point.
T
*NO The system is not an alert primary focal
point.
ALERT_DEFAULT_FOCAL_POIN ALERT_DFT VARCHAR(4) Whether the system is an alert default focal point.
T
*NO The system is not an alert default focal
point.
ALERT_BACKUP_NETWORK_ID ALERT_BNET VARCHAR(8) The network ID of the system that provides backup
focal point services for alerts.
Nullable
These backup values define the system that provides
alert focal point services if the local system is
unavailable and ALERT_PRIMARY_FOCAL_POINT is
*YES. The backup focal point is only used by systems
in the primary sphere of control.
Contains the null value if no backup focal point is
defined.
ALERT_BACKUP_CONTROL_ ALERT_BCTL VARCHAR(8) The control point name of the system that provides
POINT backup focal point services for alerts.
Nullable
Contains the null value if no backup focal point is
defined.
ALERT_REQUEST_CONTROL_ ALERT_RQSC VARCHAR(8) Specify the control point name of the system that is
POINT requested to provide focal point services for alerts.
Nullable
Contains the null value if no backup focal point is
defined.
ALERT_CONTROLLER ALERT_CTL VARCHAR(10) The name of the controller to be used for alerts in
a system service control point - physical unit (SSCP-
Nullable PU) session. This controller is ignored if the system
has a focal point (in which case the node is in another
system's sphere of control).
Contains the null value if no alert controller is
defined.
ALERT_FILTER_LIBRARY ALERT_FTRL VARCHAR(10) The name of the library that contains the filter object.
ALERT_FILTER ALERT_FTR VARCHAR(10) The name of the filter object that is used by the alert
manager when processing alerts.
Nullable
Contains the null value if no alert filter is being used.
MESSAGE_QUEUE MSGQ VARCHAR(10) The name of the message queue to which messages
received through the SNA distribution services
(SNADS) network are sent for:
• Users who have no message queue specified in
their user profile
• Users whose message queue is not available
OUTPUT_QUEUE OUTQ VARCHAR(10) The name of the output queue to which spooled
files received through the SNA distribution services
(SNADS) network are sent for users whose output
queue is not available.
JOB_ACTION JOB_ACTION VARCHAR(7) The action that is taken for any input stream received
through the SNA distribution services (SNADS)
network by the system.
CLIENT_REQUEST_ACCESS CLIENT_RQS VARCHAR(8) The way in which the system processes client
requests from other systems.
NETWORK_SERVER_DOMAIN NWS_DOMAIN VARCHAR(8) The LAN server domain associated with the file
server.
ALLOW_VIRTUAL_APPN VIRT_APPN VARCHAR(4) Specifies whether APPC sessions and devices are
allowed to use virtual APPN controllers.
ALLOW_HPR_TRANSPORT_ HPR_TOWER VARCHAR(4) The HPR transport tower support value is used for
TOWER APPN session traffic.
AUTOCREATE_APPC_DEVICE_ APPC_LIMIT INTEGER The APPC device limit used for auto-creation of
LIMIT devices on virtual APPN controllers.
NETWORK_PRIORITY_TIMER NET_TIMER INTEGER The amount of time, in minutes, to allow for a path
switch attempt of a Rapid Transport Protocol (RTP)
Nullable connection that has network transmission priority.
Contains the null value if no path switch is allowed.
HIGH_PRIORITY_TIMER HIGH_TIMER INTEGER The amount of time, in minutes, to allow for a path
switch attempt of an RTP connection that has high
Nullable transmission priority.
Contains the null value if no path switch is allowed.
LOW_PRIORITY_TIMER LOW_TIMER INTEGER The amount of time, in minutes, to allow for a path
switch attempt of an RTP connection that has low
Nullable transmission priority.
Contains the null value if no path switch is allowed.
ALLOW_ADD_TO_CLUSTER ADD_CLUST VARCHAR(7) Whether this system will allow another system to add
it as a node in a cluster.
Example
• Review the system network attributes.
OBJECTCONNECT_INFO view
The OBJECTCONNECT_INFO view returns information about the ObjectConnect over IP server.
This view will only return data if Option 22 of the IBM i operating system is installed.
Authorization: None required.
The following table describes the columns in the view. The system name is OBJC_INFO. The schema is
QSYS2.
Table 127. OBJECTCONNECT_INFO view
INACTIVE_TIME INACT_TIME INTEGER The length of time, in minutes, a server job keeps
inactive before the server job ends.
SEND_BUFFER SND_BUF INTEGER The size of the TCP send buffer, in bytes, that the data
connection will use to send data over the network.
RECEIVE_BUFFER RCV_BUF INTEGER The size of the TCP receive buffer, in bytes, that the
data connection will use to receive data from the
network.
Example
• List information about the ObjectConnect over IP server.
, remote-ip-address
REMOTE_IP_ADDRESS =>
, address-version-format
ADDRESS_VERSION_FORMAT =>
, number-packets-to-send
NUMBER_PACKETS_TO_SEND =>
, packet-length-to-send
PACKET_LENGTH_TO_SEND =>
, wait-time
WAIT_TIME =>
)
, local-ip-address
LOCAL_IP_ADDRESS =>
remote- A character string containing the name of the remote system with which the ping
system operation takes place. Can contain the following special value:
If this parameter is omitted, the default value is *INTNETADR and a value for remote-ip-
address must be specified.
remote-ip- A character string that specifies the remote internet address. Either a valid IP Version 4
address or IP Version 6 address is accepted.
If remote-system contains a value other than *INTNETADR, this parameter is ignored.
address- A character string that specifies how the host name specified for remote-system is to be
version- resolved. It is also the address format to be used if remote-ip-address is specified.
format
*CALC The host name resolution method will be determined based on the host name
entered for remote-system. This is the default.
*IP4 Use the IP Version 4 host name resolution method.
*IP6 Use the IP Version 6 host name resolution method.
number- An integer value that specifies the number of packets that are sent to the remote system.
packets-to- Valid values are 1 to 999. The default is 5.
send
The result of the function is a table containing one row with the format shown in the following table. All
the columns are null capable.
Table 128. PING table function
FAILURE At least one packet did not respond or an error occurred with the
command.
RESPONSES_RETURNED INTEGER The total number of responses received for the packets that were sent.
REMOTE_HOST_NAME VARCHAR(255) The name of the host that was the target of the ping request.
Note
This function is provided in the SYSTOOLS schema as an example of how messages in a job log can be
examined to gather status information. Similar to other Db2 for i provided tools within SYSTOOLS, the
SQL source can be extracted and used as a model for building similar helper functions, or to create a
customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Verify connectivity to a remote system by name.
TEXT_DESCRIPTION TEXT VARGRAPHIC(50) CCSID The text description for this relational database
1200 entry.
LOCAL_LOCATION LOCAL_LOC VARCHAR(8) The local location name by which this system
is identified to the system on which the RDB is
Nullable located. Can contain one of the following special
values:
REMOTE_MODE RMT_MODE VARCHAR(8) The mode name to use with the remote location
name to communicate with the system on which
Nullable the RDB is located. Can contain one of the
following special values:
TRANSACTION_PROGRAM TRANS_PGM VARCHAR(8) FOR BIT The name of the transaction program to use with
DATA the RDB entry.
REMOVE_TIME_SERVER procedure
The REMOVE_TIME_SERVER procedure removes a Network Time Protocol (NTP) server from the NTP
configuration list.
The REMOVE_TIME_SERVER procedure requires 5770SS1 Option 33 - Portable Application Solutions
Environment (PASE).
Authorization: The caller must have:
• *IOSYSCFG special authority, and
• *RW authority to /QIBM/UserData/OS400/TCPIP/NTP/ntp.conf
REMOVE_TIME_SERVER ( time-server )
TIME_SERVER =>
time-server A character or graphic string that identifies the DNS name of the NTP server to be removed
from the configuration.
Example
• Remove time.domain.name.com as a preferred time server
SERVER_SBS_CONFIGURATION view
The SERVER_SBS_CONFIGURATION view returns subsystem routing information for some IBM i servers.
When a client attempts to use TCP/IP to form a connection to a server listed in this view, an attempt is
made to attach to a prestart job in the subsystem configured for that server.
The information returned by this view is similar to the information shown by IBM Navigator for i in
Network > Servers. For information about users who have alternate subsystem configurations for some
IBM i servers, see “SERVER_SBS_ROUTING view” on page 592.
The QSYS2.SET_SERVER_SBS_ROUTING procedure can be used to modify entries shown in this view.
Authorization: None required.
The following table describes the columns in the view. The system name is SERVER_CFG. The schema is
QSYS2.
Table 130. SERVER_SBS_CONFIGURATION view
System Column
Column Name Name Data Type Description
SERVER_SEARCH_ORDER SEARCH_ORD INTEGER The search order for selecting this subsystem routing entry. The
order starts with one for each SERVER_NAME value.
Nullable
Contains the null value for the default entry for each server. This is
the entry that will be selected if no other specific entry is selected.
SUBSYSTEM SUBSYSTEM VARCHAR(10) The subsystem name that incoming connections for this server
will be rerouted to when this entry is selected.
System Column
Column Name Name Data Type Description
ALLOW_ROLLOVER ROLLOVER VARCHAR(3) Indicates how incoming connection requests are handled if the
subsystem is not active.
IP_ADDRESS_START IP_START VARCHAR(45) The IP address for alternate routing or the starting IP address for
a range of IP addresses.
Nullable
Contains the null value if no IP addresses are used for defining
this row.
Nullable Contains the null value if this row is not for a range of IP
addresses.
SUBNET_MASK SUBNET VARCHAR(15) The actual value of the subnet mask in dotted-decimal notation.
PREFIX_LENGTH PREFIX INTEGER The prefix length defines how many of the left-most bits of the
IPv6 address make up the prefix.
Nullable
Contains the null value if IP_ADDRESS_START is null or an IPv4
address.
Example
List all the servers that have alternate subsystems defined.
SERVER_SBS_ROUTING view
The SERVER_SBS_ROUTING view returns information about the users who have alternate subsystem
configurations for some IBM i servers. When a user profile listed in this view attempts to use TCP/IP to
form a connection to the server, an attempt is made to use the alternate subsystem instead of the default
subsystem for that server.
For subsystem routing information for some IBM i servers, see “SERVER_SBS_CONFIGURATION view” on
page 591.
The QSYS2.SET_SERVER_SBS_ROUTING procedure can be used to modify the values shown in this view.
Authorization: The caller must have *OBJOPR and *READ authority to the *USRPRF.
The following table describes the columns in the view. The system name is SRVR_RTG. The schema is
QSYS2.
System Column
Column Name Name Data Type Description
AUTHORIZATION_NAME USER_NAME VARCHAR(128) The user profile that has an alternate subsystem configuration.
QRWTSRVR_SUBSYSTEM DRDADDMSBS VARCHAR(10) The subsystem name that incoming DRDA or DDM connections
will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QZDASOINIT_SUBSYSTEM ZDASBS VARCHAR(10) The subsystem name that incoming database server connections
will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QZRCSRVS_SUBSYSTEM ZRCSBS VARCHAR(10) The subsystem name that incoming remote command server
connections will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QZHQSSRV_SUBSYSTEM ZHQSBS VARCHAR(10) The subsystem name that incoming data queue server
connections will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QZSCSRVS_SUBSYSTEM ZSCSBS VARCHAR(10) The subsystem name that incoming central server connections
will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QNPSERVS_SUBSYSTEM NPSSBS VARCHAR(10) The subsystem name that incoming network print server
connections will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QPWFSERVSO_SUBSYSTEM PWFSBS VARCHAR(10) The subsystem name that incoming file server connections will be
rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QDBMSRVR_SUBSYSTEM DBMSBS VARCHAR(10) The subsystem name that incoming database mirror connections
will be rerouted to.
Nullable
Contains the null value when an alternate subsystem for this
server has not been configured for this user.
QRWTSRVR_ROLLOVER DRDA_RO VARCHAR(3) Indicates how incoming DRDA or DDM connection requests are
handled if the specified subsystem cannot be used.
QZDASOINIT_ROLLOVER ZDA_RO VARCHAR(3) Indicates how incoming database server connection requests are
handled if the specified subsystem cannot be used.
QZRCSRVS_ROLLOVER ZRC_RO VARCHAR(3) Indicates how incoming remote command connection requests
are handled if the specified subsystem cannot be used.
System Column
Column Name Name Data Type Description
QZHQSSRV_ROLLOVER ZHQ_RO VARCHAR(3) Indicates how incoming data queue server connection requests
are handled if the specified subsystem cannot be used.
QZSCSRVS_ROLLOVER ZSC_RO VARCHAR(3) Indicates how incoming central server connection requests are
handled if the specified subsystem cannot be used.
QNPSERVS_ROLLOVER NPS_RO VARCHAR(3) Indicates how incoming network print server connection requests
are handled if the specified subsystem cannot be used.
QPWFSERVSO_ROLLOVER PWF_RO VARCHAR(3) Indicates how incoming file server connection requests are
handled if the specified subsystem cannot be used.
QDBMSRVR_ROLLOVER DBM_RO VARCHAR(3) Indicates how incoming database mirror connection requests are
handled if the specified subsystem cannot be used.
The following table shows the servers that can have alternate subsystem configurations.
Example
SET_SERVER_SBS_ROUTING procedure
The SET_SERVER_SBS_ROUTING procedure provides the ability to configure a server to use an alternate
subsystem. This can be for all users of the server, for a specific user profile, or by IP address.
This procedure allows an administrator to reposition certain connections to a server into an alternate,
non-default, subsystem. When configured, new incoming TCP/IP server connections will use the alternate
subsystem.
Connections to be re-routed can be defined three ways.
1. A server's default subsystem for all connections.
2. For an IP address or a range of IP addresses.
3. For a specific user profile. The user profile can be a group profile or a supplemental group profile.
Some servers do not support routing by specific user profile; refer to Table 133 on page 595 for
details.
To select the subsystem for a connection, the routing logic first looks for an IP address routing entry
for the server. If there is not one, it will route according to the defined default. The routing process will
then immediately check for a configured entry for the specific user profile and attempt to route to its
subsystem. For example, if a server is configured to route to a user-specified subsystem by incoming
TCP/IP address as well as by user profile, the job will first attempt to route to the subsystem configured
for that TCP/IP address and then immediately attempt to route to the subsystem configured for the
connecting user profile. Understanding this order of processing is key to recognizing failures that may
occur.
By default, all users for the following servers use the listed default subsystem:
For more information on these servers see DRDA and DDM overview and Host servers by function.
Routing information set by this procedure can be queried using the following views:
• For routing for a specific user, see “SERVER_SBS_ROUTING view” on page 592.
authorization-name , server-name ,
SERVER_NAME =>
subsystem-name
SUBSYSTEM_NAME =>
, allow-rollover
ALLOW_ROLLOVER =>
, ip-address-start
IP_ADDRESS_START =>
, ip-address-end
IP_ADDRESS_END =>
, subnet-mask
SUBNET_MASK =>
, prefix-length
PREFIX_LENGTH =>
, server-position
SERVER_POSITION =>
, replacement-ip-address-start
REPLACEMENT_IP_ADDRESS_START =>
, replacement-ip-address-end
REPLACEMENT_IP_ADDRESS_END =>
)
, text-description
TEXT_DESCRIPTION =>
authorization- A character or graphic string expression that identifies an existing user or group profile
name name. Can contain the following special value:
*ALL This configuration applies to all users of the server unless a specific alternate
subsystem is defined for the user. To route using an IP address, *ALL must be
specified.
allow-rollover A character or graphic string expression that indicates the action to take if the
specified subsystem is not active. Valid values are:
NO If the alternate subsystem cannot be used, the connection request will fail.
YES If the alternate subsystem cannot be used, the connection request will succeed
by using a batch immediate job in the default subsystem.
When routing for the server (authorization-name is *ALL), the following parameters are allowed:
ip-address- A character or graphic string expression that identifies an IPv4 or IPv6 address for a
start single client.
• If ip-address-end is not specified, this is a specific IPv4 or IPv6 address.
• If ip-address-end is specified, this is the start value for a range of IPv4 or IPv6
addresses for a group of clients. When more than one range of addresses is defined
for a server, the IP address ranges cannot overlap.
When ip-address-start is specified, either subnet-mask or prefix-length can be
specified.
Notes
The prestart job entry must specify the subsystem-name.
When ALLOW_ROLLOVER is YES: if, for any reason, the alternate subsystem cannot be used to establish
the connection, the connection will run in the default subsystem (or the last subsystem it was successfully
routed to) as a batch immediate job. An example of this would be if the authorization-name does not have
*USE authority to the subsystem description for subsystem-name.
Examples
• Set new incoming DRDA and DDM TCP/IP server connections for user profile TIM to route to subsystem
TIMSUBSYS.
CALL QSYS2.SET_SERVER_SBS_ROUTING('TIM','QRWTSRVR','TIMSUBSYS')
• Reset incoming DRDA and DDM TCP/IP server connections for user profile TIM back to the original
default subsystem.
CALL QSYS2.SET_SERVER_SBS_ROUTING('TIM','QRWTSRVR',NULL)
• Configure group profile ADMIN to use an alternate subsystem for all of the servers supported by this
procedure. Do not permit a connection request to rollover to use QUSRWRK.
CALL QSYS2.SET_SERVER_SBS_ROUTING('ADMIN','*ALL','ADHOCSBS','NO')
• Set new incoming Database server TCP/IP connections for user profile BOB to route to subsystem
BOBSUBSYS.
CALL QSYS2.SET_SERVER_SBS_ROUTING('BOB','QZDASOINIT','BOBSUBSYS')
• Construct a subsystem that will constrain the amount of system resources available to users who are
known to execute expensive queries.
STRSBS SBSD(QGPL/ADHOCSBS)
CALL QSYS2.SET_SERVER_SBS_ROUTING('SLFUSER','QRWTSRVR','ADHOCSBS')
• Set all Db2 Mirror connections to run in subsystem QDBMWRK. This separates the jobs from the
default QUSRWRK subsystem. Make sure the pool for the subsystem description has sufficient memory
available.
STRSBS QSYS/QDBMWRK
CALL QSYS2.SET_SERVER_SBS_ROUTING('*ALL','QDBMSRVR','QDBMWRK')
• Define a complete block of IP addresses to be routed to subsystem NEWSBS for QZDASOINIT jobs. The
range includes all addresses in the address block of 192.168.1.0-255
• Change the range of IP addresses for QZDASOINIT jobs that are routed to a subsystem NEWSBS.
• Add a new entry in the first position in the prioritized list of IP address routing entries for the
QPWFSERVSO server.
Related information
Use of prestart jobs
TCPIP_INFO view
The TCPIP_INFO view contains TCP/IP information for the current host connection.
Authorization: None required.
The following table describes the columns in the view. The schema is QSYS2.
Table 134. TCPIP_INFO view
COLLECTED_TIME COLLE00001 TIMESTAMP Timestamp indicating when this row of information was
collected.
Nullable
Nullable
Nullable
Nullable
Nullable
Nullable
Nullable
Nullable
Nullable
Example
Return information about the current host connection.
TIME_PROTOCOL_INFO view
The TIME_PROTOCOL_INFO view returns information about Network Time Protocol (NTP) servers that
are configured.
The TIME_PROTOCOL_INFO view requires 5770SS1 Option 33 - Portable Application Solutions
Environment (PASE).
Authorization: The caller must have *IOSYSCFG special authority.
The following table describes the columns in the view. The system name is TIME_PROTO. The schema is
QSYS2.
Table 135. TIME_PROTOCOL_INFO view
TIME_SERVER SERVER VARCHAR(256) The DNS domain name for the NTP server.
Example
• List all the configured time protocol servers.
Configuration Services
These services provide configuration information.
, detailed-info
DETAILED_INFO =>
)
, ignore-errors
IGNORE_ERRORS =>
resource- A character or graphic string expression that identifies the category of resource
category information to be returned.
detailed-info A character or graphic string expression that indicates the type of information to be
returned.
NO Only the basic information is returned for the resource. This is the information in
the columns prior to the SERIAL_NUMBER column. This is the default.
YES All the information available for the resource is returned.
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 136. HARDWARE_RESOURCE_INFO table function
ID INTEGER A generated unique identifier for this row in the result set.
RESOURCE_CATEGORY VARCHAR(11) The hardware resource category of the resource for which information
is returned.
Contains the null value if STATUS does not apply to this resource or
could not be determined.
Contains the null value if STATUS does not apply to this resource or
could not be determined.
DEVICE_TYPE VARCHAR(4) An identifier that represents the object type of this resource. For self-
configuring tape devices, this represents the emulated device type
number.
A value of *TAP indicates that a self-configuring tape device is
emulating a device type that contains characters outside the range of 0
to 9 and A to Z.
Contains the null value if a value is not available.
DEVICE_MODEL VARCHAR(3) The model number of the resource. For self-configuring tape devices,
this represents the emulated device model number.
Contains the null value if a value is not available.
ADAPTER_SYSTEM VARCHAR(8) The system to which the coupled system adapter is connected.
Contains the null value if a value is not available.
RESOURCE_KIND BINARY(24) The resource kind field consists of 24 bytes of hexadecimal numbers. It
can be divided into three 8-byte fields called Kind 1, Kind 2, and Kind 3.
The system uses Kind 1, Kind 2, and Kind 3 to categorize the resource.
Non-null values can be returned for the following columns when DETAILED_INFO is YES
SERIAL_NUMBER VARCHAR(15) The expanded unique number based on the manufacturing sequence
for the resource.
SERIAL_NUMBER_SHORT VARCHAR(10) A unique number based on the manufacturing sequence for the
resource.
BOARD_NUMBER INTEGER A numerical representation of a section of the bus into which the card
is plugged.
Contains the null value if the column does not apply to the resource.
CARD_NUMBER INTEGER A numerical representation of the location of the card on the bus.
Contains the null value if the column does not apply to the resource.
CARD_POSITION VARCHAR(5) The physical location where the device or feature is plugged into the
bus.
Contains the null value if the column does not apply to the resource.
LOCATION_CODE VARCHAR(79) The physical location of the hardware resource in the system.
The location code field is a sequence of 0 or more location labels that
when followed in order, lead to the resource location. This is the place
someone could go to view, remove, or replace the piece of hardware.
Location labels are etched, silk screened, or marked in other ways on
hardware. The following location labels might be shown in the location
code field (n represents a numerical or alphabetical identifier):
This column is available only if the system supports the location code
format and if the value applies for the resource Otherwise the null
value is returned.
SYSTEM_PROCESSOR_ CHAR(4) The processor feature code level of the system. A value is returned
FEATURE_CODE for this column only if the RESOURCE_KIND3 value of the hardware
resource indicates that the resource provides system information
(X'0000000000080000').
Contains the null value if the column does not apply to the resource.
PROCESSOR_FEATURE_CODE CHAR(4) The processor feature, which corresponds to the processor capacity of
the system.
Contains the null value if the column does not apply to the resource.
INTERACTIVE_FEATURE_CODE CHAR(4) The interactive feature of the system. This feature defines the portion
of the processor that can be used to perform interactive work.
Contains the null value if the column does not apply to the resource.
4M
16M
4M AND 16M
25M
34M
45M
100M
155M
10M TO 1G
1G
10G
1G AND 10G
25G
40G
50G
56G
100G
1G TO 100G
1G TO 25G
Contains the null value if the column does not apply to the resource.
Contains the null value if the column does not apply to the resource.
Example
• Return full information about tape resources.
HARDWARE_RESOURCE_INFO view
The HARDWARE_RESOURCE_INFO view returns information about configured hardware resources.
The information returned is similar to the detail available through the STRSST Hardware Service Manager
interface and from the Retrieve Hardware Resource List (QGYRHRL, QgyRtvHdwRscList) and Retrieve
Hardware Resource Information (QGYRHRI, QgyRtvHdwRscInfo) APIs.
Authorization: None required.
The following table describes the columns in the view. The system name is HW_INFO. The schema is
QSYS2.
Table 137. HARDWARE_RESOURCE_INFO view
RESOURCE_CATEGORY CATEGORY VARCHAR(11) The hardware resource category of the resource for
which information is returned.
DEVICE_MODEL DEV_MODEL VARCHAR(3) The model number of the resource. For self-
configuring tape devices, this represents the
Nullable emulated device model number.
Contains the null value if a value is not available.
ADAPTER_SYSTEM ADAPT_SYS VARCHAR(8) The system to which the coupled system adapter is
connected.
Nullable
Contains the null value if a value is not available.
LAN_ADAPTER_ADDRESS LAN_ADAPT VARCHAR(12) The network address of the LAN adapter resource.
CARD_POSITION CARD_POS VARCHAR(5) The physical location where the device or feature is
plugged into the bus.
Nullable
Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
LOCATION_CODE LOC_CODE VARCHAR(79) The physical location of the hardware resource in the
system.
Nullable
The location code field is a sequence of 0 or more
location labels that when followed in order, lead to
the resource location. This is the place someone
could go to view, remove, or replace the piece of
hardware. Location labels are etched, silk screened,
or marked in other ways on hardware. The following
location labels might be shown in the location
code field (n represents a numerical or alphabetical
identifier):
Nullable Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
SYSTEM_PROCESSOR_ SYSPROC_FC CHAR(4) The processor feature code level of the system.
FEATURE_CODE A value is returned for this column only if
Nullable the RESOURCE_KIND3 value of the hardware
resource indicates that the resource provides system
information (X'0000000000080000').
Contains the null value if the column does not apply
to the resource.
INTERACTIVE_FEATURE_CODE INTER_FC CHAR(4) The interactive feature of the system. This feature
defines the portion of the processor that can be used
Nullable to perform interactive work.
Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
Nullable Contains the null value if the column does not apply
to the resource.
Nullable 4M
16M
4M AND 16M
25M
34M
45M
100M
155M
10M TO 1G
1G
10G
1G AND 10G
25G
40G
50G
56G
100G
1G TO 100G
1G TO 25G
Examples
• List all resources that are not operational.
• Return a list of all resources and their children. For each parent device (those with a PARENT_ID value
that is null), it recursively finds all the children that are under the parent. In addition to some basic
resource information and the ID values for the parent and child, the query returns the nesting depth of
the each row and a list of all the device numbers that form the path to that row.
COMPARE_IFS ( start-path-name1 ,
START_PATH_NAME1 =>
start-path-name2
START_PATH_NAME2 =>
, rdb2
RDB2 =>
, subtree-directories
SUBTREE_DIRECTORIES =>
, object-type-list
OBJECT_TYPE_LIST =>
)
, compare-attributes
COMPARE_ATTRIBUTES =>
object-type- A list of one or more object types to be included in the compare. One or more blanks
list separate multiple values. The default is *ALL, indicating all object types are compared.
Supported values are all of the root (/) and QOpenSys file system object types (*CHRSF,
*DIR, *FIFO, *SOCKET, *STMF, *SYMLNK) and the following special values:
*ALL Compare all root (/) and QOpenSys file system object types. These are
*CHRSF, *DIR, *FIFO, *SOCKET, *STMF, and *SYMLNK.
*ALLSAV Compare all root (/) and QOpenSys file system object types which can be
saved using the Save (SAV) command. These are *CHRSF, *DIR, *FIFO,
*STMF, and *SYMLNK.
compare- A string expression that indicates which attributes are compared for an object.
attributes
NAMES Only the object names are compared. A row is returned for any name that
is not found in both directories. This option is only allowed when comparing
directories. This is the default.
YES The attributes are compared for an object. A row is returned for each difference
found.
The attributes compared for an object vary based upon the object type. Not all attributes
are eligible to be compared.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 138. COMPARE_IFS table function
PATH_NAME1 DBCLOB(16M) The full path name of the first object for the compare.
CCSID 1200
PATH_NAME2 DBCLOB(16M) The full path name of the second object for the compare.
CCSID 1200
CCSID 1200
CCSID 1200
CCSID 1200
Examples
• Compare the attributes for all objects in two subtrees. Do not look within any subdirectories.
• Compare the names for all objects in two subtrees. Compare recursively through the entire set of
subdirectories.
)
, ignore-errors
IGNORE_ERRORS =>
job-name An expression that returns the qualified job name whose reference information is to be
returned. Can contain the following special value:
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 139. IFS_JOB_INFO table function
PATH_NAME DBCLOB(16M) CCSID The path name of an integrated file system object that is referenced by the
1200 job.
Contains the null value if the object is not linked to a path. This can occur
in the root (/) file system, the QOpenSys file system, or a user-defined file
system. Can also contain the null value if the object is in a remote file
system or the optical file system (QOPT).
UDFS MANAGEMENT A file system that manages the block special files
(*BLKSF) for the user-defined file systems.
FILE_IDENTIFIER_NUMBER BIGINT The file identifier number of the object. This number uniquely identifies the
object with a file system.
The file identifier number, generation identifier, and file system identifier
used together uniquely identify the object on the system.
FILE_SYSTEM_IDENTIFIER BIGINT The file system ID to which the object belongs. This number uniquely
identifies the file system to which the object belongs.
The file identifier number, generation identifier, and file system identifier
used together uniquely identify the object on the system.
REFERENCE_COUNT INTEGER Current number of references on the object for the specified job.
RO_SHARE_R_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
RO_SHARE_W_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with write access intents only.
RO_SHARE_RW_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
RO_SHARE_NONE_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with no other access intents.
WO_SHARE_R_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
WO_SHARE_W_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with write access intents only.
WO_SHARE_RW_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
WO_SHARE_NONE_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with no other access intents.
RW_SHARE_R_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with read and execute access intents only.
RW_SHARE_W_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with write access intents only.
RW_SHARE_RW_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with read, execute, and write access intents.
RW_SHARE_NONE_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with no other access intents.
XO_SHARE_R_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
XO_SHARE_W_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with write access intents only.
XO_SHARE_RW_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
XO_SHARE_NONE_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with no other access intents.
XR_SHARE_R_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with read and execute access intents only.
XR_SHARE_W_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with write access intents only.
XR_SHARE_RW_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with read, execute, and write access intents.
XR_SHARE_NONE_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with no other access intents.
CURRENT_DIRECTORY VARCHAR(3) The object is a directory that is being used as the current directory of the
job.
ROOT_DIRECTORY VARCHAR(3) The object is a directory that is being used as the root directory of the job.
NO The object is not a directory that is being used as the root directory
of the job.
SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced by an object save
operation.
INTERNAL_SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced internally during a save
operation on a different object.
LINK_CHANGES_LOCK VARCHAR(3) Indicates whether changes to links in the directory are prevented.
CHECKED_OUT_USER_NAME VARCHAR(10) The name of the user who has the object checked out.
Contains the null value if CHECKED_OUT is NO.
FILE_SERVER_REFERENCE VARCHAR(3) The File Server is holding a generic reference on the object on behalf of a
client.
FILE_SERVER_WORKING_DIRECTORY VARCHAR(3) The object is a directory, and the File Server is holding a working directory
reference on it on behalf of a client.
YES The object is a directory, and the File Server is holding a working
directory reference on it on behalf of a client.
NFS_SERVER_REFERENCE VARCHAR(3) The Network File System (NFS) Version 4 server job is holding a generic
reference on the object on behalf of a client.
NO The NFS server job is not holding a generic reference on the object
on behalf of a client.
YES The NFS server job is holding a generic reference on the object on
behalf of a client.
Example
• List all the integrated file system references for the current job.
IFS_OBJECT_LOCK_INFO ( path-name
PATH_NAME =>
)
, ignore-errors
IGNORE_ERRORS =>
path- An expression that defines the path name to the object whose reference information is to
name be returned. If the last element of the path is a symbolic link, the reference information will
be for the symbolic link itself. If an absolute path name is not specified, the current working
directory is used in combination with the relative path name to resolve to the object.
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
NO An error is returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 140. IFS_OBJECT_LOCK_INFO table function
RO_COUNT INTEGER Total number of read only access references for this job.
WO_COUNT INTEGER Total number of write only access references for this job.
RW_COUNT INTEGER Total number of read and write access references for this job.
XO_COUNT INTEGER Total number of execute only access references for this job.
SHARE_R_COUNT INTEGER Total number of references for this job where the sharing mode allows
sharing with read and execute access intents only.
SHARE_W_COUNT INTEGER Total number of references for this job where the sharing mode allows
sharing with write access intents only.
SHARE_RW_COUNT INTEGER Total number of references for this job where the sharing mode allows
sharing with read, execute, and write access intents.
SHARE_NONE_COUNT INTEGER Total number of references for this job where the sharing mode allows
sharing with no other access intents.
ATTRIBUTE_LOCK VARCHAR(3) Indicates whether attribute changes are prevented for this job.
SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced by an object save
operation by this job.
INTERNAL_SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced internally during a save
operation on a different object by this job.
LINK_CHANGES_LOCK VARCHAR(3) Indicates whether changes to links in the directory are prevented for this
job.
CHECKED_OUT VARCHAR(3) Indicates whether the object is currently checked out by this job.
CHECKED_OUT_USER_NAME VARCHAR(10) The name of the user who has the object checked out.
Contains the null value if CHECKED_OUT is NO.
RO_SHARE_R_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
RO_SHARE_W_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with write access intents only.
RO_SHARE_RW_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
RO_SHARE_NONE_COUNT INTEGER Number of read only accesses for the job where the sharing mode allows
sharing with no other access intents.
WO_SHARE_R_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
WO_SHARE_W_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with write access intents only.
WO_SHARE_RW_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
WO_SHARE_NONE_COUNT INTEGER Number of write only accesses for the job where the sharing mode allows
sharing with no other access intents.
RW_SHARE_R_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with read and execute access intents only.
RW_SHARE_W_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with write access intents only.
RW_SHARE_RW_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with read, execute, and write access intents.
RW_SHARE_NONE_COUNT INTEGER Number of read and write accesses for the job where the sharing mode
allows sharing with no other access intents.
XO_SHARE_R_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with read and execute access intents only.
XO_SHARE_W_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with write access intents only.
XO_SHARE_RW_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with read, execute, and write access intents.
XO_SHARE_NONE_COUNT INTEGER Number of execute only accesses for the job where the sharing mode allows
sharing with no other access intents.
XR_SHARE_R_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with read and execute access intents only.
XR_SHARE_W_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with write access intents only.
XR_SHARE_RW_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with read, execute, and write access intents.
XR_SHARE_NONE_COUNT INTEGER Number of execute and read accesses for the job where the sharing mode
allows sharing with no other access intents.
CURRENT_DIRECTORY VARCHAR(3) Indicates whether the object is a directory that is being used as the current
directory of the job.
YES The object is a directory that is being used as the current directory
of the job.
ROOT_DIRECTORY VARCHAR(3) Indicates whether the object is a directory that is being used as the root
directory of the job.
NO The object is not a directory that is being used as the root directory
of the job.
YES The object is a directory that is being used as the root directory of
the job.
FILE_SERVER_REFERENCE VARCHAR(3) Indicates whether the File Server is holding a generic reference on the
object on behalf of a client for this job.
FILE_SERVER_WORKING_DIRECTORY VARCHAR(3) Indicates whether the object is a directory, and the File Server is holding a
working directory reference on it on behalf of a client for this job.
YES The object is a directory, and the File Server is holding a working
directory reference on it on behalf of a client.
NFS_SERVER_REFERENCE VARCHAR(3) Indicates whether the Network File System (NFS) Version 4 server job is
holding a generic reference on the object on behalf of a client for this job.
NO The NFS server job is not holding a generic reference on the object
on behalf of a client.
YES The NFS server job is holding a generic reference on the object on
behalf of a client.
NETSERVER_SESSION CLOB(1M) This column contains a list of NetServer sessions, with each entry formatted
as follows:
1. 20 characters containing the session ID number
2. 10 character user name
3. 15 character workstation name
4. 45 character workstation address
5. 1 semicolon (;)
Contains the null value if there are no NetServer sessions.
Example
• List all the jobs that have a lock on /usr/test1
IFS_OBJECT_PRIVILEGES ( path-name
PATH_NAME =>
)
, ignore-errors
IGNORE_ERRORS =>
path- An expression that returns the path name identifying the object. A relative path name is
name relative to the current directory. If an absolute path name is not specified, the current
working directory is used in combination with the relative path name to resolve to the
object. If the last element of the path is a symbolic link, the privilege information will be for
the symbolic link itself.
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
NO An error is returned.
PRIMARY_GROUP VARCHAR(10) The name of the user profile that is the primary group of the object. Can
contain the following special value:
AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list if the object is secured by an
authorization list.
Contains the null value if the object is not secured by an authorization list.
AUTHORIZATION_NAME VARCHAR(10) User profile name for this row. Can contain the following special values:
*PUBLIC This row contains the public authority for the object.
DATA_AUTHORITY VARCHAR(12) The operation, use, or access that AUTHORIZATION_NAME has to the
object. Contains one of the following special values:
*RWX Allows all operations on the object except those that are
limited to the owner or controlled by the object rights.
USER DEFINED The specific data authorities do not match any of the
predefined authority levels.
Example
• List all the authorities for all objects in the /usr directory.
, detailed-info
DETAILED_INFO =>
)
, ignore-errors
IGNORE_ERRORS =>
path-name An expression that defines the path name to the object whose reference information is to
be returned. If the last element of the path is a symbolic link, the reference information
will be for the symbolic link itself. If an absolute path name is not specified, the current
working directory is used in combination with the relative path name to resolve to the
object.
detailed- A character or graphic string expression that indicates the type of information to be
info returned.
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
NO An error is returned.
The result of the function is a table containing a single row with the format shown in the following table.
All the columns are nullable.
Table 142. IFS_OBJECT_REFERENCES_INFO table function
REFERENCE_COUNT INTEGER Current number of references on the object. This may be 0 even though
IN_USE has a value of YES.
NO The object is not in use and all of the reference type fields are 0.
SHARE_R_COUNT INTEGER Total number of references where the sharing mode allows sharing with
read and execute access intents only.
SHARE_W_COUNT INTEGER Total number of references where the sharing mode allows sharing with
write access intents only.
SHARE_RW_COUNT INTEGER Total number of references where the sharing mode allows sharing with
read, execute, and write access intents.
SHARE_NONE_COUNT INTEGER Total number of references where the sharing mode allows sharing with no
other access intents.
SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced by an object save
operation.
INTERNAL_SAVE_LOCK VARCHAR(3) Indicates whether the object is being referenced internally during a save
operation on a different object.
LINK_CHANGES_LOCK VARCHAR(3) Indicates whether changes to links in the directory are prevented.
CHECKED_OUT_USER_NAME VARCHAR(10) The name of the user who has the object checked out.
Contains the null value if CHECKED_OUT is NO.
Values are returned for the following columns when the DETAILED_INFO parameter is YES. They will contain the null value if DETAILED_INFO
is NO.
RO_SHARE_R_COUNT INTEGER Total number of read only access references. The sharing mode allows
sharing with read and execute access intents only.
RO_SHARE_W_COUNT INTEGER Total number of read only access references. The sharing mode allows
sharing with write access intents only.
RO_SHARE_RW_COUNT INTEGER Total number of read only access references. The sharing mode allows
sharing with read, execute, and write access intents.
RO_SHARE_NONE_COUNT INTEGER Total number of read only access references. The sharing mode allows
sharing with no other access intents.
WO_SHARE_R_COUNT INTEGER Total number of write only access references. The sharing mode allows
sharing with read and execute access intents only.
WO_SHARE_W_COUNT INTEGER Total number of write only access references. The sharing mode allows
sharing with write access intents only.
WO_SHARE_RW_COUNT INTEGER Total number of write only access references. The sharing mode allows
sharing with read, execute, and write access intents.
WO_SHARE_NONE_COUNT INTEGER Total number of write only access references. The sharing mode allows
sharing with no other access intents.
RW_SHARE_R_COUNT INTEGER Total number of read and write access references. The sharing mode allows
sharing with read and execute access intents only.
RW_SHARE_W_COUNT INTEGER Total number of read and write access references. The sharing mode allows
sharing with write access intents only.
RW_SHARE_RW_COUNT INTEGER Total number of read and write access references. The sharing mode allows
sharing with read, execute, and write access intents.
RW_SHARE_NONE_COUNT INTEGER Total number of read and write access references. The sharing mode allows
sharing with no other access intents.
XO_SHARE_R_COUNT INTEGER Total number of execute only access references. The sharing mode allows
sharing with read and execute access intents only.
XO_SHARE_W_COUNT INTEGER Total number of execute only access references. The sharing mode allows
sharing with write access intents only.
XO_SHARE_RW_COUNT INTEGER Total number of execute only access references. The sharing mode allows
sharing with read, execute, and write access intents.
XO_SHARE_NONE_COUNT INTEGER Total number of execute only access references. The sharing mode allows
sharing with no other access intents.
XR_SHARE_R_COUNT INTEGER Total number of execute and read access references. The sharing mode
allows sharing with read and execute access intents only.
XR_SHARE_W_COUNT INTEGER Total number of execute and read access references. The sharing mode
allows sharing with write access intents only.
XR_SHARE_RW_COUNT INTEGER Total number of execute and read access references. The sharing mode
allows sharing with read, execute, and write access intents.
XR_SHARE_NONE_COUNT INTEGER Total number of execute and read access references. The sharing mode
allows sharing with no other access intents.
CURRENT_DIRECTORY_COUNT INTEGER Total number of jobs where the object is a directory that is being used as the
current directory of the job.
ROOT_DIRECTORY_COUNT INTEGER Total number of jobs where the object is a directory that is being used as the
root directory of the job.
FILE_SERVER_REFERENCE_COUNT INTEGER Total number of jobs where the File Server is holding a generic reference on
the object on behalf of a client.
FILE_SERVER_WORKING_DIRECTORY_ INTEGER Total number of jobs where the object is a directory, and the File Server is
COUNT holding a working directory reference on it on behalf of a client.
NFS_SERVER_REFERENCE_COUNT INTEGER Total number of jobs where the Network File System (NFS) Version 4 server
job is holding a generic reference on the object on behalf of a client.
Example
• Determine how /usr/test is currently being used.
IFS_OBJECT_STATISTICS ( start-path-name
START_PATH_NAME =>
, subtree-directories
SUBTREE_DIRECTORIES =>
, object-type-list
OBJECT_TYPE_LIST =>
, omit-list
OMIT_LIST =>
)
, ignore-errors
IGNORE_ERRORS =>
start-path- An expression that returns a path name for starting the search. A relative path name is
name relative to the current directory. If an absolute path name is not specified, the current
working directory is used in combination with the relative path name to resolve to the
object.
subtree- An expression that indicates whether all subdirectories should be recursively processed
directories or not.
object-type- A list of one or more object types that should be returned. One or more blanks separate
list multiple values. The default is the empty string, indicating all objects are returned.
Values include all the standard system object types, for example *PGM or *STMF, and
the following special values:
*ALLSTMF Select all stream file object types. This includes *MBR, *DOC, *STMF,
*DSTMF, and *USRSPC object types.
*MBR Select all database file member types.
omit-list A character string containing one or more path names to exclude from processing. All
objects and sub directories accessed from this path are excluded as well. The default is
the empty string, indicating no path names are excluded from processing.
The root path ('/') must not be included in the list. If more than one path is provided, the
values are separated by one or more blanks. If a blank exists in a path name, the path
name must be enclosed in either apostrophes (') or quotes("). When delimiting a path
name and there is an apostrophe or quote (matching the enclosing character) in the path
name, the embedded character needs to be doubled. For example, the following are valid
path strings.
• One path name. No delimiter needed:
/dir1/dir2/content
• Two path names. No delimiter needed:
/dir1/content /dir1/dir3
• Blank in path name, path delimited with apostrophes:
'/dir1/content string'
• Two path names. Blank and apostrophe in first path. First path name is delimited with
apostrophes and the apostrophe in the name is doubled. Second path is does not need
to be delimited:
'/dir1/dir2/my file''s content' /dir4/test'123
• Two path names. Blank and apostrophe in first path. First path name is delimited with
quotes. Second path is delimited even though not required:
"/dir1/dir2/my file's content" "/dir4/test'123"
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 143. IFS_OBJECT_STATISTICS table function
PATH_NAME DBCLOB(16M) CCSID The path name of an integrated file system object.
1200
ASP_NUMBER INTEGER The auxiliary storage pool (ASP) in which the object is stored.
Contains the null value if the object does not reside on this IBM i.
FILE_IDENTIFIER_NUMBER BIGINT The file identifier number of the object. This number uniquely identifies the
object with a file system.
The file identifier number, generation identifier, and file system identifier
used together uniquely identify the object on the system.
FILE_SYSTEM_IDENTIFIER BIGINT The file system ID to which the object belongs. This number uniquely
identifies the file system to which the object belongs.
The file identifier number, generation identifier, and file system identifier
used together uniquely identify the object on the system.
FILE_ACCESS BINARY(4) Bit string containing information including the file type and file mode
ACCESS_TIMESTAMP TIMESTAMP(0) The time that the object's data was last accessed.
Contains the null value if the object has never been accessed.
DATA_CHANGE_TIMESTAMP TIMESTAMP(0) The time that the object's data was last changed.
Contains the null value if the object's data has never been changed.
OBJECT_CHANGE_TIMESTAMP TIMESTAMP(0) The time that the object's data or attributes were last changed.
Contains the null value if the object's data or attributes have never been
changed.
DAYS_USED_COUNT INTEGER The number of days an object has been used. Usage has different meanings
according to the specific file system and according to the individual object
types supported within a file system. Usage can indicate the opening or
closing of a file or can refer to adding links, renaming, restoring, or checking
out an object. This count is incremented once each day that an object is
used and can be reset.
LAST_RESET_TIMESTAMP TIMESTAMP(0) The timestamp when the days used count was last reset to zero.
Contains the null value if the days used count has never been reset.
ALLOCATED_SIZE BIGINT The number of bytes that have been allocated for this object.
DATA_SIZE BIGINT The size, in bytes, of the data in this object. This size does not include object
headers or the size of extended attributes associated with the object.
CCSID INTEGER The CCSID of the data and extended attributes of the object.
Contains the null value if there is no CCSID.
CODE_PAGE INTEGER The code page derived from the coded character set identifier (CCSID) used
for the data in the file or the extended attributes of the directory.
Contains the null value if there is more than one code page or if the CCSID is
not a supported CCSID.
CRITICAL_EXTENDED_ATTRIBUTE_COUNT BIGINT Number of critical extended attributes associated with this object.
OBJECT_READ_ONLY VARCHAR(3) Whether the object can be written to or deleted, have its extended
attributes changed or deleted, or have its size changed.
OBJECT_HIDDEN VARCHAR(3) Whether the object can be displayed using an ordinary directory listing.
SYSTEM_FILE VARCHAR(3) Whether the object is a system file and is excluded from normal directory
searches.
SYSTEM_USAGE VARCHAR(6) Whether the file has a special use by the system.
VRTVOL The file is a virtual volume. Examples include tape and optical
virtual volumes.
DEVICE_SPECIAL_FILE BIGINT It the object is a device special file, the real device it represents.
Contains the null value if this is not a device special file.
OBJECT_OWNER VARCHAR(10) The name of the user profile that is the owner of the object. Can contain the
following special value:
PRIMARY_GROUP VARCHAR(10) The name of the user profile that is the primary group of the object. Can
contain the following special value:
GROUP_ID_NUMBER BIGINT Group ID (GID) number of the user profile that is the primary group of the
object.
Contains the null value if the object has no primary group.
AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list that is used to secure the named object.
Contains the null value if no authorization list is used in determining
authority to the object.
YES The object owner is the effective user ID (UID) at execution time.
YES If the object is a file, the group ID (GID) is set at execution time. If
the object is a directory, the group ID (GID) of objects created in the
directory is set to the GID of the parent directory.
AUTHORITY_COLLECTION_VALUE VARCHAR(10) Specifies the authority collection value used for the object when authority
collection for objects is active.
*ALL Audit all access to this object by all users on the system. All
access is defined as a read or change operation.
*CHANGE Audit all change access to this object by all users on the
system.
*USRPRF Audit this object only if the current user is being audited. The
current user is tested to determine if auditing should be done
for this object. The user profile can specify if only change
access is audited or if both read and change accesses are
audited for this object.
Contains the null value if the user is not allowed to retrieve the current
auditing value.
OBJECT_AUDIT_CREATE VARCHAR(7) The create object auditing value associated with the directory. This is the
auditing value given to any objects created in the directory.
*ALL Audit all access to this object by all users on the system. All
access is defined as a read or change operation.
*CHANGE Audit all change access to this object by all users on the
system.
*SYSVAL The object auditing value for the objects created in the
directory is determined by the system auditing value
(QCRTOBJAUD).
*USRPRF Audit this object only if the current user is being audited. The
current user is tested to determine if auditing should be done
for this object. The user profile can specify if only change
access is audited or if both read and change accesses are
audited for this object. The OBJAUD parameter of the Change
User Auditing (CHGUSRAUD) command is used to change the
auditing for a specific user.
Contains the null value if the user is not allowed to retrieve the current
create object auditing value.
JOURNAL_LIBRARY VARCHAR(10) The name of the library containing the journal currently being used .
Contains the null value if the object is not journaled.
JOURNAL_BEFORE_IMAGE VARCHAR(3) Indicates whether the image of the object before a change is journaled
when journaling is active.
Contains the null value if the object has never been journaled.
JOURNAL_AFTER_IMAGE VARCHAR(3) Indicates whether the image of the object after a change is journaled when
journaling is active.
Contains the null value if the object has never been journaled.
JOURNAL_START_TIMESTAMP TIMESTAMP(0) The timestamp when the object had most recently had journaling started for
it.
Contains the null value if the object has never been journaled.
JOURNAL_OPTIONAL_ENTRIES VARCHAR(3) When journaling is active, entries that are considered optional are journaled.
The list of optional journal entries varies for each object type. See
Integrated file system for information regarding these optional entries for
various objects.
Contains the null value if the object has never been journaled.
JOURNAL_SUBTREE VARCHAR(3) Indicates whether this object is a directory or library with inherit journal
semantics.
Contains the null value if the object has never been journaled.
Contains the null value if the object has never been journaled.
APPLY_STARTING_RECEIVER_LIBRARY VARCHAR(10) The name of the library that contains the journal receiver.
Contains the null value if the object has never been journaled.
APPLY_STARTING_RECEIVER VARCHAR(10) The oldest journal receiver needed to successfully Apply Journaled Changes
(APYJRNCHG). If PARTIAL_TRANSACTION has a value of Y, the journal
receiver contains the journal entries representing the start of the partial
transaction. Otherwise; the journal receiver contains the journal entries
representing the start-of-the-save operation.
Contains the null value if PARTIAL_TRANSACTION has a value of R. Also
contains the null value if the object has never been journaled.
APPLY_STARTING_RECEIVER_ASP VARCHAR(10) The name of the ASP for the library that contains the starting journal
receiver. Can contain the special value *SYSBAS.
Contains the null value if the object has never been journaled.
SYSTEM_TRUSTED_SOURCE VARCHAR(3) Whether the object was signed by a source that is trusted by the system.
YES The object was signed by a source that is trusted by the system.
If the object has multiple signatures, at least one of the signatures
came from a source that is trusted by the system.
MULTIPLE_SIGNATURES VARCHAR(3) Whether an object has more than one digital signature.
AUX_STORAGE_ALLOCATION VARCHAR(8) Determines how auxiliary storage is allocated by the system for the
specified object.
AUX_STORAGE_OVERFLOW VARCHAR(3) Whether the object has overflowed the auxiliary storage pool it resides in.
MAIN_STORAGE_ALLOCATION VARCHAR(8) Determines how main storage is allocated by the system for the specified
object.
STORAGE_FREED VARCHAR(3) Whether the object's data has been moved offline, freeing its online storage.
STORED_LOCAL VARCHAR(3) Indicates whether an object is stored locally or stored on a remote system.
The decision of whether a file is local or remote varies according to the
respective file system rules. Objects in file systems that do not carry either a
local or remote indicator are treated as remote.
VIRTUAL_DISK_STORAGE VARCHAR(3) Whether the object is the storage which was allocated for Integrated
xSeries servers to use as virtual disk drives for the xSeries servers.
*TYPE1 The directory has the original directory format. The Convert
Directory (CVTDIR) command may be used to convert from the
*TYPE1 format to the *TYPE2 format.
*TYPE1 The object has the same format as *STMF objects created
on releases prior to V4R4. It has a minimum object size of
4096 bytes and a maximum object size of approximately 128
gigabytes.
UDFS_FILE_FORMAT CHAR(6) The default file format of stream files (*STMF) created in the user-defined
file system.
*TYPE1 The stream file (*STMF) has the same format as *STMFs created
on releases prior to V4R4. It has a minimum object size of
4096 bytes and a maximum object size of approximately 128
gigabytes.
UDFS_PREFERRED_STORAGE CHAR(3) The preferred storage media for the objects in the UDFS.
Contains the null value if the preferred storage media is not known.
UDFS_TEMPORARY_OBJECT VARCHAR(3) Whether the objects in the UDFS are temporary objects.
CASE_SENSITIVE_FILE_SYSTEM VARCHAR(3) The case sensitivity of the file system that contains this object.
RESTRICT_RENAME_AND_UNLINK VARCHAR(3) Restricted renames and unlinks for objects within a directory. Objects can
be linked into a directory that has this attribute set on, but cannot be
renamed or unlinked from it unless one or more of the following are true for
the user performing the operation:
• The user is the owner of the object.
• The user is the owner of the directory.
• The user has *ALLOBJ special authority.
PC_ARCHIVE VARCHAR(3) Whether the object has changed since the last time it was saved on the PC.
SYSTEM_ARCHIVE VARCHAR(3) Whether the object has changed and needs to be saved on the IBM i. The
value will be YES when an object's change time is updated, and set to NO
when the object has been saved.
NO The object has not changed and does not need to be saved.
NO This object will not be saved when using the Save Object (SAV)
command or the QsrSave() API.
Additionally, if this object is a directory, none of the objects in
the directory's subtree will be saved unless they were explicitly
specified as an object to be saved.
YES This object will be saved when using the Save Object (SAV)
command or the QsrSave() API.
SYSTEM_RESTRICT_SAVE VARCHAR(3) Whether the system prevents the object from being saved.
NO The system does not prevent the object from being saved.
YES The system has determined that the object cannot be saved
because of system restrictions.
INHERIT_ALLOW_CHECKPOINT_WRITER VARCHAR(3) Whether new objects created within a directory should inherit the save-
while-active checkpoint processing options of its parent.
NO New directory objects created within this directory will have the
QP0L_ATTR_INHERIT_ALWCKPWRT attribute set to NO.
New objects created within this directory will
have the QP0L_ATTR_ALWCKPWRT attribute set to
QP0L_NOT_ALWCKPWRT.
YES New directory objects created within this directory will have the
QP0L_ATTR_INHERIT_ALWCKPWRT attribute set to YES.
New objects created within this directory will have the
QP0L_ATTR_ALWCKPWRT attribute set to QP0L_ALWCKPWRT.
ALLOW_WRITE_DURING_SAVE VARCHAR(3) If the object is a stream file, indicates whether the stream file can be shared
with readers and writers during save-while-active checkpoint processing. If
the object is a directory, indicates whether links can be added, removed, or
renamed in the directory during a save-while-active operation.
EXIT_PROGRAM_SCAN VARCHAR(11) Whether the object will be scanned when exit programs are registered with
any of the integrated file system scan-related exit points.
EXIT_PROGRAM_SCAN_DIRECTORY VARCHAR(11) Whether the objects created in a directory will be scanned when exit
programs are registered with any of the integrated file system scan-related
exit points.
NOT The object does not require any scanning because the
REQUIRED object is marked to not be scanned.
REQUIRED A scan is required for the object either because it has not
yet been scanned by the scan-related exit programs, or
because the object data or CCSID has been modified since
it was last scanned.
CCSID_SCAN INTEGER A CCSID value that the object has been scanned in if it was previously
scanned in a CCSID. If SCAN_STATUS is SUCCESS, the object was
successfully scanned in this CCSID. If SCAN_STATUS is FAILURE, the object
failed the scan in this CCSID.
Contains the null value if no CCSID applies.
CCSID_SCAN_SUCCESS INTEGER If SCAN_STATUS is SUCCESS, the object was successfully scanned in this
CCSID.
Contains the null value if the SCAN_STATUS is FAILURE or if CCSID_SCAN is
the null value.
SCAN_SIGNATURES_DIFFERENT VARCHAR(3) When an object is in an independent ASP group, the object scan signature
is compared to the associated independent ASP group scan signature. When
an object is not in an independent ASP group, the object scan signature is
compared to the global scan signature value.
BINARY_SCAN VARCHAR(3) The object was scanned in binary mode when it was previously scanned.
CHECKED_OUT_USER VARCHAR(10) The user who has the object checked out.
Contains the null value if the object is not checked out.
Example
• List basic information for all the objects in directory /usr.
• List basic information for all the objects in /usr, processing all subdirectories as well.
IFS_READ ( path-name
IFS_READ_UTF8
, maximum-line-length
MAXIMUM_LINE_LENGTH =>
, end-of -line
END_OF_LINE =>
)
, ignore-errors
IGNORE_ERRORS =>
path-name An expression that returns the path name identifying the stream file to read. A relative
path name is relative to the current directory. If an absolute path name is not specified,
the current working directory is used in combination with the relative path name to
resolve to the object. If the object is not a stream file, an error is issued.
maximum- An integer value that specifies the maximum number of characters returned for each line.
line-length It must be greater than 0. The default is 2 gigabytes.
If end-of-line is NONE or if no end of line sequence is found in the stream file, the number
of characters returned for each line will be limited to this value.
If an end of line sequence is encountered before this length is reached, the line will end
at that point. The next line returned will start with the character directly after the end of
line sequence.
end-of-line A character or graphic string that specifies the end of line characters to be recognized in
the stream file. Each occurrence of an end of line sequence determines a line which is
returned. The end of line character sequence is not returned with the line. When using
IFS_READ_BINARY, end of line characters are never processed, so this parameter must
have a value of NONE.
The carriage-return character is always X'0D'. Based on the CCSID of the stream file being
read, the line feed character is X'25' for an EBCDIC CCSID and X'0A' for ASCII and UTF-8
CCSIDs.
ANY Any of the four end of line sequences indicate the end of a line. This is the
default for IFS_READ and IFS_READ_UTF8.
CR A carriage return indicates the end of a line.
CRLF A carriage return and line feed indicate the end of a line.
LF A line feed indicates the end of a line.
LFCR A line feed and carriage return indicate the end of a line.
NONE No end of line characters are recognized. maximum-line-length determines the
number of characters to be returned. This is the default for IFS_READ_BINARY.
NO An error is returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 144. IFS_READ table function
For IFS_READ_BINARY: • For IFS_READ_BINARY, the data from the stream file will be returned exactly
BLOB(2G) as it is stored without conversion.
• For IFS_READ_UTF8, the data from the stream file will be returned in CCSID
For IFS_READ_UTF8: 1208.
CLOB(2G) CCSID 1208
Example
• Read the data from stream file /usr/file1. Break lines when a carriage return/line feed sequence is
encountered. The result will be in the job's CCSID.
• Read the data from stream file /usr/file2. If the file size is less than 2 gigabytes, the result will be a
single row containing the entire file. If the file size is greater than 2 gigabytes, multiple rows will be
returned.
IFS_RENAME ( from-object
FROM_OBJECT =>
, to-object
TO_OBJECT =>
)
, replace
REPLACE =>
from-object A character string containing the path of the file or directory to be renamed.
to-object A character string containing the new path name for the file or directory. If to-object exists,
from-object and to-object must both be files or must both be directories.
replace A character string that indicates whether an existing file or directory is replaced.
NO An existing file or directory will not be replaced. If it already exists, the rename
request will fail. This is the default.
YES An existing file or directory will be replaced.
The result of the function is an integer. If the replace is successful, the function returns a value of 0. If the
replace returns an error, the function returns the errno value from the API.
Note
This function is provided in the SYSTOOLS schema as an example of how to embed a C language interface
in an SQL scalar function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can
be extracted and used as a model for building similar helper functions, or to create a customized version
within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Rename /usr/resultfile.txt to /usr/resultfileyymmdd.txt, where yymmdd is today's date.
VALUES SYSTOOLS.IFS_RENAME(
FROM_OBJECT => '/usr/resultfile.txt',
TO_OBJECT => '/usr/resultfile' concat
varchar_format(current date, 'YYMMDD') concat
'.txt',
REPLACE => 'NO'
);
IFS_UNLINK ( path-name )
PATH_NAME =>
Example
Unlink file /usr/reportdata.txt.
IFS_WRITE_UTF8
, line
LINE => , file-ccsid
FILE_CCSID =>
, overwrite
OVERWRITE =>
)
, end-of-line
END_OF_LINE =>
path- A character or graphic string that defines the path name for the file to be written. If an
name absolute path name is not specified, the current working directory is used in combination
with the relative path name to resolve to the object.
If path-name identifies an existing object, the object must be a stream file. Otherwise, a
stream file will be created.
When a stream file is created, the default authority for the parent directory is used.
line A character or graphic string containing the data to be written to the stream file at path-
name. It can be up to 2 gigabytes long.
• For IFS_WRITE, line is a character string in the job CCSID. If the stream file is not in the
job CCSID, line will be converted to the stream file's CCSID as it is written.
• For IFS_WRITE_BINARY, line is a binary string. The data will not be converted when
writing to the stream file.
• For IFS_WRITE_UTF8, line is a UTF-8 string. If the stream file is not UTF-8, line will be
converted to the stream file's CCSID as it is written.
file-ccsid An integer value that specifies the CCSID to be used when creating a new stream file. This
parameter is ignored when appending to an existing file.
If this parameter is not specified, the default is 1208 for IFS_WRITE_UTF8 and 0 for
IFS_WRITE and IFS_WRITE_BINARY.
When file-ccsid is 0, the job CCSID is used when creating a new stream file.
overwrite A character or graphic string that specifies whether the write operation appends to the
stream file, replaces the stream file, or fails when a stream file with the specified name
already exists.
APPEND The data in line is added to the end of the existing stream file. If the stream file
does not exist, it is created. This is the default.
NONE The write operation fails if the stream file exists.
REPLACE The data in line replaces the existing stream file if it exists. An existing stream
file is deleted and a new stream file is created. The CCSID of the stream file
might change. If the stream file does not exist, it is created.
Examples
• Create a stream file which contains a list of all of the libraries on the system, one per line. The file is
created in job CCSID.
BEGIN
-- Make sure output file is empty to start
CALL QSYS2.IFS_WRITE(PATH_NAME =>'/tmp/library_names',
LINE => '',
OVERWRITE => 'REPLACE',
END_OF_LINE => 'NONE');
The QSYS2.IFS_READ table function can be used to read the contents of the generated stream file.
• Create a UTF-8 (CCSID 1208) stream file which contains a UTF-8 Byte Order Mark (BOM) and the string
'Hello'.
SERVER_SHARE_INFO view
The SERVER_SHARE_INFO view returns information about IBM i NetServer shares.
This information is similar to what is returned by the List Server Information (QZLSLSTI) and Open List of
Server Information (QZLSOLST) APIs.
Authorization: None required.
The following table describes the columns in the view. The system name is SHARE_INFO. The schema is
QSYS2.
ENCRYPTION_REQUIRED ENCRYPTION VARCHAR(3) Whether the server requires access to the share
to use encryption.
The following columns can contain values when SHARE_TYPE is FILE. They will contain the null value when SHARE_TYPE is PRINT.
PATH_NAME PATH_NAME DBCLOB(16M) CCSID The file share path in the integrated file system.
1200
Contains the null value when SHARE_TYPE is
Nullable PRINT.
*RW Read/write
TEXT_CONVERSION_ENABLED TEXT_CONV VARCHAR(5) Whether the server enables text file data
conversion for this file share.
Nullable
MIXED Text conversion enabled and mixed
data is allowed
TEXT_CONVERSION_CCSID TEXT_CCSID INTEGER The CCSID that is used for text file data
conversion. If the value is 0, no CCSID was
Nullable specified so the IBM i NetServer's default CCSID
will be used.
Contains the null value if
TEXT_CONVERSION_ENABLED is NO or when
SHARE_TYPE is PRINT.
The following columns can contain values when SHARE_TYPE is PRINT. They will contain the null value when SHARE_TYPE is FILE.
SPOOLED_FILE_TYPE SPOOL_TYPE VARCHAR(9) The type of spooled files that will be created using
this print share.
Nullable
AFP Advanced Function Presentation
PRINT_DRIVER PRT_DRIVER VARCHAR(50) The text string that identifies the print driver
appropriate for this print share. When personal
Nullable computers connect to this shared printer, this
identifies the print driver they should use.
This text should match the name of a print
driver known to the personal computer operating
system.
Contains the null value when there is no print
driver or when SHARE_TYPE is FILE.
Example
• List all the file shares.
Java Services
This view and procedure provide Java information and JVM management options.
JVM_INFO ( )
wait-time
WAIT_TIME =>
wait- An integer value that provides the amount of time to wait, in seconds, for a JVM to return
time information. Valid values are 1 to 120.
Values other than 1, 2, 3, 4, 5, 10, 30, 60, and 120 will be rounded up to the next higher value.
The default is 3 seconds.
When a timeout occurs, values are returned for the job name columns and the PROCESS_ID
column.
JOB_NAME VARCHAR(28) The qualified job name for the active JVM.
JOB_NAME_SHORT VARCHAR(10) The name of the job for the active JVM.
JOB_USER VARCHAR(10) The user profile that started the job for the active JVM.
JOB_NUMBER VARCHAR(6) The job number of the job for the active JVM.
PROCESS_ID INTEGER The process identifier used by the kernel to uniquely identify the process.
START_TIME TIMESTAMP The current time when the JVM was started.
INITIAL_THREAD_TASKCOUNT BIGINT The taskcount or TDE number of the JVM's initial thread. The taskcount or
TDE number is a unique identifier assigned to each job, thread, and task
running in the system.
JAVA_THREAD_COUNT BIGINT The current number of java threads within the JVM job.
TOTAL_GC_TIME BIGINT Total time spent performing garbage collection tasks in milliseconds.
CCSID 1200
JAVA_HOME VARGRAPHIC(1024) The java.home environment variable value in effect for this JVM.
CCSID 1200 This value indicates the JDK that is used when running a Java application.
The location of the Java tools and utilities is in one of two directories, either
<JAVA_HOME>/jre/bin or <JAVA_HOME>/bin, where <JAVA_HOME> is the
value of the JAVA_HOME environment variable. For example, if JAVA_HOME
is set to /QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit, indicating that IBM
Technology for Java 6 32-bit is to be used, then the Java tools and utilities
directories would be:
/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/bin
/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre/bin
CCSID 1200 This also indicates the location where diagnostic detail will be dumped for the
JVM.
INITIAL_HEAP_SIZE BIGINT The initial heap size available to the JVM code, in kilobytes.
CURRENT_HEAP_SIZE BIGINT The amount of memory, in kilobytes, currently allocated for heap space.
IN_USE_HEAP_SIZE BIGINT The amount of memory, in kilobytes, currently in use by the heap.
MAX_HEAP_SIZE BIGINT The maximum heap size available to the JVM code, in kilobytes.
MALLOC_MEMORY_SIZE BIGINT The amount of memory, in kilobytes, that has been allocated with malloc().
INTERNAL_MEMORY_SIZE BIGINT The amount of memory, in kilobytes, that the JVM is using for internal
operations.
JIT_MEMORY_SIZE BIGINT The size of the memory space, in kilobytes, that is used by the JIT (Just in
Time) compiler.
SHARED_CLASS_SIZE BIGINT The amount of memory, in kilobytes, that the JVM is using for shared classes.
Example
• Show information for all JVMs on the system. Do not wait longer than 10 seconds for the results of any
individual JVM to be returned.
System Column
Column Name Name Data Type Description
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name for the active JVM.
JOB_NAME_SHORT JOB_NAME_S VARCHAR(10) The name of the job for the active JVM.
JOB_USER JOB_USER VARCHAR(10) The user profile that started the job for the active JVM.
JOB_NUMBER JOB_NUMBER VARCHAR(6) The job number of the job for the active JVM.
PROCESS_ID PROCESS_ID INTEGER The process identifier used by the kernel to uniquely identify the
process.
START_TIME START_TIME TIMESTAMP The current time when the JVM was started.
INITIAL_THREAD_TASKCOUNT INITTHDNUM BIGINT The taskcount or TDE number of the JVM's initial thread. The
taskcount or TDE number is a unique identifier assigned to each
job, thread, and task running in the system.
JAVA_THREAD_COUNT JAVATHDNUM BIGINT The current number of java threads within the JVM job.
TOTAL_GC_TIME ACCUMTIME BIGINT Total time spent performing garbage collection tasks in
milliseconds.
GC_CYCLE_NUMBER GCCYCLE INTEGER The current or last garbage collection cycle performed.
GC_POLICY_NAME GCPOLICY VARGRAPHIC(16) The name of the garbage collection policy in use.
CCSID 1200
JAVA_HOME JAVA_HOME VARGRAPHIC(102 The java.home environment variable value in effect for this JVM.
4)
This value indicates the JDK that is used when running a
CCSID 1200 Java application. The location of the Java tools and utilities
is in one of two directories, either <JAVA_HOME>/jre/bin or
<JAVA_HOME>/bin, where <JAVA_HOME> is the value of the
JAVA_HOME environment variable. For example, if JAVA_HOME is
set to /QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit, indicating
that IBM Technology for Java 6 32-bit is to be used, then the Java
tools and utilities directories would be:
/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/bin
/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit/jre/bin
USER_DIRECTORY USER_DIR VARGRAPHIC(102 The user working directory for the JVM.
4)
This also indicates the location where diagnostic detail will be
CCSID 1200 dumped for the JVM.
NUM_CURRENT_PROPERTIES NUMPROP INTEGER Total number of Java system properties currently present.
INITIAL_HEAP_SIZE INITHEAP BIGINT The initial heap size available to the JVM code, in kilobytes.
CURRENT_HEAP_SIZE CURHEAP BIGINT The amount of memory, in kilobytes, currently allocated for heap
space.
IN_USE_HEAP_SIZE INUSEHEAP BIGINT The amount of memory, in kilobytes, currently in use by the heap.
MAX_HEAP_SIZE MAXHEAP BIGINT The maximum heap size available to the JVM code, in kilobytes.
MALLOC_MEMORY_SIZE MALLOCSIZE BIGINT The amount of memory, in kilobytes, that has been allocated with
malloc().
INTERNAL_MEMORY_SIZE INTMEM BIGINT The amount of memory, in kilobytes, that the JVM is using for
internal operations.
JIT_MEMORY_SIZE JITSIZE BIGINT The size of the memory space, in kilobytes, that is used by the JIT
(Just in Time) compiler.
System Column
Column Name Name Data Type Description
SHARED_CLASS_SIZE SHAREDSIZE BIGINT The amount of memory, in kilobytes, that the JVM is using for
shared classes.
Example
Examine the active JVM jobs, ordered by top heap space consumption.
SET_JVM procedure
The SET_JVM procedure can be used to manage specific JVM jobs.
This actions provided by this Db2 for i procedure can also be accomplished interactively using the Work
with JVM Jobs (WRKJVMJOB) command.
Authorization: None required.
job_name A character or graphic string expression that identifies the qualified job name of the job to
change.
action A character or graphic string expression that specifies that action to perform. Supported
actions are:
Example
• Change a specific web admin JVM to provide verbose garbage collection details:
CALL QSYS2.SET_JVM('121376/QWEBADMIN/ADMIN4','GC_ENABLE_VERBOSE') ;
ASSOCIATE_JOURNAL_RECEIVER ( journal-library
JOURNAL_LIBRARY =>
, journal-name ,
JOURNAL_NAME =>
receiver-library ,
RECEIVER_LIBRARY =>
receiver-name )
RECEIVER_NAME =>
journal- A character or graphic string expression that identifies the library that contains journal-
library name. Can contain the special values *LIBL or *CURLIB.
journal-name A character or graphic string expression that identifies the name of the journal.
receiver- A character or graphic string expression that identifies the name of the library containing
library receiver-name. Can contain the special values *LIBL or *CURLIB.
receiver- A character or graphic string expression that identifies the name of the journal receiver.
name A generic name can be specified to select specific journal receivers. If the last character
in the name is an asterisk, the name is a generic name. For example, to select all journal
receivers that start with 'JR', specify a receiver-name value of 'JR*'.
The special value of *ALL can be used to select all journal receivers in receiver-library.
*ALL is not allowed if receiver-library is *LIBL.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 148. ASSOCIATE_JOURNAL_RECEIVER table function
JOURNAL_LIBRARY VARCHAR(10) The library containing the journal that the journal receiver
attempted to associate with.
JOURNAL_NAME VARCHAR(10) The journal that the journal receiver attempted to associate
with.
CCSID 1200
Example
Re-establish the association of journal APPLIB/APPJRN with journal receiver RCVRLIB/RCV001.
SELECT *
FROM TABLE(QSYS2.ASSOCIATE_JOURNAL_RECEIVER('APPLIB', 'APPJRN', 'RCVRLIB', 'RCV001'));
Examples
starting-receiver-name
STARTING_RECEIVER_NAME =>
, ending-receiver-name
ENDING_RECEIVER_NAME =>
, starting-timestamp
STARTING_TIMESTAMP =>
, ending-timestamp
ENDING_TIMESTAMP =>
, user-name
USER_NAME =>
, job , program
JOB => PROGRAM =>
, starting-sequence
STARTING_SEQUENCE =>
, ending-sequence
ENDING_SEQUENCE =>
starting-receiver-library
STARTING_RECEIVER_LIBRARY =>
)
, ending-receiver-library
ENDING_RECEIVER_LIBRARY =>
starting- A character or graphic string expression that identifies the name of the starting journal
receiver-name receiver. The special values *CURRENT, *CURCHAIN, *CURAVLCHN, and *CURSEQCHN
are supported. Otherwise, starting-receiver-name must identify a valid journal receiver.
If no journal receiver is specified, *CURAVLCHN is used.
ending- A character or graphic string expression that identifies the name of the ending journal
receiver-name receiver. The special value *CURRENT is supported. Otherwise, ending-receiver-name
must identify a valid journal receiver.
user-name A character or graphic string expression that identifies the user profile name for the
current user of the job. If user-name is not specified, *ALL is used.
job A character or graphic string expression that identifies the name of a job. Two forms of a
job name are supported:
1. A fully qualified job name in the form job-number/job-user/job-name.
2. The first 10 characters are the job name, the second 10 characters are the user
name, and the last 6 characters are the job number.
If job is not specified, *ALL is used.
program A character or graphic string expression that identifies the name of a program. If
program is not specified, *ALL is used.
starting- A decimal expression that identifies the starting sequence number to use. This is
sequence the value shown in the SEQUENCE_NUMBER column in the QSYS2.DISPLAY_JOURNAL
results. If the starting-sequence value is not found in the receiver range, an error is
returned.
A value cannot be specified for both starting-timestamp and starting-sequence.
If no starting sequence is specified, *FIRST is used.
ending- A decimal expression that identifies the ending sequence number to use. If the ending-
sequence sequence value is not found in the receiver range, an error is returned.
A value cannot be specified for both ending-timestamp and ending-sequence.
If no ending sequence is specified, *LAST is used.
When ending-sequence is used, the query results will end when the first ending
sequence value is encountered. If the journal has had its sequence numbers reset,
ending-sequence will only return results through the first match of ending-sequence.
starting- A character or graphic string expression that identifies the library that contains starting-
receiver- receiver-name.
library
ending- A character or graphic string expression that identifies the library that contains ending-
receiver- receiver-name.
library
The special values supported for the function arguments are the same as for the Display Journal
(DSPJRN) CL command.
1 The accuracy of the entry timestamp stored in journal receivers is only accurate to 16 microseconds.
Hence, a value passed as a starting-timestamp and ending-timestamp will be truncated such that the
actual timestamps being searched for may be from 0 to 15 microseconds less than the specified value.
ENTRY_TIMESTAMP TIMESTAMP The system date and time when the journal entry was added to the journal
receiver.
USER_NAME VARCHAR(10) The name of the effective user profile under which the thread was running
when the entry was created.
Contains *NONE if the effective user profile is not available.
QUALIFIED_JOB_NAME VARCHAR(28) The qualified job name that added the entry.
Contains the null value if the system job is running in a task rather than a
process.
JOB_NAME VARCHAR(10) The name of the job that added the entry.
JOB_NUMBER VARCHAR(6) The job number of the job that added the entry.
Contains the null value if the system job is running in a task rather than a
process.
THREAD BIGINT Identifies the thread within the process that added the journal entry.
Contains the null value if the system job is running in a task rather than a
process.
PROGRAM_NAME VARCHAR(10) The name of the program that caused the journal entry to be added. This
can also be the name of a service program or the partial name of a class file
used in a compiled Java program. If an application program or CL program
did not cause the entry, contains the name of a system-supplied program
such as QCMD.
Contains *NONE if one of the following conditions is true:
• The program name does not apply to this entry type.
• The program name was not available.
PROGRAM_LIBRARY_ASP_DEVICE VARCHAR(10) The name of the ASP device that contains PROGRAM_NAME.
PROGRAM_LIBRARY_ASP_NUMBER INTEGER The number for the auxiliary storage pool that contains PROGRAM_NAME.
REMOTE_PORT INTEGER The port number of the remote address associated with this journal entry.
Contains the null value if a remote port is not available.
REMOTE_ADDRESS VARCHAR(46) The remote address associated with the journal entry in IPv4 or IPv6
format.
Contains the null value if a remote address is not available.
SYSTEM_NAME VARCHAR(8) The name of the system on which the entry is being retrieved.
SYSTEM_SEQUENCE_NUMBER DECIMAL(21,0) The system sequence number which indicates the relative sequence of
when this journal entry was deposited into the journal.
RECEIVER_NAME VARCHAR(10) The name of the receiver holding the journal entry.
RECEIVER_ASP_NUMBER INTEGER The number for the auxiliary storage pool containing RECEIVER_NAME.
ARM_NUMBER INTEGER The number of the disk arm that contains the journal entry.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the AD audit journal entry.
D CHGDLOAUD command
U CHGUSRAUD command
OBJECT_NAME VARCHAR(10) Name of the object for which auditing was changed.
Contains the null value if there is no object name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if there is no ASP information.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
CHGUSRAUD_AUTFAIL VARCHAR(3) Write an audit record when this user has an authorization failure.
CHGUSRAUD_CREATE VARCHAR(3) Write an audit record when this user creates an object.
CHGUSRAUD_DELETE VARCHAR(3) Write an audit record when this user deletes an object.
CHGUSRAUD_JOBBAS VARCHAR(3) Write an audit record when this user performs a job base function.
CHGUSRAUD_JOBCHGUSR VARCHAR(3) Write an audit record when this user changes a thread's active user
profile or its group file.
CHGUSRAUD_JOBDTA VARCHAR(3) Write an audit record when this user changes a job.
CHGUSRAUD_NETBAS VARCHAR(3) Write an audit record when this user performs network base
functions.
CHGUSRAUD_NETCLU VARCHAR(3) Write an audit record when this user performs cluster or cluster
resource group functions.
CHGUSRAUD_NETCMN VARCHAR(3) Write an audit record when this user performs network
communications functions.
CHGUSRAUD_NETFAIL VARCHAR(3) Write an audit record when this user has a network failure.
CHGUSRAUD_NETSCK VARCHAR(3) Write an audit record when this user performs sockets tasks.
CHGUSRAUD_NETSECURE VARCHAR(3) Write an audit record when this user establishes a secure
connection.
CHGUSRAUD_NETUDP VARCHAR(3) Write an audit record for UDP inbound and outbound traffic for this
user.
CHGUSRAUD_OBJMGT VARCHAR(3) Write an audit record when this user moves or renames an object.
CHGUSRAUD_OFCSRV VARCHAR(3) Write an audit record when this user performs office functions.
CHGUSRAUD_OPTICAL VARCHAR(3) Write an audit record when this user accesses optical devices.
CHGUSRAUD_PGMADP VARCHAR(3) Write an audit record when this user obtains authority through
adopted authority.
CHGUSRAUD_PGMFAIL VARCHAR(3) Write an audit record when this user has a program failure.
CHGUSRAUD_PRTDTA VARCHAR(3) Write an audit record when this user performs a print function with
parameter SPOOL(*NO).
CHGUSRAUD_SAVRST VARCHAR(3) Write an audit record when this user saves or restores objects.
CHGUSRAUD_SECCFG VARCHAR(3) Write an audit record when this user performs security
configuration.
CHGUSRAUD_SECDIRSRV VARCHAR(3) Write an audit record when this user makes changes or updates
using directory service functions.
CHGUSRAUD_SECIPC VARCHAR(3) Write an audit record when this user makes changes to interprocess
communications.
CHGUSRAUD_SECNAS VARCHAR(3) Write an audit record when this user performs network
authentication service actions.
CHGUSRAUD_SECRUN VARCHAR(3) Write an audit record when this user performs security run time
functions.
CHGUSRAUD_SECSCKD VARCHAR(3) Write an audit record when this user performs socket descriptor
functions.
CHGUSRAUD_SECURITY VARCHAR(3) Write an audit record when this user performs security-relevant
actions.
CHGUSRAUD_SECVFY VARCHAR(3) Write an audit record when this user uses verification functions.
CHGUSRAUD_SECVLDL VARCHAR(3) Write an audit record when this user manipulates validation lists.
CHGUSRAUD_SERVICE VARCHAR(3) Write an audit record when this user performs service functions.
CHGUSRAUD_SPLFDTA VARCHAR(3) Write an audit record when this user manipulates spooled files.
CHGUSRAUD_SYSMGT VARCHAR(3) Write an audit record when this user makes systems management
changes.
PREV_CHGUSRAUD_AUTFAIL VARCHAR(3) Previous value for write an audit record when this user has an
authorization failure.
PREV_CHGUSRAUD_CMD VARCHAR(3) Previous value for audit commands for this user.
PREV_CHGUSRAUD_CREATE VARCHAR(3) Previous value for write an audit record when this user creates an
object.
PREV_CHGUSRAUD_DELETE VARCHAR(3) Previous value for write an audit record when this user deletes an
object.
PREV_CHGUSRAUD_JOBBAS VARCHAR(3) Previous value for write an audit record when this user performs a
job base function.
PREV_CHGUSRAUD_JOBCHGUSR VARCHAR(3) Previous value for write an audit record when this user changes a
thread's active user profile or its group file.
PREV_CHGUSRAUD_JOBDTA VARCHAR(3) Previous value for write an audit record when this user changes a
job.
PREV_CHGUSRAUD_NETBAS VARCHAR(3) Previous value for write an audit record when this user performs
network base functions.
PREV_CHGUSRAUD_NETCLU VARCHAR(3) Previous value for write an audit record when this user performs
cluster or cluster resource group functions.
PREV_CHGUSRAUD_NETCMN VARCHAR(3) Previous value for write an audit record when this user performs
network communications functions.
PREV_CHGUSRAUD_NETFAIL VARCHAR(3) Previous value for write an audit record when this user has a
network failure.
PREV_CHGUSRAUD_NETSCK VARCHAR(3) Previous value for write an audit record when this user performs
sockets tasks
PREV_CHGUSRAUD_NETSECURE VARCHAR(3) Previous value for write an audit record when this user establishes a
secure connection.
PREV_CHGUSRAUD_NETUDP VARCHAR(3) Previous value for write an audit record for UDP inbound and
outbound traffic for this user.
PREV_CHGUSRAUD_OBJMGT VARCHAR(3) Previous value for write an audit record when this user moves or
renames an object.
PREV_CHGUSRAUD_OFCSRV VARCHAR(3) Previous value for write an audit record when this user performs
office functions.
PREV_CHGUSRAUD_OPTICAL VARCHAR(3) Previous value for write an audit record when this user accesses
optical devices.
PREV_CHGUSRAUD_PGMADP VARCHAR(3) Previous value for write an audit record when this user obtains
authority through adopted authority.
PREV_CHGUSRAUD_PGMFAIL VARCHAR(3) Previous value for write an audit record when this user has a
program failure.
PREV_CHGUSRAUD_PRTDTA VARCHAR(3) Previous value for write an audit record when this user performs a
print function with parameter SPOOL(*NO).
PREV_CHGUSRAUD_SAVRST VARCHAR(3) Previous value for write an audit record when this user saves or
restores objects.
PREV_CHGUSRAUD_SECCFG VARCHAR(3) Previous value for write an audit record when this user performs
security configuration.
PREV_CHGUSRAUD_SECDIRSRV VARCHAR(3) Previous value for write an audit record when this user makes
changes or updates using directory service functions.
PREV_CHGUSRAUD_SECIPC VARCHAR(3) Previous value for write an audit record when this user makes
changes to interprocess communications.
PREV_CHGUSRAUD_SECNAS VARCHAR(3) Previous value for write an audit record when this user performs
network authentication service actions.
PREV_CHGUSRAUD_SECRUN VARCHAR(3) Previous value for write an audit record when this user performs
security run time functions.
PREV_CHGUSRAUD_SECSCKD VARCHAR(3) Previous value for write an audit record when this user performs
socket descriptor functions.
PREV_CHGUSRAUD_SECURITY VARCHAR(3) Previous value for write an audit record when this user performs
security-relevant actions.
PREV_CHGUSRAUD_SECVFY VARCHAR(3) Previous value for write an audit record when this user uses
verification functions.
PREV_CHGUSRAUD_SECVLDL VARCHAR(3) Previous value for write an audit record when this user manipulates
validation lists.
PREV_CHGUSRAUD_SERVICE VARCHAR(3) Previous value for write an audit record when this user performs
service functions.
PREV_CHGUSRAUD_SPLFDTA VARCHAR(3) Previous value for write an audit record when this user manipulates
spooled files.
PREV_CHGUSRAUD_SYSMGT VARCHAR(3) Previous value for write an audit record when this user makes
systems management changes.
Example
• List objects in APPLIB that had auditing changes made with the CHGOBJAUD CL command yesterday
and today.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the AF audit journal entry.
B Restricted instruction
Y Not authorized to the current JUID field during a clear JUID operation.
Z Not authorized to the current JUID field during a set JUID operation.
VALIDATION_ERROR_ACTION CHAR(1) Action taken after validation error detected, set when VIOLATION_TYPE is C
or H.
C The translation of the object was successful. The translated copy was
restored on the system.
F The object was not restored because the signature is not IBM i format.
VALIDATION_ERROR_ACTION_DETAIL VARCHAR(200) Descriptive text that corresponds to the violation error action.
Contains the null value if VIOLATION_TYPE is not C or H.
OPERATION_VIOLATION_CODE CHAR(3) The type of operation violation that occurred, set when VIOLATION_TYPE is
X.
LIC LIC indicates that a Licensed Internal Code fix was not applied
because of a signature violation.
SFA Not authorized to activate the environment attribute for system file
access.
CMD An attempt was made to use a command that has been disabled by
a system administrator.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
TCPIP_PORT INTEGER The TCP/IP port the user is not authorized to use, when VIOLATION_TYPE is
T.
Contains the null value if VIOLATION_TYPE is not T.
API_NAME VARCHAR(20) The full API name of the API or exit point name that detected the error,
when VIOLATION_TYPE is K.
Contains the null value when the VIOLATION_TYPE is not K or if there is no
API or exit point information.
PTF_NUMBER CHAR(7) The PTF number that failed to apply because of a signature violation when
the VIOLATION_TYPE is X and OPERATION_VIOLATION_CODE is LIC.
Contains the null value if VIOLATION_TYPE is not X with an
OPERATION_VIOLATION_CODE of LIC.
AAC_NAME VARCHAR(30) The Advanced Analysis Command name, when the VIOLATION_TYPE is X
and the OPERATION_VIOLATION_CODE is AAC.
Contains the null value if VIOLATION_TYPE is not X with an
OPERATION_VIOLATION_CODE of AAC.
USER_PROFILE_NAME VARCHAR(10) The name of the user that caused the authority failure.
Contains the null value if the user name is not available.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
Example
• Find any authority failures for Integrated File System (IFS) objects in the past 24 hours.
• Determine the number of 'Not authorized to object' authority failures for user BOB in the last week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the AP audit journal entry.
E End
S Start
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the program, service program, or SQL
package.
OBJECT_NAME VARCHAR(10) The name of the program, service program, or SQL package.
OBJECT_OWNER VARCHAR(10) The name of the user profile whose authority is adopted.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
Example
• Find any programs that used adopted authority today.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the AU audit journal entry.
A EIM association
When ENTRY_TYPE is E:
Example
• List the EIM configuration attributes that were changed in the last two months.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the AX audit journal entry.
M Column mask
P Row permission
T Table
ALTER Alter
CREATE Create
DROP Drop
LIBRARY_NAME VARCHAR(10) The name or the library where the file is stored.
FILE_NAME VARCHAR(10) The system name of the base table that the permission or mask is
associated with or the table being altered.
COLUMN_NAME VARCHAR(10) The name of the column to which the mask applies.
Contains the null value if ENTRY_TYPE is not M or
OPERATION_TYPE is not CREATE.
SQL_STATEMENT_TEXT VARGRAPHIC(5000) CCSID 1200 The SQL statement text for the CREATE MASK or CREATE
PERMISSION statement.
Contains the null value if ENTRY_TYPE is not M or P or
OPERATION_TYPE is not CREATE.
ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if there is no ASP information.
Example
• List any changes to active row or column access control for the last week. These are operations
performed by an ALTER TABLE statement with an ACTIVATE or DEACTIVATE option.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the CA audit journal entry.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which OBJECT_NAME
resides. A value of *SYSBAS indicates the system ASP and all basic user
ASPs.
OBJECT_ASP_NUMBER INTEGER The number of the auxiliary storage pool to which storage for
OBJECT_NAME is allocated.
GRANT Grant
REVOKE Revoke
USER_PROFILE_NAME VARCHAR(10) The name of the user profile whose authority is being granted or revoked.
Contains the null value if a user profile is not being changed.
OBJECT_ALTER VARCHAR(3) Indicates whether object alter (*OBJALTER) authority is granted or revoked.
DATA_READ VARCHAR(3) Indicates whether data read (*READ) authority is granted or revoked.
DATA_ADD VARCHAR(3) Indicates whether data add (*ADD) authority is granted or revoked.
DATA_UPDATE VARCHAR(3) Indicates whether data update (*UPD) authority is granted or revoked.
DATA_DELETE VARCHAR(3) Indicates whether data delete (*DLT) authority is granted or revoked.
DATA_EXECUTE VARCHAR(3) Indicates whether data execute (*EXECUTE) authority is granted or revoked.
PREV_AUTHORIZATION_LIST_MANAGEMEN VARCHAR(3) Indicates whether the user previously had authorization list management
T (*AUTLMGT) authority.
PREV_OBJECT_EXCLUDE VARCHAR(3) Indicates whether the user previously had exclude (*EXCLUDE) authority.
PREV_OBJECT_OPERATIONAL VARCHAR(3) Indicates whether the user previously had object operational (*OBJOPR)
authority.
PREV_OBJECT_MANAGEMENT VARCHAR(3) Indicates whether the user previously had object management (*OBJMGT)
authority.
PREV_OBJECT_EXISTENCE VARCHAR(3) Indicates whether the user previously had object existence (*OBJEXIST)
authority.
PREV_OBJECT_ALTER VARCHAR(3) Indicates whether the user previously had object alter (*OBJALTER)
authority.
PREV_OBJECT_REFERENCE VARCHAR(3) Indicates whether the user previously had object reference (*OBJREF)
authority.
PREV_DATA_READ VARCHAR(3) Indicates whether the user previously had data read (*READ) authority.
PREV_DATA_ADD VARCHAR(3) Indicates whether the user previously had data add (*ADD) authority.
PREV_DATA_UPDATE VARCHAR(3) Indicates whether the user previously had data update (*UPD) authority.
PREV_DATA_DELETE VARCHAR(3) Indicates whether the user previously had data delete (*DLT) authority.
PREV_DATA_EXECUTE VARCHAR(3) Indicates whether the user previously had data execute (*EXECUTE)
authority.
AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list that is being modified.
Contains the null value if an authorization list is not being changed.
AUTHORIZATION_LIST_PUBLIC VARCHAR(3) Indicates whether authorization list (*AUTL public authority) authority has
been granted or revoked.
PREV_AUTHORIZATION_LIST_PUBLIC VARCHAR(3) Indicates whether the user previously had authorization list (*AUTL public
authority) authority.
Contains the null value if the access code was not changed.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the CD audit journal entry.
C Command run
L OCL statement
P S/36 procedure
X Proxy command
OBJECT_LIBRARY VARCHAR(10) The name of the library where the object is stored.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
B In a batch job but not for any of the reason listed under Y, R, or E.
Typical case would be that the CL command was run using STRDBRDR
or SBMDBJOB command or was specified on the CMD parameter of
the SBMJOB command.
WHERE_RUN_DETAIL VARCHAR(200) Descriptive text that corresponds to where the CL command was run.
Example
• List any change commands that were run this week.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_CD (STARTING_TIMESTAMP => CURRENT TIMESTAMP - 7 DAYS)
)
WHERE ENTRY_TYPE = 'C' AND
OBJECT_LIBRARY = 'QSYS' AND
OBJECT_NAME LIKE 'CHG%' ;
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the CO audit journal entry.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
Example
• Find the objects created in APPLIB in the last 2 months.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the CP audit journal entry.
LOCAL_PASSWORD_MANAGEMENT VARCHAR(4) Specifies whether the user profile password should be managed locally.
PASSWORD_CONFORMANCE VARCHAR(8) Indicates whether the new password conforms to the password
composition rules.
*NONE Not checked; *NONE was specified for the new password.
BLOCK_PASSWORD_CHANGE VARCHAR(7) Specifies the value that the block password change has been changed to.
PASSWORD_EXPIRATION_INTERVAL VARCHAR(7) Specifies the value that the password expiration interval has been changed
to.
USER_EXPIRATION_DATE VARCHAR(10) Specifies the date when the user profile expires. The user profile is
automatically disabled or deleted on this date. Can contain the special value
*NONE to indicate the user profile does not expire.
Contains the null value if the value was not changed.
USER_EXPIRATION_ACTION CHAR(3) The action performed on the profile when it expires. This value is always
DSB when using the CRTUSRPRF and CHGUSRPRF commands. When using
the CHGEXPSCDE command, this value is one of the following values.
OWNED_OBJECT_OPTION VARCHAR(7) The type of operation performed on the objects owned by the expiring
profile. The owned object option value is specified on the OWNOBJOPT
parameter of the CHGEXPSCDE ACTION(*DELETE) command.
*CHGOWN The owned objects for the user profile have ownership
transferred to the new owner user profile. The user profile
is deleted if the transfer of all owned objects is successful.
*DLT The owned objects for the user profile are deleted. The
user profile is deleted if the deletion of all owned objects
is successful.
*NODLT The owned objects for the user profile are not changed, and
the user profile is not deleted if the user owns any objects.
OWNED_OBJECT_OPTION_NEW_OWNER VARCHAR(10) The profile that will own all of the objects owned by the expiring profile.
Contains the null value if OWNED_OBJECT_OPTION is not *CHGOWN or if
the value was not changed.
PRIMARY_GROUP_OPTION VARCHAR(7) The type of operation performed on the objects that have the expiring
user profile as their primary group. The primary group option value is
specified on the PGPOPT parameter of the CHGEXPSCDE ACTION(*DELETE)
command.
*CHGPGP The objects the user profile is the primary group for are
transferred to the new primary group user profile. The user
profile is deleted if the transfer of all objects is successful.
*NOCHG The objects the user profile is the primary group for do not
change, and the user profile is not deleted if the user is the
primary group for any objects.
NEW_PRIMARY_GROUP VARCHAR(10) The profile that will become the new primary group of the objects for which
the expiring profile is the primary group. Can contain the following special
value:
*NONE All of the objects for which the expiring user is the primary group
will no longer have a primary group.
NEW_PRIMARY_GROUP_AUTHORITY VARCHAR(8) The authority the new primary group has to the object.
*ALL The new primary group has *ALL authority to the object.
*CHANGE The new primary group has *CHANGE authority to the object.
*OLDPGP The new primary group has the same authority to the object
as the old primary group.
*PRIVATE The new primary group has the same authority to the object
as its private authority to the object was.
*USE The new primary group has *USE authority to the object.
*PGMR Programmer
*USER User
SPECIAL_AUTHORITIES VARCHAR(72) Current list of special authorities. This is a single string containing the list of
special authorities separated by one blank.
Contains the null value if the value was not changed.
PREVIOUS_SPECIAL_AUTHORITIES VARCHAR(72) Previous list of special authorities. This is a single string containing the list
of special authorities separated by one blank.
Contains the null value if the value was not changed.
GROUP_PROFILE_NAME VARCHAR(10) The user's group profile. Can contain the special value *NONE to indicate
the user is not a member of any group profiles.
Contains the null value if the value was not changed.
GROUP_AUTHORITY VARCHAR(8) The authority the user's group profile has to objects the user creates.
*PGP The group becomes the object's primary group and is given
the authority specified in GROUP_AUTHORITY.
SUPPLEMENTAL_GROUP_LIST VARCHAR(150) The names of up to 15 supplemental group profiles for the user. Can
contain the special value *NONE to indicate the user has no supplemental
groups. Each entry except for the last one is padded with blanks to fill 10
characters.
Contains the null value if the value was not changed.
INITIAL_PROGRAM_LIBRARY VARCHAR(10) The library where the initial program is found. Can contain the special value
*LIBL.
Contains the null value if INITIAL_PROGRAM is *NONE or if the value was
not changed.
INITIAL_PROGRAM VARCHAR(10) The user's initial program. Can contain the special value *NONE to indicate
the user has no initial program.
Contains the null value if the value was not changed.
INITIAL_MENU_LIBRARY VARCHAR(10) The library where the initial menu is found. Can contain the special value
*LIBL.
Contains the null value if INITIAL_MENU is *SIGNOFF or if the value was
not changed.
INITIAL_MENU VARCHAR(10) The user's initial menu. Can contain the special value *SIGNOFF to indicate
the user is limited to running the initial program specified for this profile.
Contains the null value if the value was not changed.
CURRENT_LIBRARY_NAME VARCHAR(10) The user's current library. Can contain the special value *CRTDFT to indicate
the user has no current library.
Contains the null value if the value was not changed.
HOME_DIRECTORY VARGRAPHIC(5000) Path name of the home directory or the following special value:
CCSID 1200
*USRPRF The home directory assigned to the user will be /home/
USRPRF, where USRPRF is the name of the user profile.
LOCALE_PATH_NAME VARGRAPHIC(5000) Path name of the locale or one of the following special values:
CCSID 1200
*C The C locale path name is assigned to this user.
*NO No limitations.
*PARTIAL The user can change the initial menu, but cannot change
the initial program, current library, or attention key handling
program. The user can run commands from command lines.
*YES The user cannot change the initial program, initial menu,
current library, and attention key handling programs. The user
cannot run commands from command lines.
USER_OPTIONS VARCHAR(70) The level of help information detail to be shown and the default function
of the Page Up and Page Down keys. This column can contain up to seven
values, each ten characters long.
*NOSTSMSG Status messages are not displayed when sent to the user.
*ROLLKEY The actions of the Page Up and Page Down keys are
reversed.
SPECIAL_ENVIRONMENT VARCHAR(7) The special environment in which the user operates after signing on.
LIMIT_DEVICE_SESSIONS VARCHAR(7) The number of device sessions allowed for a user is limited.
KEYBOARD_BUFFERING VARCHAR(10) The keyboard buffering value to be used when a job is initialized for this
user profile.
MAXIMUM_ALLOWED_STORAGE BIGINT The amount of auxiliary storage (in kilobytes) assigned to store permanent
objects owned by this user profile in the system auxiliary storage pool (ASP)
and on all the basic ASPs combined. In addition, this value also controls the
maximum amount of auxiliary storage that can be used to store permanent
objects owned by this user profile on each Independent ASP (IASP). A value
of -1 indicates *NOMAX.
Contains the null value if the value was not changed.
PRIORITY_LIMIT INTEGER The value of the priority limit parameter. Values are 0 to 9.
Contains the null value if the value was not changed.
JOB_DESCRIPTION_LIBRARY VARCHAR(10) The library where the job description is found. Can contain the special value
*LIBL.
Contains the null value if the value was not changed.
JOB_DESCRIPTION VARCHAR(10) The job description used for jobs that start through subsystem work
station entries whose job description parameter values indicate the user
JOBD(*USRPRF).
Contains the null value if the value was not changed.
ALTERNATE_SUBSYSTEM_NAME VARCHAR(10) The alternative subsystem that will be used for this user, instead of the
default subsystem, whenever a connection is initiated to the server job
specified in ALTERNATE_SERVER_JOB_NAME.
Contains the null value when COMMAND_TYPE is not SQL or if the value was
not changed.
ALTERNATE_SERVER_JOB_NAME VARCHAR(10) When a connection to this server is initiated for this user it will be routed to
the subsystem specified in the ALTERNATIVE_SUBSYSTEM_NAME column.
Can contain the special value *ALL.
To understand the Server Job Name mapping to server names and the
default subsystem use, see Server table.
Contains the null value when COMMAND_TYPE is not SQL or if the value was
not changed.
ACCOUNTING_CODE VARCHAR(15) The accounting code that is associated with this user profile or the following
special value:
MESSAGE_QUEUE_LIBRARY VARCHAR(10) The library where the message queue is found. Can contain the special
value *LIBL.
Contains the null value if the value was not changed.
MESSAGE_QUEUE VARCHAR(10) The message queue to which messages are sent or the following special
value:
*USRPRF A message queue with the same name as the user profile is
used as the message queue for this user. The message queue
is located in the QUSRSYS library.
MESSAGE_QUEUE_DELIVERY_METHOD VARCHAR(7) How messages sent to the message queue for this user are to be delivered.
*HOLD The messages are held in the message queue until they are
requested by the user or program.
MESSAGE_QUEUE_SEVERITY INTEGER The lowest severity code that a message can have and still be delivered to a
user in break or notify mode. This is a value from 0 to 99.
Contains the null value if the value was not changed.
PRINT_DEVICE VARCHAR(10) The default printer device for this user or one of the following special
values:
OUTPUT_QUEUE_LIBRARY VARCHAR(10) The library where the output queue is found. Can contain the special value
*LIBL.
Contains the null value if the value was not changed.
OUTPUT_QUEUE VARCHAR(10) The output queue to be used by this user profile or one of the following
special values:
*DEV The output queue associated with the printer specified for
the Printer Device is used.
*WRKSTN The output queue assigned to the user's work station is used.
ATTENTION_KEY_HANDLING_ VARCHAR(10) The library where the ATTN program is found. Can contain the special value
PROGRAM_LIBRARY *LIBL.
Contains the null value if the value was not changed.
ATTENTION_KEY_HANDLING_PROGRAM VARCHAR(10) The program to be used as the Attention (ATTN) key handling program for
this user or one of the following special values:
SORT_SEQUENCE_TABLE_LIBRARY VARCHAR(10) The the library where the sort sequence table is found. Can contain the
special value *LIBL.
Contains the null value if the value was not changed.
SORT_SEQUENCE_TABLE VARCHAR(10) The sort sequence table to be used for string comparisons for this user
profile or one of the following special values:
LANGUAGE_ID VARCHAR(7) The language identifier to be used for this user profile or the following
special value:
COUNTRY_OR_REGION_ID VARCHAR(7) The country or region identifier to be used for this user profile or the
following special value:
CCSID VARCHAR(7) The coded character set identifier (CCSID) to be used for this user profile.
CHARACTER_IDENTIFIER_CONTROL VARCHAR(9) The character identifier control (CHRIDCTL) for the job.
LOCALE_JOB_ATTRIBUTES VARCHAR(60) The job attributes that are to be taken from the locale when the job is
initiated. This column can contain up to six values, each ten characters long.
*CCSID The coded character set identifier from the locale is used.
EIM_ID VARCHAR(128) Enterprise Identity Mapping (EIM) identifier name or the following special
value:
*USRPRF The EIM identifier is the same name as the user profile.
CREATE_EIM_ID VARCHAR(11) Indicates whether the EIM identifier should be created if it does not exist.
USER_ID_NUMBER VARCHAR(10) The UID for the user. Can contain the special value *GEN to indicate the uid
number is generated for the user.
Contains the null value if the value was not changed.
GROUP_ID_NUMBER VARCHAR(10) The GID for the user. Can contain the special values *GEN to indicate the gid
number is generated for the user or *NONE to indicate the user profile does
not have a group profile.
Contains the null value if the value was not changed.
Example
• List any user profiles that were created in the last 6 months.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the DO audit journal entry.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
Example
• List any *FILE objects that were deleted this week. Return the user profile in effect when the delete
occurred.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the DS audit journal entry.
C Change to a service tools user ID using the Change Service Tools User
ID (QSYCHGDS) API.
D Delete of a service tools user ID using the Delete Service Tools User ID
(DLTSSTUSR) command.
H Change to a service tools user ID using the Change Service Tools User
ID (CHGSSTUSR) command.
R Create of a service tools user ID using the Create Service Tools User ID
(CRTSSTUSR) command.
S Change to the service tools security attributes using the Change SST
Security Attributes (CHGSSTSECA) command.
SST_USERID VARCHAR(10) The name of the service tools user ID that requested the action.
Contains the null value when ENTRY_TYPE is A.
SST_USERID_MODIFIED VARCHAR(10) The service tools user ID being created, changed, renamed, or deleted.
When ENTRY_TYPE is C or P, it can contain one of the following special
values.
*BASIC
*FULL
*SECURITY
*SERVICE
SST_USERID_NEW VARCHAR(10) The new service tools user ID when a user ID is renamed.
Contains the null value when ENTRY_TYPE is not C.
*DISABLED
*ENABLED
*DISABLED
*ENABLED
LINKED_PROFILE VARCHAR(10) The user profile that is linked to the service tools user ID.
Contains the null value when ENTRY_TYPE is not H or R, or there is no linked
user profile.
PREV_LINKED_PROFILE VARCHAR(10) The user profile that was previously linked to the service tools user ID.
Contains the null value when ENTRY_TYPE is not H, or no user profile was
previously linked.
Contains the null value when this security attribute did not change or when
ENTRY_TYPE is not S.
PREV_ALLOW_SECURITY_SYSVAL_CHANGE VARCHAR(3) Previous value of allow changes to security related system values.
Contains the null value when this security attribute did not change or when
ENTRY_TYPE is not S.
PASSWORD_LEVEL INTEGER System Service Tools (SST) password level. The service tools password
rules are similar to the values that are specified in the Password Rules
(QPWDRULES) system value.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain the upper case profile name.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_CHANGE_BLOCK INTEGER After a password change, the number of hours during which the password is
blocked from being changed again.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_REQUIRE_GROUPS VARCHAR(3) The password must contain characters from at least three of the four
types of characters: Uppercase letters, lowercase letters, digits, and special
characters.
YES The password must contain characters from at least three of the
four groups.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password may not contain two or more adjacent characters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password may not contain two or more occurrences of the
same character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The same character may not be used in the same position as in the
previous password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_REQUIRE_DIGIT INTEGER The minimum number of digit characters that must occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_MAXIMUM_DIGITS VARCHAR(6) The maximum number of digit characters that may occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain two or more adjacent (consecutive)
digits.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_REQUIRE_LETTER INTEGER The minimum number of letter characters that must occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_MAXIMUM_LETTERS VARCHAR(6) The maximum number of letter characters that may occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain two or more adjacent (consecutive)
letters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_REQUIRE_MIXED_CASE INTEGER The password must contain at least the specified number of uppercase and
lowercase letters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_REQUIRE_SPECIAL INTEGER The minimum number of special characters that must occur in the
password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PASSWORD_MAXIMUM_SPECIAL VARCHAR(6) The maximum number of special characters that may occur in the
password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain two or more adjacent (consecutive)
special characters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The first character of the password must not be a special character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The last character of the password must not be a special character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_USERID VARCHAR(3) The previous value for limit SST user profile name.
YES The password must not contain the upper case profile name.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_CHANGE_BLOCK INTEGER The previous value for the number of hours during which the password is
blocked from being changed a second time.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_REQUIRE_GROUPS VARCHAR(3) The previous value for password must contain characters from at least three
of the four types of characters: Uppercase letters, lowercase letters, digits,
and special characters.
YES The password must contain characters from at least three of the
four groups.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password may not contain two or more adjacent (consecutive)
characters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password may not contain two or more occurrences of the
same character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_POSITIONS VARCHAR(3) The previous value for limit characters in the same position.
YES The same character may not be used in the same position as in the
previous password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_REQUIRE_DIGIT INTEGER The previous value for the minimum number of digit characters that must
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_MAXIMUM_DIGITS VARCHAR(6) The previous value for the maximum number of digit characters that may
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain two or more adjacent (consecutive)
digits.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_DIGIT_FIRST VARCHAR(3) The previous value for limit digit in first position.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_DIGIT_LAST VARCHAR(3) The previous value for limit digit in last position.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_REQUIRE_LETTER INTEGER The previous value for the minimum number of letter characters that must
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_MAXIMUM_LETTERS VARCHAR(6) The previous value for the maximum number of letter characters that may
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
YES The password must not contain two or more adjacent (consecutive)
letters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_LETTER_FIRST VARCHAR(3) The previous value for limit letter in first position.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_LETTER_LAST VARCHAR(3) The previous value for limit letter in last position.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_REQUIRE_MIXED_CASE INTEGER The previous value for yhe password must contain at least the specified
number of uppercase and lowercase letters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_REQUIRE_SPECIAL INTEGER The previous value for the minimum number of special characters that must
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_MAXIMUM_SPECIAL VARCHAR(6) The previous value for the maximum number of special characters that may
occur in the password.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_SPECIAL VARCHAR(3) The previous value for limit adjacent special characters.
YES The password must not contain two or more adjacent (consecutive)
special characters.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_SPECIAL_FIRST VARCHAR(3) The previous value for limit special character in first position.
YES The first character of the password must not be a special character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
PREV_PASSWORD_LIMIT_SPECIAL_LAST VARCHAR(3) The previous value for limit special character in last position.
YES The last character of the password must not be a special character.
Contains the null value when this value did not change or when
ENTRY_TYPE is not S.
DISK_ADMIN VARCHAR(3) Current privilege to perform disk unit administrator service functions.
DISK_READ_ONLY VARCHAR(3) Current privilege to perform disk read only service functions.
SYSTEM_PARTITION_OPERATIONS VARCHAR(3) Current privilege to perform system partition operator service functions.
PARTITION_REMOTE_PANEL_KEY VARCHAR(3) Current privilege to change a panel key for the specified partition where it is
secured.
PDC VARCHAR(3) Current privilege to perform Performance Data Collector (PDC) service
functions.
HSM VARCHAR(3) Current privilege to perform Hardware Service Manager (HSM) functions.
PAL VARCHAR(3) Current privilege to view and work with the Product Activity Log (PAL).
LIC_LOG VARCHAR(3) Current privilege to view and work with the Licensed Internal Code (LIC) log.
LIC_PTFS VARCHAR(3) Current privilege to load Licensed Internal Code (LIC) PTFs.
TRACE VARCHAR(3) Current privilege to read and perform the trace service functions.
DST VARCHAR(3) Current privilege to change the Dedicated Service Tools (DST) environment.
REMOTE_SERVICE_SUPPORT VARCHAR(3) Current privilege to configure and connect to the system using the Remote
Service Support interface.
SERVICE_TOOLS_SECURITY VARCHAR(3) Current privilege to work with and change Licensed Internal Code (LIC)
security values.
SERVICE_TOOLS_SAVE_RESTORE VARCHAR(3) Current privilege to perform save and restore service security functions.
SYSTEM_CAPACITY_OPERATIONS VARCHAR(3) Current privilege to perform system capacity operations service functions.
SYSTEM_SECURITY VARCHAR(3) Current privilege to perform security service functions and to work with
security lock down values.
TAKE_OVER_CONSOLE VARCHAR(3) Current privilege for a LAN console user to take over the console from
another LAN console user.
PREV_DISK_ADMIN VARCHAR(3) Previous privilege to perform disk unit administrator service functions.
PREV_DISK_READ_ONLY VARCHAR(3) Previous privilege to perform disk read only service functions.
PREV_SYSTEM_PARTITION_OPERATIONS VARCHAR(3) Previous privilege to perform system partition operator service functions.
PREV_PARTITION_REMOTE_PANEL_KEY VARCHAR(3) Previous privilege to change a panel key for the specified partition where it
is secured.
PREV_PDC VARCHAR(3) Previous privilege to perform Performance Data Collector (PDC) service
functions.
PREV_HSM VARCHAR(3) Previous privilege to perform Hardware Service Manager (HSM) functions.
PREV_PAL VARCHAR(3) Previous privilege to view and work with the Product Activity Log (PAL).
PREV_LIC_LOG VARCHAR(3) Previous privilege to view and work with the Licensed Internal Code (LIC)
log.
PREV_LIC_PTFS VARCHAR(3) Previous privilege to load Licensed Internal Code (LIC) PTFs.
PREV_TRACE VARCHAR(3) Previous privilege to read and perform the trace service functions.
PREV_DST VARCHAR(3) Previous privilege to change the Dedicated Service Tools (DST)
environment.
PREV_REMOTE_SERVICE_SUPPORT VARCHAR(3) Previous privilege to configure and connect to the system using the Remote
Service Support interface.
PREV_SERVICE_TOOLS_SECURITY VARCHAR(3) Previous privilege to work with and change Licensed Internal Code (LIC)
security values.
PREV_SERVICE_TOOLS_SAVE_RESTORE VARCHAR(3) Previous privilege to perform save and restore service security functions.
PREV_SYSTEM_CAPACITY_OPERATIONS VARCHAR(3) Previous privilege to perform system capacity operations service functions.
PREV_SYSTEM_SECURITY VARCHAR(3) Previous privilege to perform security service functions and to work with
security lock down values.
PREV_TAKE_OVER_CONSOLE VARCHAR(3) Previous privilege for a LAN console user to take over the console from
another LAN console user.
Example
• List SST users that were created or deleted in the last month
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_DS (STARTING_TIMESTAMP => CURRENT TIMESTAMP - 1 MONTH)
)
WHERE ENTRY_TYPE IN ('D', 'R');
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the EV audit journal entry.
A Add
C Change
D Delete
Example
• List any environment variables that have been changed in the last month.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_EV (STARTING_TIMESTAMP => CURRENT DATE - 1 MONTH))
)
WHERE ENTRY_TYPE = 'C';
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the GR audit journal entry.
O ObjectConnect operations
ZC Change
ZR Read
When ENTRY_TYPE is O:
SV Save
RS Restore
EXIT_POINT_FORMAT CHAR(8) When ENTRY_TYPE is A, D, or R, the exit point format name associated with
the exit point
Contains the null value when ENTRY_TYPE is F, or O.
EXIT_PROGRAM_NUMBER INTEGER When ENTRY_TYPE is A, D, or R, the exit program number associated with
the exit program.
Contains the null value when ENTRY_TYPE is F, or O.
FUNCTION _REGISTRATION_ VARCHAR(13) When ENTRY_TYPE is F, contains the description of the function registration
OPERATION operation that was performed. The possible values are:
CHECK USAGE Function usage information was checked for a user and
determined the user is allowed to use the specified
function.
USAGE FAILURE Function usage information was checked for a user and
determined the user is not allowed to use the specified
function.
FUNCTION_NAME VARCHAR(30) When ENTRY_TYPE is F, contains the name of the function that was
operated on.
Contains the null value when ENTRY_TYPE is not F.
USAGE_SETTING VARCHAR(7) When ENTRY_TYPE is F, contains the usage value for the user specified in
USER_PROFILE_NAME. If USER_PROFILE_NAME is *DEFAULT, this is the
default usage.
PREVIOUS_USAGE VARCHAR(7) When ENTRY_TYPE is F, contains the previous usage value for a user. If
USER_PROFILE_NAME is *DEFAULT, this is the previous default usage.
NOT USED For a user with *ALLOBJ special authority to use the function,
the usage information specified for the function must indicate
that the user is allowed to use the function
NOT USED For a user with *ALLOBJ special authority to use the function,
the usage information specified for the function must indicate
that the user is allowed to use the function
SAVE_SYSTEM VARCHAR(15) When ENTRY_TYPE is O and ACTION is RS, contains the name of the system
on which the objects are saved.
When ENTRY_TYPE is O and ACTION is SV, contains the name of the system
on which the objects are restored.
If ObjectConnect uses *DB2MIRROR for the connection type, the NRG name
is returned.
Contains the null value when ENTRY_TYPE is not O.
OBJECTCONNECT_UUID VARCHAR(16) When ENTRY_TYPE is O, contains the Universal Unique Identifier (UUID) of
the ObjectConnect operation.
Contains the null value when ENTRY_TYPE is not O.
RESTORE_USER VARCHAR(10) When ENTRY_TYPE is O and ACTION is SV, contains the name of the user
under which the restore will be performed. Can contain the following special
values:
*CURRENT
*KERBEROS
*NONE
Contains the null value when ENTRY_TYPE is not O with an ACTION of SV.
Example
• List any changes to function usage definitions from the last two weeks
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_GR (STARTING_TIMESTAMP => CURRENT DATE - 14 DAYS))
)
WHERE ENTRY_TYPE = 'F' AND
FUNCTION_REGISTRATION_OPERATION = 'CHANGE USAGE';
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the IM audit journal entry.
EVENT_TIMESTAMP TIMESTAMP The date and time that the event was detected.
EVENT_LOCAL_ADDRESS_FAMILY CHAR(4) The type of local address associated with the detected event.
EVENT_LOCAL_PORT INTEGER Local port number associated with the detected event.
Contains the null value when a value is not available.
EVENT_REMOTE_ADDRESS_FAMILY CHAR(4) The type of remote address associated with the detected event.
EVENT_REMOTE_PORT INTEGER Remote port number associated with the detected event.
Contains the null value when a value is not available.
PROBE_TYPE VARCHAR(6) The type of probe used to detect the potential intrusion.
EVENT_CORRELATOR VARCHAR(4) Identifier for this specific intrusion event. This identifier can be used to
correlate this audit record with other intrusion detection information.
FLOOD Flood
FRAGGLE Fraggle
IPFRAG IP Fragment
SMURF Smurf
PROTOCOL VARCHAR(6) Protocol. Recognized protocol values and their protocol numbers are:
ICMP 1
ICMPV6 58
IGMP 2
OSPF 89
TCP 6
UDP 17
THROTTLING_ACTIVE VARCHAR(3) Throttling status at the time the event was flagged.
SUSPECTED_PACKET VARBINARY(1000) The first 1000 bytes of the IP packet associated with the detected event.
Contains the null value when PROBE_TYPE is TR-SSL or when a value is not
available.
FAILING_HANDSHAKE_LOCATION VARCHAR(6) The processing location that detected the failed handshake.
Contains the null value when PROBE_TYPE is not TR-SSL or when a value is
not available.
DETECTION_POINT_ID VARCHAR(4) A unique identifier for the processing location that detected the intrusion
event. This value is intended for use by service personnel.
Example
• List all intrusion events for this week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the JS audit journal entry.
A ENDJOBABN command
B Submit
C Change
E End
H Hold
I Disconnect
N ENDJOB command
R Release
S Start
U CHGUSRTRC
JOB_TYPE VARCHAR(3) The job type. This value is based on the values of the JOB_TYPE_BASIC and
JOB_SUBTYPE columns.
ASJ Autostart
BCH Batch
INT Interactive
PJ Prestart job
SYS System
A Autostart
B Batch
I Interactive
M Subsystem monitor
R Reader
S System
W Writer
X SCPF
D Batch immediate
J Prestart
Q Query
T MRT
TARGET_QUALIFIED_JOB_NAME VARCHAR(28) The qualified job name of the job that is being operated on.
TARGET_JOB_NAME VARCHAR(10) The name of the job that is being operated on.
TARGET_JOB_USER VARCHAR(10) The user profile that of the job that is being operated on.
TARGET_JOB_NUMBER VARCHAR(6) The job number of the job that is being operated on.
EFFECTIVE_USER_PROFILE VARCHAR(10) The name of the effective user profile for the thread.
When this audit record is generated because one job performs an operation
on another job this column contains data from the initial thread of the job
that is being operated on. In all other cases, the column contains data from
the thread that performed the operation.
Contains the null value if no value is available.
EFFECTIVE_GROUP_PROFILE VARCHAR(10) The name of the effective group profile for the thread.
When this audit record is generated because one job performs an operation
on another job, this column contains data from the initial thread of the job
that is being operated on. In all other cases, the column contains data from
the thread that performed the operation.
Contains the null value if no value is available.
SUPPLEMENTAL_GROUP_PROFILES VARCHAR(150) The names of the supplemental group profiles for the thread.
When this audit record is generated because one job performs an operation
on another job, this column contains data from the initial thread of the job
that is being operated on. In all other cases, the column contains data from
the thread that performed the operation.
Contains the null value if no value is available.
REAL_USER_PROFILE VARCHAR(10) The name of the real (initial) user profile for the thread.
Contains the null value if no value is available.
SAVED_USER_PROFILE VARCHAR(10) The name of the saved user profile for the thread.
Contains the null value if no value is available.
REAL_GROUP_PROFILE VARCHAR(10) The name of the real (initial) group profile for the thread.
Contains the null value if no value is available.
SAVED_GROUP_PROFILE VARCHAR(10) The name of the saved group profile for the thread.
Contains the null value if no value is available.
JOB_DESCRIPTION_LIBRARY VARCHAR(10) The name of the library for the job description.
Contains the null value if no value is available.
JOB_DESCRIPTION VARCHAR(10) The name of the job description for the job.
Contains the null value if no value is available.
JOB_QUEUE_LIBRARY VARCHAR(10) The name of the library for the job queue.
Contains the null value if no value is available.
JOB_QUEUE_NAME VARCHAR(10) The name of the job queue for the job.
Contains the null value if no value is available.
OUTPUT_QUEUE_LIBRARY VARCHAR(10) The name of the library for the output queue.
Contains the null value if no value is available.
OUTPUT_QUEUE_NAME VARCHAR(10) The name of the output queue for the job.
Contains the null value if no value is available.
PRINTER_DEVICE VARCHAR(10) The name of the printer device for the job.
Contains the null value if no value is available.
LIBRARY_LIST VARCHAR(2680) The library list for the job. The list is an array of entries, each ten characters
long.
When this audit record is generated because one job performs an operation
on another job, this column contains data from the initial thread of the job
that is being operated on. In all other cases, the column contains data from
the thread that performed the operation.
Contains the null value when LIBRARY_LIST_COUNT is 0.
SET The set JUID API was called. JOB_USER_IDENTITY contains the
new value.
WORKLOAD_GROUP VARCHAR(10) The name of the workload group associated with the job.
Contains the null value when ENTRY_TYPE is not C, E, or S.
EXIT_QUALIFIED_JOB_NAME VARCHAR(28) • When ENTRY_TYPE is J, the qualified job name of the job that was
interrupted by the current job.
• When ENTRY_TYPE is K or L, the qualified job name of the job that
requested the interruption of the current job.
Contains the null value when ENTRY_TYPE is not J, K, or L.
EXIT_JOB_NAME VARCHAR(10) • When ENTRY_TYPE is J, the name of the job that was interrupted by the
current job.
• When ENTRY_TYPE is K or L, the name of the job that requested the
interruption of the current job.
Contains the null value when ENTRY_TYPE is not J, K, or L.
EXIT_JOB_USER VARCHAR(10) • When ENTRY_TYPE is J, the user of the job that was interrupted by the
current job.
• When ENTRY_TYPE is K or L, the user of the job that requested the
interruption of the current job.
Contains the null value when ENTRY_TYPE is not J, K, or L.
EXIT_JOB_NUMBER VARCHAR(6) • When ENTRY_TYPE is J, the job number of the job that was interrupted by
the current job.
• When ENTRY_TYPE is K or L, the number of the job that requested the
interruption of the current job.
Contains the null value when ENTRY_TYPE is not J, K, or L.
EXIT_PROGRAM_LIBRARY VARCHAR(10) The library name of the exit program used to interrupt the job.
Contains the null value when ENTRY_TYPE is not J, K, or L.
Example
• List jobs that were ended today with the ENDJOB or ENDJOBABN CL commands.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_JS (STARTING_TIMESTAMP => CURRENT DATE)
)
WHERE ENTRY_TYPE IN ('A','N');
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the LD audit journal entry.
K Search directory
L Link directory
U Unlink directory
YES The PATH_NAME column contains complete absolute path name for
the object.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value if the path name is not available, or the
PATH_NAME_INDICATOR is YES, or the file ID is not available.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
OBJECT_ASP_NUMBER INTEGER The number of the auxiliary storage pool to which storage for the object is
allocated.
Example
• List directories that have been searched in the last week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the M0 audit journal entry.
POWEROFF Power® off the setup source or copy node using the
HMC poweroff operation.
COLD
WARM
NEW
RESTORE
SAVE
UPDATE
CONTROL
HMC
IMMED
ACTION_STATUS VARCHAR(12) Status of the action. This column can return a value when ACTION has
a value of START, CHECKSYSBASE, POWEROFF, PRECHECK, FLASHCOPY,
REMOTECOPY, and IASPCOPY. For these ACTION values, two audit entries
will be sent: one when the action starts and another when the action ends.
When the audit entry is for the start of the action, this column contains
STARTED. When the audit entry is for the end of the action, this column
contains the status of the action.
IASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP). A value of *SYSBAS indicates
the system ASP and all basic user ASPs.
Contains the null value if ACTION is not IASPCOPY, PREIASP, or POSTIASP.
SETUP_SOURCE_NODE VARCHAR(8) The partition name of the Db2 Mirror setup source node.
SETUP_COPY_NODE VARCHAR(8) The partition name of the Db2 Mirror setup copy node.
SETUP_SOURCE_STORAGE VARCHAR(256) The IP address or host and domain name of the setup source storage
system.
Contains the null value if ACTION is not START, PRECHECK, FLASHCOPY,
REMOTECOPY, or IASPCOPY.
SETUP_COPY_STORAGE VARCHAR(256) The IP address or host and domain name of the setup copy storage system.
Contains the null value if ACTION is not START, PRECHECK, FLASHCOPY,
REMOTECOPY, or IASPCOPY.
Example
• List any Db2 Mirror set up actions that were unsuccessful from the last week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the M6 audit journal entry.
A Add NRG
C Change NRG
R Remove NRG
UNSPECIFIED Unspecified
LINK_COUNT INTEGER Number of links configured in the group. This indicates the number of sets
of link information columns, with a suffix of _n, that contain values. The
information for links greater than LINK_COUNT will contain the null value.
Contains the null value if ENTRY_TYPE is R. All the link information columns
will contain the null value.
LINE_DESCRIPTION_1 VARCHAR(10) The local line description for the first link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_2 VARCHAR(10) The local line description for the second link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_3 VARCHAR(10) The local line description for the third link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_4 VARCHAR(10) The local line description for the fourth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_5 VARCHAR(10) The local line description for the fifth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_6 VARCHAR(10) The local line description for the sixth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_7 VARCHAR(10) The local line description for the seventh link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_8 VARCHAR(10) The local line description for the eighth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_9 VARCHAR(10) The local line description for the ninth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_10 VARCHAR(10) The local line description for the tenth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_11 VARCHAR(10) The local line description for the eleventh link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_12 VARCHAR(10) The local line description for the twelfth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_13 VARCHAR(10) The local line description for the thirteenth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_14 VARCHAR(10) The local line description for the fourteenth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_15 VARCHAR(10) The local line description for the fifteenth link.
V1 RoCE v1
V2 RoCE v2
LINE_DESCRIPTION_16 VARCHAR(10) The local line description for the sixteenth link.
V1 RoCE v1
V2 RoCE v2
Example
• List NRG configuration changes from the last month
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the M7 audit journal entry.
U User deferred or deleted entries in the Object Tracking List (OTL) using
the QSYS2.CHANGE_RESYNC_ENTRIES procedure
V Generic versioning
When ENTRY_TYPE is V:
DEFINITION Objects that best match this replication criteria rule are
replicated. Only the definition of the object is replicated.
EXCLUDE Objects that best match this replication criteria rule are not
replicated.
INCLUDE Objects that best match this replication criteria rule are
replicated.
IASP_NAME VARCHAR(10) The name of the ASP group associated with this replication criteria
rule, the replicated object, or the SQL QSYS2.CHANGE_RESYNC_ENTRIES
procedure. Can contain the special value *SYSBAS.
Contains the null value if ENTRY_ TYPE is V.
LIBRARY_NAME VARCHAR(10) The library name associated with the replication criteria rule, the replicated
object, or the SQL QSYS2.CHANGE_RESYNC_ENTRIES procedure. Can
contain the special value *ALL.
Contains the null value if IASP_NAME is null.
OBJECT_TYPE VARCHAR(8) The object type associated with the replication criteria rule, the replicated
object, or the SQL QSYS2.CHANGE_RESYNC_ENTRIES procedure. Can
contain the special value *ALL.
Contains the null value if LIBRARY_NAME is null.
OBJECT_NAME VARCHAR(10) The name of the object associated with this replication criteria rule, the
replicated object, or the QSYS2.CHANGE_RESYNC_ENTRIES procedure.
Contains the null value if OBJECT_TYPE is null.
SYSTEM_VALUE VARCHAR(10) The name of the system value associated with this replication criteria rule.
Contains the null value if ENTRY_TYPE is not A or R, or if OBJECT_NAME or
ENVIRONMENT_VARIABLE is not null.
ENVIRONMENT_VARIABLE VARCHAR(128) The name of the environment variable associated with this replication
criteria rule.
Contains the null value if ENTRY_TYPE is not A or R, or if OBJECT_NAME or
SYSTEM_VALUE is not null.
NUMBER_OF_OBJECTS BIGINT The number of Save/Restore entries added to the OTL for objects affected
by this operation.
Contains the null value if ENTRY_TYPE is not A, P, R, or S.
VERSION_NAME VARCHAR(30) The version name. Can contain the following special value:
VERSION_IDENTIFIER VARCHAR(11) The version identifier. The format is xxx.yyy.zzz where each piece of the
version contains the digits 0-9:
xxx The major version number. This value is always present for a version
number.
Example
• List any replication changes that affected APPLIB1 this week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the M8 audit journal entry.
A Add IASP
C Change mirror
O Takeover
R Remove IASP
S Setup mirror
T Terminate mirror
When ENTRY_TYPE is C:
When ENTRY_TYPE is F:
When ENTRY_TYPE is J:
When ENTRY_TYPE is L:
When ENTRY_TYPE is O:
When ENTRY_TYPE is T:
IASP_NAME VARCHAR(10) ASP name. Can contain the special value *SYSBAS.
Contains the null value if no ASP name applies to this entry.
DEFAULT_INCLUSION_STATE VARCHAR(7) When the ENTRY_TYPE is A, the default object inclusion state for objects in
IASP_NAME.
When ENTRY_TYPE is I, the default inclusion state for objects in *SYSBAS.
RESET Clear the default inclusion state. This value applies when
ENTRY_TYPE is I.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
PARALLEL_DEGREE VARCHAR(5) The degree of parallelism to be used for Db2 Mirror resynchronization
processing. Can contain the special value of NONE.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
REPLICATE_DATA_QUEUE_ENTRIES VARCHAR(7) The replication choice for entries in a data queue (*DTAQ).
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
AUTO_TAKEOVER VARCHAR(7) The choice for automatic takeover for unplanned outages.
Contains the null value if ENTRY_TYPE is not C or if the value was not
changed.
AUTO_SWITCHBACK VARCHAR(3) When ENTRY_TYPE is O and ACTION is CREATE or CHANGE, whether the
takeover IP address group should be automatically switched back to its
preferred node.
Contains the null value if ENTRY_TYPE is not O or if the value was not
changed.
PRIMARY_NODE VARCHAR(8) When ENTRY_TYPE is O and ACTION is CREATE or CHANGE, the name of the
preferred node.
When ENTRY_TYPE is S or T, the name of the partition designated as the
primary node.
When ENTRY_TYPE is W, the name of the new primary node.
Contains the null value if ENTRY_TYPE is not O, S, T, or W.
SECONDARY_NODE VARCHAR(8) The name of the partition designated as the secondary node.
When ENTRY_TYPE is W this is the name of the new secondary node.
Contains the null value if ENTRY_TYPE is not S, T, or W.
OBJECTCONNECT_AUTO_START VARCHAR(3) Whether to automatically start the ObjectConnect for Db2 Mirror server.
Contains the null value if ENTRY_TYPE is not J or if the value was not
changed.
OBJECTCONNECT_MINIMUM_JOBS INTEGER The minimum number of ObjectConnect for Db2 Mirror server jobs that are
started.
Contains the null value if ENTRY_TYPE is not J or if the value was not
changed.
OBJECTCONNECT_MAXIMUM_JOBS INTEGER The maximum number of ObjectConnect for Db2 Mirror server jobs that are
started.
Contains the null value if ENTRY_TYPE is not J or if the value was not
changed.
OBJECTCONNECT_INACTIVE_TIME INTEGER The length of time, in minutes, that a ObjectConnect for Db2 Mirror server
job will stay inactive before ending.
Contains the null value if ENTRY_TYPE is not J or if the value was not
changed.
ARCHIVE_RETENTION_DAY_COUNT INTEGER The number of days the flight recorder logs are retained.
Contains the null value if ENTRY_TYPE is not F.
MAX_SYSBAS_PERCENTAGE INTEGER The percentage of *SYSBAS allocated for flight recorder logs.
Contains the null value if ENTRY_TYPE is not F.
LOGGING_CATEGORY VARCHAR(26) The category for which flight recorder entries will be logged.
LOGGING_LEVEL VARCHAR(7) The level at which an entry is written to the flight recorder log.
DEBUG Log entries for the INFO level are generated, plus debug
information.
ERROR Log entries are generated for run time errors and unexpected
conditions.
INFO Log entries for the WARN level are generated, plus
interesting run time events.
WARNING Log entries for the ERROR level are generated, plus entries
for errors or other run time situations that are unexpected or
unusual but not necessarily wrong.
Example
• List when Db2 Mirror active replication was suspended in the last 2 months.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the M9 audit journal entry.
IASP_NAME VARCHAR(10) ASP name for which the replication state changed. Can contain the special
value *SYSBAS.
ACTIVE
BLOCKED
NOT MIRRORED
TRACKING
ACTIVE
BLOCKED
NOT MIRRORED
TRACKING
CHANGE_REASON INTEGER The reason code corresponding to the replication state change. See
Replication detail info for the list of reason codes.
Contains the null value when REPLICATION_STATE or
PREVIOUS_REPLICATION_STATE is NOT MIRRORED.
Example
• List any reasons that IASP1 suspended replication in the past 24 hours.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the NA audit journal entry.
Example
• List the TCP/IP attributes that were changed in the last two months.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the OM audit journal entry.
R Object renamed.
LIBRARY_NAME VARCHAR(10) The name of the library to which the object was moved.
Contains the null value if there is no new library name.
OBJECT_NAME VARCHAR(10) The new name of the object which was moved.
Contains the null value if there is no new object name.
PREV_LIBRARY_NAME VARCHAR(10) The name of the library in which the previous object resides.
Contains the null value if there is no previous library name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. If the new object is in a library, this is the ASP information
of the object's library. If the new object is not in a library, this is
the ASP information of the object. A value of *SYSBAS indicates the
system ASP and all basic user ASPs.
Contains the null value if there is no ASP information.
OBJECT_ASP_NUMBER INTEGER The number of the ASP device. If the new object is in a library, this
is the ASP information of the object's library. If the new object is not
in a library, this is the ASP information of the object.
Contains the null value if there is no ASP information.
PREV_OBJECT_ASP_NAME VARCHAR(10) The previous name of the auxiliary storage pool (ASP) in which the
object resides. If the previous object is in a library, this is the ASP
information of the object's library. If the previous object is not in a
library, this is the ASP information of the object. A value of *SYSBAS
indicates the system ASP and all basic user ASPs.
Contains the null value if there is no ASP information.
PREV_OBJECT_ASP_NUMBER INTEGER The previous number of the ASP device. If the previous object is in
a library, this is the ASP information of the object's library. If the
previous object is not in a library, this is the ASP information of the
object.
Contains the null value if there is no ASP information.
PATH_NAME VARGRAPHIC(5000) CCSID 1200 The new path name of the object.
Contains the null value if the path name is not available or the
object is not in the "root" (/), QOpenSys, or user-defined file
systems.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
PREV_PATH_NAME VARGRAPHIC(5000) CCSID 1200 The previous path name of the object.
Contains the null value if the path name is not available or the
object is not in the "root" (/), QOpenSys, or user-defined file
systems.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
Example
• List any objects that were moved or renamed in the APPLIB library this week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the OR audit journal entry.
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the restored object.
Contains the null value if there is no library name.
SAVE_OBJECT_LIBRARY VARCHAR(10) The name of the library from which the object was saved.
Contains the null value if there is no saved library name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
SAVE_SYSTEM VARCHAR(8) The system from which the object was saved.
Contains the null value if the system from which the object was
saved was running a release prior to IBM i 7.1, or if a value is not
available.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
PREV_OBJECT_FILE_ID BINARY(16) The file ID of the object that was replaced on the restore.
Contains the null value if the object did not exist prior to the restore
or is not in the "root" (/), QOpenSys, or user-defined file systems.
SAVE_OBJECT_FILE_ID BINARY(16) The file ID (FID) of the saved object. This is the FID the object had
on the save system.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
EXIT_PROGRAM_SCAN VARCHAR(11) Whether the object will be scanned when exit programs are
registered with any of the integrated file system scan-related exit
points.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
SET_EFFECTIVE_USER_ID VARCHAR(3) The set effective user ID (SETUID) mode indicator for the restored
object.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
SET_EFFECTIVE_GROUP_ID VARCHAR(3) The set effective group ID (SETGID) mode indicator for the restored
object.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
FOLDER_PATH VARCHAR(63) The folder into which the document library object was restored.
Contains the null value if there is no folder path.
SAVED_FOLDER_PATH VARCHAR(63) The folder from which the document library object was saved.
Contains the null value if there is no saved folder path.
Example
• List objects that were restored into APPLIB this week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the OW audit journal entry.
OBJECT_LIBRARY VARCHAR(10) The name of the library where the object is stored.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
Example
• List the objects in APPLIB1 or APPLIB2 that had object ownership changes in the last 3 months.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_OW (STARTING_TIMESTAMP => CURRENT TIMESTAMP - 3 MONTHS)
)
WHERE OBJECT_LIBRARY IN ('APPLIB1', 'APPLIB2');
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PA audit journal entry.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object resides. A
value of *SYSBAS indicates the system ASP and all basic user ASPs.
YES The PATH_NAME column contains complete absolute path name for
the object.
Contains the null value if the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the
file ID is not available or the object is not in the "root" (/), QOpenSys, or
user-defined file systems.
SET_EFFECTIVE_USER_ID VARCHAR(3) The current set effective user ID (SETUID) mode indicator.
SET_EFFECTIVE_GROUP_ID VARCHAR(3) The current set effective group ID (SETGID) mode indicator.
RESTRICT_RENAME_AND_UNLINK VARCHAR(3) The current restricted rename and unlink (ISVTX) mode indicator.
PREV_SET_EFFECTIVE_USER_ID VARCHAR(3) The previous set effective user ID (SETUID) mode indicator.
PREV_SET_EFFECTIVE_GROUP_ID VARCHAR(3) The previous set effective group ID (SETGID) mode indicator.
PREV_RESTRICT_RENAME_ VARCHAR(3) The previous restricted rename and unlink (ISVTX) mode indicator.
AND_UNLINK
NO The ISVTX mode bit was not on for the object.
Example
• Find any programs that were changed to adopt the program owner's authority in the last month.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PF audit journal entry.
P PTF operations
When ENTRY_TYPE is L:
When ENTRY_TYPE is P:
PRODUCT_ID VARCHAR(7) Product identifier. Can contain one of the following special values:
*FMW Firmware
PRODUCT_LIBRARY VARCHAR(10) Product library. Can contain one of the following special values.
*FMW Firmware
DEVICE_NAME VARCHAR(10) PTF install device name. Can contain one of the following special
values:
IMAGE_CATALOG VARCHAR(10) PTF install image catalog name. Can contain one of the following
special values:
COPY_SERVICE_PTFS VARCHAR(3) Copy PTF save files and cover letters into *SERVICE on PTF install.
NO No automatic IPL
IPL_RESTART_TYPE VARCHAR(5) IPL restart type for automatic IPL on PTF install.
NO Normal IPL
RESTART_SHARED_ACTIVATION_GROU VARCHAR(3) Restart Shared Activation Group (SAG) during IPL after applying
P PTFs.
Example
• For each PTF action that has been performed today, list the number of times it occurred along with the
description of the action.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PG audit journal entry.
REVOKE_PREV_PRIMARY_GROUP VARCHAR(3) Indicates whether authority was revoked for the previous primary
group.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if there is no ASP information.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
AUTHORIZATION_LIST_MANAGEMENT VARCHAR(3) Indicates whether the new primary group has authorization list
management (*AUTLMGT) authority.
OBJECT_EXCLUDE VARCHAR(3) Indicates whether the new primary group has exclude (*EXCLUDE)
authority.
OBJECT_OPERATIONAL VARCHAR(3) Indicates whether the new primary group has object operational
(*OBJOPR) authority.
OBJECT_MANAGEMENT VARCHAR(3) Indicates whether the new primary group has object management
(*OBJMGT) authority.
OBJECT_EXISTENCE VARCHAR(3) Indicates whether the new primary group has object existence
(*OBJEXIST) authority.
OBJECT_ALTER VARCHAR(3) Indicates whether the new primary group has object alter
(*OBJALTER) authority.
OBJECT_REFERENCE VARCHAR(3) Indicates whether the new primary group has object reference
(*OBJREF) authority.
DATA_READ VARCHAR(3) Indicates whether the new primary group has data read (*READ)
authority.
DATA_ADD VARCHAR(3) Indicates whether the new primary group has data add (*ADD)
authority.
DATA_UPDATE VARCHAR(3) Indicates whether the new primary group has data update (*UPD)
authority.
DATA_DELETE VARCHAR(3) Indicates whether the new primary group has data delete (*DLT)
authority .
DATA_EXECUTE VARCHAR(3) Indicates whether the new primary group has data execute
(*EXECUTE) authority.
PREV_AUTHORIZATION_LIST_ VARCHAR(3) Indicates whether the previous primary group had authorization list
MANAGEMENT management (*AUTLMGT) authority.
PREV_OBJECT_EXCLUDE VARCHAR(3) Indicates whether the previous primary group had exclude
(*EXCLUDE) authority.
PREV_OBJECT_OPERATIONAL VARCHAR(3) Indicates whether the previous primary group had object
operational (*OBJOPR) authority.
PREV_OBJECT_MANAGEMENT VARCHAR(3) Indicates whether the previous primary group had object
management (*OBJMGT) authority.
PREV_OBJECT_EXISTENCE VARCHAR(3) Indicates whether the previous primary group had object existence
(*OBJEXIST) authority.
PREV_OBJECT_ALTER VARCHAR(3) Indicates whether the previous primary group had object alter
(*OBJALTER) authority.
PREV_OBJECT_REFERENCE VARCHAR(3) Indicates whether the previous primary group had object reference
(*OBJREF) authority.
PREV_DATA_READ VARCHAR(3) Indicates whether the previous primary group had data read
(*READ) authority.
PREV_DATA_ADD VARCHAR(3) Indicates whether the previous primary group had data add (*ADD)
authority.
PREV_DATA_UPDATE VARCHAR(3) Indicates whether the previous primary group had data update
(*UPD) authority.
PREV_DATA_DELETE VARCHAR(3) Indicates whether the previous primary group had data delete
(*DLT) authority.
PREV_DATA_EXECUTE VARCHAR(3) Indicates whether the previous primary group had data execute
(*EXECUTE) authority.
Example
• List the objects in APPLIB or APPLIB2 that had their primary group changed in the last month.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PS audit journal entry.
REGENERATED Multiple-use
regenerated profile
token
PASS_THROUGH_USER_PROFILE_NAME VARCHAR(10) The name of the user profile used for pass-
through.
Contains the null value if ENTRY_TYPE is T or
the name is not available.
ORIGINAL_PASS_THROUGH_USER_PROFILE_NAME VARCHAR(10) The original name of the user profile used for
pass-through.
Contains the null value if ENTRY_TYPE is T or
the name is not available.
EXIT_POINT_NAME VARCHAR(30) The name of the exit point for which the exit
program profile is overridden.
Contains the null value if ENTRY_TYPE is not
T or U or the exit point name is not available.
Example
• List the occurrences where a single user profile token was generated for the user QSYS in the last week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PU audit journal entry.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if ENTRY_TYPE is not D or L.
LIC_RU_NAME VARCHAR(8) The Licensed Internal Code replacement unit (Ru) name.
Contains the null value if ENTRY_TYPE is not S.
Example
• List objects that were affected by PTFs that were applied to the system in the previous two days.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the PW audit journal entry.
AUDIT_USER_NAME VARCHAR(10) The job user name or the service tools user ID name.
Contains the null value if no user name is available.
DEVICE_NAME VARCHAR(40) The name of the device or communications device on which the password or
user ID was entered.
Contains the null value when VIOLATION_TYPE is D, E, X, Y, or Z or if the
device name is not available.
REMOTE_LOCATION VARCHAR(8) Name of the remote location for the APPC bind.
Contains the null value when VIOLATION_TYPE is not A.
LOCAL_LOCATION VARCHAR(8) Name of the local location for the APPC bind.
Contains the null value when VIOLATION_TYPE is not A.
DECRYPT_HOST_VARIABLE VARCHAR(3) Whether the user attempted to decrypt data in a host variable.
DECRYPT_OBJECT_ASP_NAME VARCHAR(10) The name of the ASP device where OBJECT_NAME resides.
Contains the null value if VIOLATION_TYPE is not S or if there is no object
name.
DECRYPT_OBJECT_ASP_NUMBER INTEGER The number of the ASP device where OBJECT_NAME resides.
Contains the null value if VIOLATION_TYPE is not S or if there is no object
name.
Example
• For all the password audit journal entries from yesterday and today, list the number of each type of audit
violation.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the RA audit journal entry.
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the restored object.
Contains the null value if there is no library name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which OBJECT_NAME
resides. A value of *SYSBAS indicates the system ASP and all basic user
ASPs.
OBJECT_ASP_NUMBER INTEGER The number of the auxiliary storage pool to which storage for
OBJECT_NAME is allocated.
SAVE_AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list for the object on the save media.
Contains the null value if there is no authorization list for the object on the
save media.
RESTORE_AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list for the object after the restore has
completed.
Contains the null value if AUTHORIZATION_LIST_REMOVED is YES or there
is no authorization list for the object on the save media.
AUTHORIZATION_LIST_REMOVED VARCHAR(3) Indicates whether the authorization list was removed from the object.
PUBLIC_AUTHORITY_EXCLUDE VARCHAR(3) Indicates whether public authority was set to exclude (*EXCLUDE) for the
object.
PRIVATE_AUTHORITY_REMOVED VARCHAR(3) Indicates whether private authority was removed from the object.
YES The PATH_NAME column contains complete absolute path name for
the restored object.
Contains the null value if the restored object is not in the "root" (/),
QOpenSys, or user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the file
ID is not available or the restored object is not in the "root" (/), QOpenSys,
or user-defined file systems.
Example
• List any objects in APPLIB1 where the public authority is not set to *EXCLUDE as a result of restores
done in the last day.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the RO audit journal entry.
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the restored object.
Contains the null value if there is no library name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which OBJECT_NAME
resides. A value of *SYSBAS indicates the system ASP and all basic user
ASPs.
OBJECT_ASP_NUMBER INTEGER The number of the auxiliary storage pool to which storage for
OBJECT_NAME is allocated.
RESTORE_OWNER VARCHAR(10) The owner of the object after the restore has completed.
YES The PATH_NAME column contains complete absolute path name for
the restored object.
Contains the null value if the restored object is not in the "root" (/),
QOpenSys, or user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the restored object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the file
ID is not available or the restored object is not in the "root" (/), QOpenSys,
or user-defined file systems.
Example
• List any objects in APPLIB1 that are owned by QSYS as a result of restores done in the last day.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the RZ audit journal entry.
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the restored object.
Contains the null value if there is no library name.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which OBJECT_NAME
resides. A value of *SYSBAS indicates the system ASP and all basic user
ASPs.
OBJECT_ASP_NUMBER INTEGER The number of the auxiliary storage pool to which storage for
OBJECT_NAME is allocated.
SAVE_PRIMARY_GROUP VARCHAR(10) The primary group for the object on the save media.
Contains the null value if there is no primary group for the object on the save
media.
RESTORE_PRIMARY_GROUP VARCHAR(10) The primary group for the object after the restore has completed.
Contains the null value if there is no primary group for the object on the save
media.
YES The PATH_NAME column contains complete absolute path name for
the restored object.
Contains the null value if the restored object is not in the "root" (/),
QOpenSys, or user-defined file systems.
RELATIVE_DIRECTORY_FILE_ID BINARY(16) When PATH_NAME_INDICATOR is NO, contains the file ID of the directory
that contains the restored object identified in the PATH_NAME column.
Contains the null value when PATH_NAME_INDICATOR is YES, or if the file
ID is not available or the restored object is not in the "root" (/), QOpenSys,
or user-defined file systems.
Example
• List any objects in APPLIB1 that have the primary group DEVS as a result of restores done in the last
day.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the SK audit journal entry.
A Accept
C Connect
F Filtered mail
P Port unavailable
R Reject mail
DHCP_IP_ADDRESS VARCHAR(45) The IP address that the DHCP server assigned to the requesting
client.
Contains the null value when ENTRY_TYPE is not D.
SECURE_VERSION VARCHAR(10) The security protocol including the specific version level, if available,
used for the connection. Protocol prefixes include: TLS, DTLS, SSL,
IKE, IPSEC, SSH.
A specific example would be 'TLSV1.2' if the connection is protected
by System TLS using TLSv1.2. An entry for a non-operating system
connection may contain a raw version value such as '0401' if the
system inspection code encounters a version it doesn't understand.
Contains the null value when ENTRY_TYPE is not S.
SECURE_INFORMATION VARCHAR(100) Additional attributes for the secure connection. For example, for
IPSEC connections it contains the VPN Connection Name.
Contains the null value when ENTRY_TYPE is not S or when
information is not available.
Example
• List the security protocols and cryptographic algorithms used in the last month.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the SM audit journal entry.
D DRDA
ADD Add
CHANGE Change
DELETE Delete
DISPLAY Display
REMOVE Remove
REPLY_MESSAGE_ID VARCHAR(7) Message ID associated with the action. Can contain the special
value *ANY.
Contains the null value if ENTRY_TYPE is not S.
BACKUP_OPTION VARCHAR(8) The backup option that was changed. Values are *DAILY, *WEEKLY,
and *MONTHLY.
Contains the null value if ENTRY_TYPE is not O.
BACKUP_LIST VARCHAR(4) The name of the backup list that was changed. Values are *FLD and
*LIB.
Contains the null value if ENTRY_TYPE is not B.
NETWORK_FILE VARCHAR(10) The name of the network file that was used.
Contains the null value if ENTRY_TYPE is not N.
NETWORK_FILE_OWNER VARCHAR(10) The name of the user profile that owns the network file.
Contains the null value if ENTRY_TYPE is not N.
NETWORK_FILE_ORIGINATOR VARCHAR(8) The name of the user profile that originated the network file.
Contains the null value if ENTRY_TYPE is not N.
RDB_ALIAS VARCHAR(18) The RDB alias name. This value may be *NONE.
Contains the null value if ENTRY_TYPE is not D.
REMOTE_LOCATION VARCHAR(254) The remote location name of the system on which the RDB is
located.
REMOTE_PORT_OR_SERVICE VARCHAR(14) The relational database entry port number or service name that is
used at the remote location to communicate with the system on
which the RDB is located. If *DRDA was specified, the Distributed
Relational Database Architecture (DRDA) port 446 is shown.
Contains the null value if ENTRY_TYPE is not D,
REMOTE_LOCATION_TYPE is not *IP, or if the information is not
available.
LOWER_AUTHENTICATION VARCHAR(11) Whether an authentication method lower than what was specified
for the preferred method will be accepted during negotiation with
the server.
LOCAL_LOCATION VARCHAR(8) The local location name by which this system is identified to the
system on which the RDB is located. Can contain one of the
following special values:
REMOTE_NETWORK_ID VARCHAR(8) The remote network identifier of the system on which the RDB is
located. Can contain one of the following special values:
REMOTE_MODE VARCHAR(8) The mode name to use with the remote location name to
communicate with the system on which the RDB is located. Can
contain one of the following special values:
TRANSACTION_PROGRAM VARCHAR(8) FOR BIT DATA The name of the transaction program to use with the RDB entry.
ARD_LIBRARY VARCHAR(10) The library containing the Application Requester Driver (ARD)
program. This value can be *LIBL or *CURLIB.
Contains the null value if the special value *DRDA was specified on
the command, if ENTRY_TYPE is not D, if REMOTE_LOCATION is not
*ARDPGM, or if the information is not available.
ARD_PROGRAM VARCHAR(10) The ARD program to be called to process SQL requests directed to
the RDB.
Contains the null value if the special value *DRDA was specified on
the command, if ENTRY_TYPE is not D, if REMOTE_LOCATION is not
*ARDPGM, or if the information is not available.
PREV_REMOTE_LOCATION_TYPE VARCHAR(4) The previous value for the remote location type.
Contains the null value if ENTRY_TYPE is not D or if the previous
value is not available.
PREV_REMOTE_LOCATION VARCHAR(254) The previous value for the remote location name of the system on
which the RDB is located.
Contains the null value if ENTRY_TYPE is not D or if the previous
value is not available.
PREV_REMOTE_PORT_OR_SERVICE VARCHAR(14) The previous value for the relational database entry port number or
service name that is used at the remote location to communicate
with the system on which the RDB is located.
Contains the null value if ENTRY_TYPE is not D, if
REMOTE_LOCATION_TYPE is not *IP, or if the previous value is not
available.
PREV_PREFERRED_AUTHENTICATION VARCHAR(10) The previous value for the preferred authentication method on a
connection request.
Contains the null value if ENTRY_TYPE is not D or if the previous
value is not available.
PREV_LOWER_AUTHENTICATION VARCHAR(11) The previous value for whether an authentication method lower than
what was specified for the preferred method will be accepted during
negotiation with the server.
Contains the null value if ENTRY_TYPE is not D or if the previous
value is not available.
PREV_ENCRYPTION_ALGORITHM VARCHAR(4) The previous value for the encryption algorithm to be used initially
on the connection request.
Contains the null value if ENTRY_TYPE is not D, if
REMOTE_LOCATION_TYPE is not *IP, or if the previous value is not
available.
PREV_SECURE_CONNECTION VARCHAR(5) The previous value for whether Transport Layer Security (TLS) is to
be used on a DDM/DRDA TCP/IP connection request.
Contains the null value if ENTRY_TYPE is not D, if
REMOTE_LOCATION_TYPE is not *IP, or if the previous value is not
available.
PREV_LOCAL_LOCATION VARCHAR(8) The previous value for the local location name by which this system
is identified to the system on which the RDB is located.
Contains the null value if ENTRY_TYPE is not D, if the previous value
is not available, or REMOTE_LOCATION_TYPE is not *SNA.
PREV_REMOTE_NETWORK_ID VARCHAR(8) The previous value for the remote network identifier of the system
on which the RDB is located.
Contains the null value if ENTRY_TYPE is not D, if the previous value
is not available, or REMOTE_LOCATION_TYPE is not *SNA.
PREV_REMOTE_MODE VARCHAR(8) The previous value for the mode name to use with the remote
location name to communicate with the system on which the RDB is
located. Can contain one of the following special values:
Contains the null value if ENTRY_TYPE is not D, if the previous value
is not available, or REMOTE_LOCATION_TYPE is not *SNA.
PREV_TRANSACTION_PROGRAM VARCHAR(8) FOR BIT DATA The previous value for the name of the transaction program to use
with the RDB entry.
Contains the null value if ENTRY_TYPE is not D, if the previous value
is not available, or REMOTE_LOCATION_TYPE is not *SNA.
PREV_ARD_LIBRARY VARCHAR(10) The previous value for the library containing the Application
Requester Driver (ARD) program. This value may be *LIBL or
*CURLIB.
Contains the null value if ENTRY_TYPE is not D, if
REMOTE_LOCATION is not *ARDPGM, or if the previous value is not
available.
PREV_ARD_PROGRAM VARCHAR(10) The previous value for the ARD program to be called to process SQL
requests directed to the RDB.
Contains the null value if ENTRY_TYPE is not D, if
REMOTE_LOCATION is not *ARDPGM, or if the previous value is not
available.
AUTOSTART_SERVER VARCHAR(4) Whether the DDM server is automatically started. This value was
set using the Change DDM TCP/IP Attributes (CHGDDMTCPA) CL
command.
LOWEST_AUTHENTICATION_METHOD VARCHAR(10) The lowest level of password security required. This value was
set using the Change DDM TCP/IP Attributes (CHGDDMTCPA) CL
command.
PREV_AUTOSTART_SERVER VARCHAR(4) The previous value for whether the DDM server is automatically
started.
Contains the null value if ENTRY_TYPE is not M or if the previous
value is not available.
PREV_LOWEST_AUTHENTICATION_ VARCHAR(10) The previous value for the lowest level of password security
METHOD required.
Contains the null value if ENTRY_TYPE is not M or if the previous
value is not available.
PREV_LOWEST_ENCRYPTION_ VARCHAR(4) The previous value for the lowest encryption algorithm allowed on
ALGORITHM an incoming connection request.
Contains the null value if ENTRY_TYPE is not M or if the previous
value is not available.
Example
• List the DRDA configuration changes related to authentication made this month.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the ST audit journal entry.
A Service record
CD QTACTLDV, QTADMPDV
CE QWTCTLTR
CS STRCPYSCN
CT DMPCLUTRC
DC DLTCMNTRC
DD DMPDLO
DF QWTDMPFR, QWTDMPLF
DI QSCDIRD
DM DMPMEMINF
DO DMPOBJ
DU DMPUSRPRF
EC ENDCMNTRC
ER ENDRMTSPT
GS QSMGSSTD
HD QYHCHCOP (DASD)
HL QYHCHCOP (LPAR)
MC QWTMAINT (change)
MD QWTMAINT (dump)
OP Operations console
PC PRTCMNTRC
PE PRTERRLOG, QTADMPDV
SERVICE_TOOL (continued)
PI PRTINTDTA, QTADMPDV
PS QP0FPTOS
SC STRCMNTRC, QSCCHGCT
SE QWTSETTR
SJ STRSRVJOB
SN QPZSYNC
SR STRRMTSPT
SS QFPHPSF
ST STRSST
SV QSRSRV
TA TRCTCPAPP
TO QTOBSRV
TQ QWCTMQTM
UD QTAUPDDV
WE ENDWCH, QSCEWCH
WS STRWCH, QSCSWCH
WT WRKTRC
TARGET_JOB_USER_IDENTITY VARCHAR(10) The job user identity value of the target job.
Contains the null value if there is no target job.
DMPSYSOBJ_LIBRARY VARCHAR(30) Name of the library for the object for DMPSYSOBJ.
Contains the null value when SERVICE_TOOL is not DS.
AA_COMMAND_NAME VARCHAR(30) Advanced Analysis Command name. See QMGTOOLS: Run AA Macros
Contains the null value when SERVICE_TOOL is not GS.
ACTIVATE Activate
DEACTIVATE Deactivate
SERVICE_TOOLS_PROFILE VARCHAR(10) The name of the service tools profile used for Start System Service Tools
(STRSST).
Contains the null value when SERVICE_TOOL is not ST or OP.
*DIRECT
*HMC
*LAN
*RECOVERY
*TAKEOVER
*IPV4
*IPV6
CURRENT_IP_ADDRESS VARCHAR(45) The IP address of the current console device for *LAN.
Contains the null value when SERVICE_TOOL is not OP or CONSOLE_TYPE is
not *LAN.
CURRENT_DEVICE_ID VARCHAR(10) The service tools device ID of the current console device for *LAN.
Contains the null value when SERVICE_TOOL is not OP or CONSOLE_TYPE is
not *LAN.
PREVIOUS_IP_ADDRESS VARCHAR(45) The IP address of the previous console device for *LAN.
Contains the null value when SERVICE_TOOL is not OP or CONSOLE_TYPE is
not *LAN or there is no previous console device.
PREVIOUS_DEVICE_ID VARCHAR(10) The service tools device ID of the previous console device for *LAN.
Contains the null value when SERVICE_TOOL is not OP or CONSOLE_TYPE is
not *LAN or there is no previous console device.
SERVICE_TOOL_USERID VARCHAR(10) Service tools user ID if storage was altered from DST or *DEBUG if storage
was altered by a remote service tool debugger.
Contains the null value when SERVICE_TOOL is not AS.
USER_PROFILE VARCHAR(10) User profile name if storage was altered from SST.
Contains the null value when SERVICE_TOOL is not AS.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_ST (STARTING_TIMESTAMP => CURRENT DATE)
)
WHERE SERVICE_TOOL = 'ST' AND NUMBER_OF_ALTERED_BYTES > 0;
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the SV audit journal entry.
E Change to option
SYSTEM_VALUE VARCHAR(10) The name of the system value or service attribute that was changed. Can
contain one of the following special values.
OLD_VALUE VARCHAR(1500) The value of the system value or service attribute before it was changed.
NEW_VALUE VARCHAR(1500) The new value of the system value or service attribute.
Example
• List any system value changes that have been made in the current calendar year.
SELECT *
FROM TABLE (
SYSTOOLS.AUDIT_JOURNAL_SV (STARTING_TIMESTAMP => TRUNC_TIMESTAMP(CURRENT DATE, 'YEAR'))
)
WHERE ENTRY_TYPE = 'A';
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the ZC audit journal entry.
C Change of an object
ACCESS_TYPE INTEGER Type of access. See Numeric codes for access types for a list of the
codes for access types.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if there is no ASP information.
IFS_ACCESS_TYPE VARCHAR(50) IFS access type. See QP0LJRNL in QSYSINC/H for the list of values.
Contains the null value if the operation was not for an IFS object.
IFS_ACCESS_TYPE_DETAIL VARCHAR(2000) CCSID 1208 Descriptive text that corresponds to IFS_ACCESS_TYPE. The
value is returned as an array within a JSON object.
It is formatted as:{"IFS_ACCESS_LIST":["first-string",
"second-string", ...]}
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
READ WRITE The file containing the image catalog entry is read/
write capable.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_VOLUME_ID VARCHAR(32) Volume ID of the image catalog entry. Can contain the special value
*GEN.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_WRITE_PROTECTION VARCHAR(3) The write protection for the image catalog entry.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_VIRTUAL_DEVICE VARCHAR(10) The name of the virtual device for the image catalog entry.
Contains the null value if the operation was against an image
catalog, the image catalog is not in Ready status, or the object type
is not *IMGCLG.
Example
• List objects in the IFS that start with the letters 'data' that were modified in the last week.
The first columns returned by this table function are from the common audit journal entry header. See Common columns returned from the
audit journal entry header for the column definitions. After the common columns are the following columns that describe the entry specific
data for the ZR audit journal entry.
R Read of an object
ACCESS_TYPE INTEGER Type of access. See Numeric codes for access types for a list of the
codes for access types.
OBJECT_ASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP) in which the object
resides. A value of *SYSBAS indicates the system ASP and all basic
user ASPs.
Contains the null value if there is no ASP information.
Contains the null value if the object is not in the "root" (/),
QOpenSys, or user-defined file systems.
READ WRITE The file containing the image catalog entry is read/
write capable.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_VOLUME_ID VARCHAR(32) Volume ID of the image catalog entry. Can contain the special value
*GEN.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_WRITE_PROTECTION VARCHAR(3) The write protection for the image catalog entry.
Contains the null value if the operation was against an image catalog
or the object type is not *IMGCLG.
IMGCLGE_VIRTUAL_DEVICE VARCHAR(10) The name of the virtual device for the image catalog entry.
Contains the null value if the operation was against an image
catalog, the image catalog is not in Ready status, or the object type
is not *IMGCLG.
Example
• List objects in APPLIB that were read in the last 2 days.
journal-name
JOURNAL_NAME =>
, receiver-library
STARTING_RECEIVER_LIBRARY =>
, receiver-name
STARTING_RECEIVER_NAME =>
, starting-timestamp
STARTING_TIMESTAMP =>
, starting-sequence
STARTING_SEQUENCE =>
, journal-codes
JOURNAL_CODES =>
, journal-types
JOURNAL_ENTRY_TYPES =>
, object-library
OBJECT_LIBRARY =>
, object-name
OBJECT_NAME =>
, object-type
OBJECT_OBJTYPE =>
, object-member
OBJECT_MEMBER =>
, user , job
USER => JOB =>
, program
PROGRAM =>
, ending-receiver-library
ENDING_RECEIVER_LIBRARY =>
, ending-receiver-name
ENDING_RECEIVER_NAME =>
, ending-timestamp
ENDING_TIMESTAMP =>
, ending-sequence
ENDING_SEQUENCE =>
, generate-syslog
GENERATE_SYSLOG =>
, eof-delay
EOF_DELAY =>
, commit-cycle
COMMIT_CYCLE =>
)
, include-internal
INCLUDE_INTERNAL =>
journal- A character or graphic string expression that identifies the name of the library containing
library the journal. The name cannot be *LIBL or *CURLIB.
*CURRENT The journal receiver that is currently attached when starting to convert
journal entries is used.
*CURCHAIN The journal receiver chain that includes the journal receiver that is
currently attached when starting to convert journal entries is used. This
receiver chain does not cross a break in the chain. If there is a break in
the chain, the receiver range is from the most recent break in the chain
through the receiver that is attached when starting to convert journal
entries.
*CURAVLCHN The journal receiver chain that includes the journal receiver that is
attached when starting to convert journal entries is used. This receiver
chain does not cross a break in the chain. If there is a break in the chain,
the receiver range is from the most recent break in the chain through
the receiver that is attached when starting to convert journal entries.
If journal receivers exist in the receiver chain that are not available
because they were saved with the storage freed option, those journal
receivers will be ignored and entries will be converted starting with the
first available journal receiver in the chain.
*CURSEQCHN The journal receiver chain that includes the journal receiver that is
attached when starting to convert journal entries is used, starting with
the most recent journal receiver in which the journal sequence number
was reset if the journal sequence number was reset in the receiver
chain. This receiver chain does not cross a break in the chain. If there is
a break in the chain, the receiver range is from the most recent break in
the chain through the receiver that is attached when starting to convert
journal entries. If journal receivers exist in the receiver chain that are
not available because they were saved with the storage freed option,
those journal receivers will be ignored and entries will be converted
starting with the first available journal receiver in the chain.
starting- A decimal expression that identifies the starting sequence number to use. If the starting-
sequence sequence value is not found in the receiver range, an error is returned.
A value cannot be specified for both starting-timestamp and starting-sequence.
If no starting sequence is specified, the first sequence number in the receiver range is
used.
2 The accuracy of the entry timestamp stored in journal receivers is only accurate to 16 microseconds.
Hence, a value passed as a starting_timestamp and ending_timestamp will be truncated such that the
actual timestamps being searched for may be from 0 to 15 microseconds less than the specified value.
journal- A character or graphic string expression that lists the journal entry types to return. The
types string can contain the special values of *ALL or *RCD, or it can be a list of one or more
journal entry types. Journal entry types in the string can be separated by one or more
separators. Separators are blank and comma. For example, a valid string can be 'JFCT' or
'JF CT' or 'JF,CT' or 'JF, CT'.
If no string is provided, *ALL is used.
object- A character or graphic string expression that identifies the name of an object library. The
library values *LIBL and *CURLIB are allowed.
object-name A character or graphic string expression that contains up to 300 object names. Multiple
names can be separated by one or more separators. Separators are blank and comma.
If object-name is the special value of *ALL, object-library must contain a library name and
object-type must contain a valid object type. Otherwise, each object name must identify a
valid object using the same object-library, object-type, and object-member parameters.
If no object name is provided, a value of *ALLFILE is used for the journaled file name on
the API interface.
object-type A character or graphic string expression that identifies the system object type for the
object. The value must be *DTAARA, *DTAQ, *FILE, or *LIB.
object- A character or graphic string expression that identifies the name of a member. It can be a
member special value of *FIRST, *ALL, or *NONE or a valid member name. If the object type is not
*FILE, the member name is ignored.
user A character or graphic string expression that identifies the user profile name for the
current user of the job. If user is not specified, *ALL is used.
job A character or graphic string expression that identifies the name of a job. Two forms of a
job name are supported.
1. A fully qualified job name in the form job-number/job-user/job-name.
2. The first 10 characters are the job name, the second 10 characters are the user name,
and the last 6 characters are the job number.
If job is not specified, *ALL is used.
program A character or graphic string expression that identifies the name of a program. If program
is not specified, *ALL is used.
ending- A character or graphic string expression that identifies the name of the ending journal
receiver- receiver library. The name can be *LIBL or *CURLIB. If ending-receiver-name is not
library *CURRENT, a value for ending-receiver-library must be specified.
The value of this parameter is ignored if eof-delay is greater than zero.
ending- A character or graphic string expression that identifies the name of the ending journal
receiver- receiver. If the special value *CURRENT is specified, the ending-receiver-library value will
name be ignored. Otherwise, the ending-receiver-name and ending-receiver-library must identify
a valid journal receiver.
If ending-receiver-name is not specified, *CURRENT is used.
The value of this parameter is ignored if eof-delay is greater than zero.
ending- A decimal expression that identifies the ending sequence number to use. If the ending-
sequence sequence value is not found in the receiver range, an error is returned.
A value cannot be specified for both ending-timestamp and ending-sequence. This
parameter cannot be specified if eof-delay is greater than zero.
If no ending sequence is specified, the last sequence number in the receiver range is
used.
When ending-sequence is used, the query results will end when the first ending sequence
value is encountered. If the journal has had its sequence numbers reset, ending-sequence
will only return results through the first match of ending-sequence.
generate- A character or graphic string expression that indicates whether to transform journal
syslog entries into syslog formatted detail. Values are:
DISPLAY_JOURNAL only returns syslog information for the audit journal. If RFC3164 or
RFC5424 is specified, journal-library must be QSYS and journal-name must be QAUDJRN.
If generate-syslog is not specified or is the null value, NO is used.
eof-delay An integer expression that specifies the number of seconds to sleep when all audit journal
entries have been read. This delay allows the caller to establish a polling service that will
continually return rows, sleeping for the specified interval whenever all entries have been
processed.
A value of zero indicates no delay is used and a finite set of rows will be returned. A value
greater than zero indicates that the table function will sleep, as needed, to wait for new
audit journal entries and never end. If eof-delay is not specified or is the null value, zero is
used.
If this parameter has a value greater than zero, the generate-syslog parameter must be
RFC3164 or RFC5424, the ending-receiver-library and ending-receiver-name are ignored,
and the ending-timestamp and ending-sequence parameters cannot be specified with a
value other than their default values.
When using a non-zero eof-delay parameter, avoid using query clauses that depend on
returning a finite number of rows. For example, using the FETCH FIRST n ROWS clause
can cause the query to end when the requested number of rows has been satisfied. A
query using the DISPLAY_JOURNAL function with a non-zero eof-delay parameter does
commit- A decimal expression that identifies the commit cycle identifier to use.
cycle
If commit-cycle is not specified, *ALL is used.
include- A character or graphic string expression that indicates whether to return hidden journal
internal entries. Hidden entries are generated and used by the system. When hidden entries
are returned, it is possible to display all journal entries so all sequence numbers are
accounted for.
The special values supported for the function arguments are the same as for the Display Journal
(DSPJRN) CL command.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 191. DISPLAY_JOURNAL table function
ENTRY_TIMESTAMP TIMESTAMP The system date and time when the journal entry was added to the journal
receiver2.
COUNT_OR_RRN BIGINT Contains either the relative record number (RRN) of the record that caused the
journal entry or a count that is pertinent to the specific type of journal entry.
ENTRY_DATA BLOB(2G) The entry specific data returned for this journal entry.
See Notes section for row and column access control considerations.
NULL_VALUE_INDICATORS VARCHAR(8000) The null value indicators returned for this journal entry.
OBJECT VARCHAR(30) The name of the object for which the journal entry was added.
OBJECT_TYPE_INDICATOR CHAR(1) An indicator with respect to the information in the object field.
FILE_TYPE_INDICATOR CHAR(1) Identifies whether or not this journal entry is associated with a logical file.
USER_NAME VARCHAR(10) The name of the effective user profile under which the job was running when the
entry was created.
This value is identical to what is returned in the CURRENT_USER column.
JOB_NAME VARCHAR(10) The name of the job that added the entry.
JOB_USER VARCHAR(10) The user profile name of the user that started the job.
JOB_NUMBER VARCHAR(6) The job number of the job that added the entry.
THREAD BIGINT Identifies the thread within the process that added the journal entry.
PROGRAM_NAME VARCHAR(10) The name of the program that added the entry.
PROGRAM_LIBRARY VARCHAR(10) The name of the library that contains the program that added the journal entry.
PROGRAM_LIBRARY_ASP_DEVICE VARCHAR(10) The name of the ASP device that contains the program.
PROGRAM_LIBRARY_ASP_NUMBER INTEGER The number for the auxiliary storage pool that contains the program that added
the journal entry.
NESTED_COMMIT_LEVEL BIGINT Indicates the nesting level of the commit cycle that was open when a journal
entry representing an object level change was deposited.
XID VARCHAR(140) The transaction identifier, as defined by the Open Group's XA specification, for
commit cycles related to an XA transaction branch.
LUW VARCHAR(39) The logical unit of work identifies entries to be associated with a given unit of
work.
REMOTE_PORT INTEGER The port number of the remote address associated with this journal entry.
REMOTE_ADDRESS VARCHAR(46) The remote address associated with the journal entry.
SYSTEM_NAME VARCHAR(8) The name of the system on which the entry is being retrieved.
SYSTEM_SEQUENCE_NUMBER DECIMAL(21,0) The system sequence number indicates the relative sequence of when this journal
entry was deposited into the journal.
REFERENTIAL_CONSTRAINT CHAR(1) Whether this entry was recorded for actions that occurred on records that are part
of a referential constraint.
TRIGGER CHAR(1) Whether this entry was created as result of a trigger program.
IGNORE_ON_APPLY CHAR(1) Whether this entry is ignored during an Apply Journaled Changes (APYJRNCHG) or
Remove Journaled Changed (RMVJRNCHG) command.
MINIMIZED_ENTRY_DATA CHAR(1) Whether this entry has minimized entry specific data as a result of the journal
having specified MINENTDTA for the object type of the entry.
MINIMIZED_ON_FIELD_BOUNDARY CHAR(1) Whether this entry has minimized entry specific data on field boundaries as a
result of the journal having been specified with MINENTDTA(*FLDBDY).
RECEIVER_NAME VARCHAR(10) The name of the receiver holding the journal entry.
RECEIVER_LIBRARY VARCHAR(10) The name of the library containing the receiver holding the journal entry.
RECEIVER_ASP_DEVICE VARCHAR(10) The name of the ASP device containing the receiver holding the journal entry.
RECEIVER_ASP_NUMBER INTEGER The number for the auxiliary storage pool containing the receiver holding the
journal entry.
ARM_NUMBER INTEGER The number of the disk arm that contains the journal entry.
CURRENT_USER VARCHAR(10) The name of the effective user profile under which the job was running when the
entry was created.
This value is identical to what is returned in the USER_NAME column.
SYSLOG_EVENT VARGRAPHIC(2048) The Common Event Format (CEF) syslog event for the journal entry preceded with
CCSID 1200 a header of the requested type. If a header-type of RFC3164 is requested, the
maximum length is 1024 characters. If a header-type of RFC5424 is requested,
the maximum length is 2048 characters. The string will be truncated with no
warning if it exceeds the maximum length.
The audit journal entry types that generate syslog information and the key names
returned for journal entries are listed in the Notes section.
Contains the null value if there is no syslog event defined for the journal entry or if
NO was specified for the GENERATE_SYSLOG parameter.
Contains the null value if there is no syslog event defined for the journal entry or if
NO was specified for the GENERATE_SYSLOG parameter.
2 Critical condition
4 Warning condition
6 Informational message
The severity assigned to each journal entry is listed in the Notes section.
Contains the null value if there is no syslog event defined for the journal entry or if
NO was specified for the GENERATE_SYSLOG parameter.
Notes
Row and column access control: This table function recognizes whether ROW ACCESS CONTROL or
COLUMN ACCESS CONTROL exists and is activated for the target table. If any row or column access
control is active for the table, the rule text logic defined for the row permissions and/or column masks is
applied before returning the value in ENTRY_DATA. When the rule text for a row permission determines
that the user invoking the function should not see the row, the ENTRY_DATA column contains the text NOT
AUTHORIZED. If the user is allowed to see the row and a column mask exists, the rule text for the column
mask determines the value returned for ENTRY_DATA.
LOB data considerations: For journal code R (any entry type) and code F (IZ entry type), when a LOB data
type is encountered that is not a zero-length string, 16 'Q's are placed in the Entry Specific Data, followed
by the LOB data.
Filtering considerations: When using DISPLAY_JOURNAL to review journal activity for specific objects,
there are some considerations to ensure complete results are returned.
• When querying the audit journal (JOURNAL_LIBRARY => 'QSYS' and JOURNAL_NAME => 'QAUDJRN'),
do not use the object filters because they will result in no entries being returned. For an audit journal,
use a WHERE clause to limit the rows returned.
• When querying a data journal, consider whether it's possible that the Journal Identifier (JID) has
changed for the object. The object filters use the JID found in the object and will not return any entries
with a different JID. If the JID for the object might have changed, avoid using the object filters. In this
case, use a WHERE clause to limit the rows returned.
Syslog information: Syslog information is returned for all audit journal entries with T and U journal codes.
Syslog information is also available for history log messages. See HISTORY_LOG_INFO table function for
more details.
The following audit journal entries with T journal codes generate syslog information:
Audit journal entries with the U journal code are assigned a SYSLOG_SEVERITY of 6. The audit journal
entries with T journal codes are assigned a SYSLOG_SEVERITY value in the following way:
Examples
• Select all entries from the *CURRENT receiver of journal TESTLIB/QSQJRN.
• Find all changes made by SUPERUSER against the PRODDATA/SALES table. The first two arguments
are passed without names since they correspond with the first two parameters for the function. The
other four arguments are passed using the parameter name syntax to avoid specifying a value for the
parameters that are not needed.
• Review audit journal entries for the REQUESTS file in MYCO library. For an audit journal, a predicate is
used to designate the object name.
• Review changes from the last hour for the REQUESTS file in MYCO library using the current JID. This
query will only find entries where the JID of MYCO/REQUESTS *FILE is an exact match to the entry. It
filters for the following three journal codes:
• Review all changes from the last hour for the REQUESTS file in MYCO library, including any that might
have a different Journal ID (JID). To see entries for all JIDs, a predicate is used to designate the object
name.
• Select entries from the audit journal that return syslog information and format them with an RFC5424
header.
JOURNAL_INFO view
The JOURNAL_INFO view contains information about journals, including remote journals.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
Journal Information (QJORJRNI) API. Refer to the API for more detailed information.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the journal, and
• *OBJOPR and some data authority other than *EXECUTE to the journal
The following table describes the columns in the view. The system name is JRNINFO. The schema is
QSYS2.
Table 193. JOURNAL_INFO view
JOURNAL_LIBRARY SYS_DNAME VARCHAR(10) The name of the library that contains the journal.
ASP_NUMBER ASPNUMBER INTEGER The number of the auxiliary storage pool to which
storage for the journal is allocated.
JOURNAL_ASPGRP JRNASPGRP VARCHAR(10) The name of the auxiliary storage pool (ASP) in
which the journal resides. A value of *SYSBAS
indicates the system ASP and all basic user ASPs.
ATTACHED_JOURNAL_RECEIVER_NAME ATTRCVNAME VARCHAR(10) The name of the journal receiver that is currently
attached to this journal.
Nullable
Contains the null value when there is no attached
receiver.
ATTACHED_JOURNAL_RECEIVER_LIBRARY ATTRCVLIB VARCHAR(10) The name of the library that contains the attached
journal receiver.
Nullable
Contains the null value when there is no attached
receiver.
MESSAGE_QUEUE MSGQNAME VARCHAR(10) The name of the message queue that is associated
with this journal.
MESSAGE_QUEUE_LIBRARY MSGQLIB VARCHAR(10) The name of the library that contains the message
queue.
DELETE_RECEIVER_DELAY DLTRCVDLY INTEGER The delay time (in minutes) between attempts
to delete journal receivers associated with this
Nullable journal.
Contains the null value when
DELETE_RECEIVER_OPTION is NO.
JOURNAL_TYPE TYPE VARCHAR(10) The scope of the journal and some of its
characteristics.
NUMBER_JOURNAL_RECEIVERS NUMJRNRCV INTEGER The total number of journal receivers that are
associated with the journal.
TOTAL_SIZE_JOURNAL_RECEIVERS SIZJRNRCV BIGINT The total size of the journal receivers (in kilobytes)
associated with the journal.
NUMBER_REMOTE_JOURNALS RMTJRNS INTEGER The total number of remote journals that are
directly downstream of this journal.
MAXIMUM_REMOTE_JOURNALS_ MAXRMTENTB INTEGER The maximum number of entries that are waiting
ENTRIES_BEHIND to be sent to the target system for any remote
Nullable journal.
Contains the null value if
NUMBER_REMOTE_JOURNALS is 0 or if no
attached remote journals are active with async
delivery mode.
MAXIMUM_REMOTE_JOURNALS_ MAXRMTRETR BIGINT The maximum value for any remote journal
RETRANSMISSIONS of the total number of times the local
Nullable system retransmitted a segment because an
acknowledgement was not received.
Contains the null value if
NUMBER_REMOTE_JOURNALS is 0 or if no
attached remote journals are active using TCP/IP.
MANAGE_RECEIVER_OPTION MNGRCVOPT VARCHAR(10) Indicates whether the system or user manages the
changing of journal receivers.
Nullable
*SYSTEM The system manages the changing of
journal receivers.
MANAGE_RECEIVER_DELAY MNGRCVDLY INTEGER The delay time (in minutes) between attempts to
attach new journal receivers to this journal.
Nullable
Contains the null value when
MANAGE_RECEIVER_OPTION is *USER or the null
value.
RECEIVER_MAXIMUM_SIZE MAXOPT VARCHAR(10) The receiver size option that applies to this journal
receiver.
Nullable
*MAXOPT1 The journal receivers attached
to the journal can have a
maximum receiver size of
approximately one terabyte
(1,099,511,627,776 bytes) and a
maximum sequence number of
9,999,999,999. Additionally, the
maximum size of the journal
entry that can be deposited is
15,761,440 bytes.
MINIMIZE_ESD_FOR_DATA_AREAS MINDTAARA VARCHAR(3) Indicates whether journal entries for data areas
may have minimized entry specific data.
Nullable
NO Journal entries for data areas do not have
minimized entry specific data.
MINIMIZE_ESD_FOR_FILES MINFILE VARCHAR(19) Indicates whether journal entries for files may
have minimized entry specific data.
Nullable
MINIMIZED Journal entries for files may
have minimized entry specific
data. The minimizing does
not occur on field boundaries.
Therefore, the entry specific
data may not be viewable and
may not be used for auditing
purposes.
FIXED_LENGTH_DATA_INCLUDES_ FLDJOB VARCHAR(3) Indicates whether the job name will be stored
JOB_NAME when journal entries are deposited.
Nullable
NO The job name will not be stored when
journal entries are deposited.
FIXED_LENGTH_DATA_INCLUDES_ FLDUSR VARCHAR(3) Indicates whether the user name will be stored
USER_NAME when journal entries are deposited.
Nullable
NO The user name will not be stored when
journal entries are deposited.
FIXED_LENGTH_DATA_INCLUDES_ FLDPGMLIB VARCHAR(3) Indicates whether the program library name will
PROGRAM_LIBRARY be stored when journal entries are deposited.
Nullable
NO The program library name will not be
stored when journal entries are deposited.
FIXED_LENGTH_DATA_INCLUDES_ FLDLUW VARCHAR(3) Indicates whether the logical unit of work identifier
LOGICAL_UNIT_OF_WORK_ID will be stored when journal entries are deposited.
Nullable
NO The logical unit of work identifier will
not be stored when journal entries are
deposited.
JOURNALED_OBJECT_LIMIT JRNOBJLMT VARCHAR(10) The number of objects that can be journaled to the
journal.
Nullable
*MAX250K The maximum number of objects
that can be journaled to the journal
is 250,000.
JOURNALED_FILES JRNFILE INTEGER The total number of files that are currently being
journaled to this journal.
Nullable
Contains the null value for a remote journal.
JOURNALED_MEMBERS JRNMBR INTEGER The total number of file members that are
currently being journaled to this journal.
Nullable
Contains the null value for a remote journal.
JOURNALED_DATA_AREAS JRNDTAARA INTEGER The total number of data areas that are currently
being journaled to this journal.
Nullable
Contains the null value for a remote journal.
JOURNALED_DATA_QUEUES JRNDTAQ INTEGER The total number of data queues that are currently
being journaled to this journal.
Nullable
Contains the null value for a remote journal.
JOURNALED_IFS_OBJECTS JRNIFS INTEGER The total number of integrated file system objects
of type *DIR, *STMF, and *SYMLNK that are
Nullable currently being journaled to this journal.
Contains the null value for a remote journal.
JOURNALED_ACCESS_PATHS JRNAP INTEGER The total number of access paths that are currently
being journaled to this journal.
Nullable
Contains the null value for a remote journal.
JOURNALED_LIBRARIES JRNLIB INTEGER The total number of libraries that are currently
being journaled to this journal.
Nullable
Contains the null value for a remote journal.
REMOTE_JOURNAL_TYPE RMTJRNTYPE VARCHAR(10) The type of remote journal. Values are *TYPE1 and
*TYPE2.
Nullable
Contains the null value for a local journal.
JOURNAL_DELIVERY_MODE DELIVMODE VARCHAR(10) The journal delivery mode that is being used to
replicate journal entries to this journal.
Nullable
*ASYNC Journal entries are being
delivered or replicated
asynchronously.
LOCAL_JOURNAL_NAME LCLJRNNAME VARCHAR(10) The journal name of the local journal. The local
journal is the journal that is the initiator of the
Nullable original journal deposit that has been replicated
downstream to this journal.
Contains the null value for a local journal.
LOCAL_JOURNAL_SYSTEM LCLJRNSYS VARCHAR(8) The name of the system for the local journal.
SOURCE_JOURNAL_NAME SRCJRNNAME VARCHAR(10) The journal name of the source journal. The source
journal is the journal that is directly upstream of
Nullable this journal.
Contains *UNKNOWN if journal is a remote journal
and does not have an attached receiver.
Contains the null value for a local journal.
SOURCE_JOURNAL_SYSTEM SRCJRNSYS VARCHAR(8) The name of the system for the source journal.
Examples
• List all journals that are falling behind sending entries to one or more remote journals:
• For security auditing reasons, find any journals that are not recording remote address info:
JOURNAL_RECEIVER_INFO view
The JOURNAL_RECEIVER_INFO view contains information about all journal receivers on the system.
The values returned for the columns in the view are closely related to the values returned by the Retrieve
Journal Receiver Information (QjoRtvJrnReceiverInformation) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the journal receiver, and
JOURNAL_RECEIVER_LIBRARY JRNRCV_LIB VARCHAR(10) The name of the library that contains the journal
receiver.
JOURNAL_RECEIVER_ASP_NUMBER RCV_ASPNUM INTEGER The number of the auxiliary storage pool to which
storage for the journal receiver is allocated.
JOURNAL_RECEIVER_ASP_NAME RCV_ASPNAM VARCHAR(10) The name of the auxiliary storage pool (ASP) in
which the journal receiver resides. A value of
*SYSBAS indicates the system ASP or a basic user
ASP.
JOURNAL_LIBRARY JRN_LIB VARCHAR(10) The name of the library that contains the journal.
Nullable Contains the null value if the receiver has never
been attached to a journal.
JOURNAL_NAME JOURNAL VARCHAR(10) The name of the journal that the journal receiver is
Nullable attached to or used to be attached to.
Contains the null value if the receiver has never
been attached to a journal.
NUMBER_OF_JOURNAL_ENTRIES ENTRIES DECIMAL(20,0) The number of journal entries that are contained in
Nullable this journal receiver.
Contains the null value if STATUS is EMPTY.
FIRST_SEQUENCE_NUMBER FIRST_SEQ DECIMAL(21,0) The journal sequence number of the first journal
Nullable entry in this journal receiver.
Contains the null value if STATUS is EMPTY.
LAST_SEQUENCE_NUMBER LAST_SEQ DECIMAL(21,0) The journal sequence number of the last journal
Nullable entry in this journal receiver.
Contains the null value if STATUS is EMPTY.
ATTACH_TIMESTAMP ATTACHED TIMESTAMP(0) The date and time that this journal receiver was
Nullable attached to the journal. For a journal receiver
attached to a remote journal, this is the date and
time that the journal receiver was attached on the
local system.
Contains the null value if STATUS is EMPTY.
DETACH_TIMESTAMP DETACHED TIMESTAMP(0) The date and time that this journal receiver was
Nullable detached from the journal. For a journal receiver
attached to a *REMOTE journal, this is the date and
time that the journal receiver was detached on the
local system.
Contains the null value if STATUS is EMPTY,
ATTACHED, or PARTIAL.
SAVE_TIMESTAMP SAVED TIMESTAMP(0) The date and time that the journal receiver was
Nullable last saved. This value reflects when the receiver
was saved from the system it exists on (either the
source or target system time).
Contains the null value if the journal receiver was
never saved.
PREVIOUS_JOURNAL_RECEIVER_LIBRARY PREV_RCVL VARCHAR(10) The name of the library of the previous journal
Nullable receiver that is associated with the same journal.
Contains the null value if STATUS is EMPTY, if there
was no journal receiver attached to the journal
prior to this journal receiver, or if it is currently
associated with a remote journal.
PREVIOUS_JOURNAL_RECEIVER PREV_RCV VARCHAR(10) The name of the previous journal receiver that is
Nullable associated with the same journal.
Contains the null value if STATUS is EMPTY, if there
was no journal receiver attached to the journal
prior to this journal receiver, or if it is currently
associated with a remote journal.
NEXT_JOURNAL_RECEIVER_LIBRARY NEXT_RCVL VARCHAR(10) The name of the library of the next journal receiver
Nullable that is associated with the same journal.
v
NEXT_JOURNAL_RECEIVER NEXT_RCV VARCHAR(10) The name of the next journal receiver that is
Nullable associated with the same journal.
v
RECEIVER_MAXIMUM_SIZE MAXOPT pendin The journal receiver sequence number and size
option for this journal receiver. If this journal
VARCHAR(8) receiver is attached to a remote journal, the value
Nullable is determined by the local journal.
MINIMIZE_ESD_FOR_DATA_AREAS MINDTAARA VARCHAR(3) Whether the entry-specific data for data areas is
Nullable minimized. If this journal receiver is attached to a
remote journal, the value for is determined by the
local journal.
FIXED_LENGTH_DATA_INCLUDES_JOB_NAME FLDJOB VARCHAR(3) Indicates whether the job name is stored when
Nullable journal entries are deposited.
FIXED_LENGTH_DATA_INCLUDES_USER_NAME FLDUSR VARCHAR(3) Indicates whether the user name is stored when
Nullable journal entries were deposited.
FIXED_LENGTH_DATA_INCLUDES_ FLDLUW VARCHAR(3) Indicates whether the logical unit of work identifier
LOGICAL_UNIT_OF_WORK_ID Nullable is stored when journal entries were deposited.
LOCAL_JOURNAL_SYSTEM LCLJRNSYS VARCHAR(8) The system name of the local journal. The local
Nullable journal is the journal that is the initiator of the
original journal deposit that has been replicated
downstream to this journal.
Contains the null value if the journal receiver was
not attached to a remote journal.
LOCAL_JOURNAL_NAME LCLJRNNAME VARCHAR(10) The name of the local journal. The local journal
Nullable is the journal that is the initiator of the
original journal deposit that has been replicated
downstream to this journal.
Contains the null value if the journal receiver was
not attached to a remote journal.
LOCAL_JOURNAL_RECEIVER_LIBRARY LCLRCVLIB VARCHAR(10) The library name of the journal receiver that is
Nullable associated with the local journal.
Contains the null value if the journal receiver was
not attached to a remote journal.
SOURCE_JOURNAL_NAME SRCJRNNAME VARCHAR(10) The name of the source journal. The source journal
Nullable is the journal that is directly upstream of this
remote journal.
Contains the null value if the journal receiver was
not attached to a remote journal.
SOURCE_JOURNAL_RECEIVER_LIBRARY SRCRCVLIB VARCHAR(10) The library name of the journal receiver that is
Nullable associated with the source journal.
Contains the null value if the journal receiver was
not attached to a remote journal.
REDIRECTED_RECEIVER_LIBRARY REDIR_LIB VARCHAR(10) The *TYPE1 receiver library redirection that was in
Nullable effect when this journal receiver was attached.
Contains the null value if the journal receiver
was not attached to a remote journal or
REMOTE_JOURNAL_TYPE is not *TYPE1.
FILTER_IMAGES FTR_IMAGE VARCHAR(7) Specifies whether before images will be sent to the
Nullable remote journal.
FILTER_PROGRAMS FTR_PGM INTEGER The number of programs for which journal entries
Nullable sent on behalf of these programs were filtered
when sent to this journal receiver. These programs
are listed in the FILTER_PROGRAM_ARRAY and
FILTER_PROGRAM_JSON columns.
Contains the null value if the journal receiver was
not attached to a remote journal.
FILTER_PROGRAM_JSON FTR_LISTJ VARCHAR(498) CCSID A list of programs and libraries. Journal entries
1208 sent on behalf of these programs were filtered
Nullable when sent to this journal receiver. The program’s
library name may be *ALL.
This list is returned as an array within a JSON
object. Each entry in the JSON array contains two
JSON objects:
• An object with a name of "LIBRARY" and a value
of the library name containing the program
• An object with a name of "PROGRAM" and a
value of the program name
Contains the null value if the journal receiver
was not attached to a remote journal or
FILTER_PROGRAMS is zero.
Examples
• Return a list of journal receivers that have not been saved.
• Return the length of time, in seconds, that journal receivers in RCVLIB were attached.
• Return a list of programs contained in the FILTER_PROGRAMS_JSON column related to journal receiver
RCV1 in RCVLIB.
JOURNAL_LIBRARY JRNLIB VARCHAR(10) The name of the library that contains the journal.
IASP_NUMBER IASPNUMBER INTEGER The number of the auxiliary storage pool to which
storage for the journal is allocated.
*DIR Directory
*LIB Library
OBJECT_LIBRARY OBJ_LIB VARCHAR(10) The name of the library that contains the object.
Nullable Contains the null value if OBJECT_TYPE is *DIR,
*STMF, or *SYMLNK.
PATH_NAME PATH_NAME DBCLOB(16M) CCSID The path name of an integrated file system object.
1200
Contains the null value if OBJECT_TYPE is not
Nullable *DIR, *STMF, or *SYMLNK.
FILE_IDENTIFIER FILE_ID BINARY(16) The identifier associated with the integrated file
system object.
Nullable
Contains the null value if OBJECT_TYPE is not
*DIR, *STMF, or *SYMLNK.
OMIT_JOURNAL_ENTRY OMIT_ENTRY VARCHAR(10) Specifies the journal entries that are omitted.
INHERIT INHERIT VARCHAR(4) Specifies whether new objects created within this
journaled directory or library, moved into this
Nullable journaled directory or library, or restored into this
journaled directory or library should inherit the
journal state of the parent directory or library.
SELECT *
FROM QSYS2.JOURNALED_OBJECTS
WHERE OBJECT_LIBRARY = 'APPLIB' AND JOURNAL_NAME = 'APPJRN'
ORDER BY OBJECT_TYPE, OBJECT_LIBRARY, OBJECT_NAME, PATH_NAME;
MANAGE_AUDIT_JOURNAL_DATA_MART procedure
The MANAGE_AUDIT_JOURNAL_DATA_MART procedure populates a table with audit journal data for a
specific audit journal entry type from a specified time period, or deletes an existing data mart table.
The table is created in the specified library with the name AUDIT_JOURNAL_xx where xx corresponds to
the specified audit journal entry type. For example, when creating a data mart for the PW (Password) audit
journal entry, a table named AUDIT_JOURNAL_PW is created. The procedure uses “Audit journal entry
services” on page 658 to populate the table. The result of the call to the procedure, including any failure
message, is returned by the QSYS2.AUDIT_JOURNAL_DATA_MART_INFO view.
Authorization:
To call this procedure when data-mart-action is ADD, the caller must have:
• *AUDIT special authority
• *USE authority to the library that contains the audit journal data mart
• *OBJOPR and *ADD authority to the AUDIT_JOURNAL_xx table
• *USE and *OBJEXIST authority to the audit journal
• *USE authority to all requested journal receivers
To call this procedure when data-mart-action is CREATE, the caller must have:
• *AUDIT special authority.
• *OBJOPR, *READ, *ADD, and *EXECUTE authority to the library that contains the audit journal data mart
• *USE and *OBJEXIST authority to the audit journal
• *USE authority to all requested journal receivers
To call this procedure when data-mart-action is DROP, the caller must have:
• *AUDIT special authority
• *USE authority to the library that contains the audit journal data mart
• *OBJOPR and *OBJEXIST authority to the AUDIT_JOURNAL_xx table
To call this procedure when data-mart-action is REPLACE, the caller must have:
• *AUDIT special authority
• *OBJOPR, *READ, *ADD, and *EXECUTE authority to the library that will contain the audit journal data
mart
• *OBJOPR, *OBJMGT, *OBJEXIST, *ADD, and *DLT authority to the AUDIT_JOURNAL_xx table
• *USE and *OBJEXIST authority to the audit journal
• *USE authority to all requested journal receivers
journal-entry-type
JOURNAL_ENTRY_TYPE =>
, data-mart-library
DATA_MART_LIBRARY =>
, starting-timestamp
STARTING_TIMESTAMP =>
, ending-timestamp
ENDING_TIMESTAMP =>
)
, data-mart-action
DATA_MART_ACTION =>
journal- A character or graphic string expression that identifies the journal entry type to include
entry-type in the data mart. Only journal entry types that have corresponding “Audit journal entry
services” on page 658 are supported.
data-mart- A character or graphic string expression that identifies the library that contains the data
library mart table or where the data mart table is to be created.
data-mart-library must exist.
starting- A character or graphic string expression that identifies the starting timestamp to use.
timestamp If no timestamp is provided,
• *CONTINUE is used when data-mart-action is ADD.
• *FIRST is used when data-mart-action is CREATE or REPLACE.
• starting-timestamp will be ignored when data-mart-action is DROP.
*CONTINUE A timestamp just after the last value for ENTRY_TIMESTAMP in the
AUDIT_JOURNAL_xx table is used.
*FIRST The attach time for the oldest, attached journal receiver is used.
data-mart- A character or graphic string expression that indicates the type of action to perform. If no
action string is provided, CREATE is used.
ADD Inserts data into an existing data mart table and adds an
entry for this data-mart-library and journal-entry-type to the
AUDIT_JOURNAL_DATA_MART_INFO table.
If the table does not exist, an error is returned.
Notes
The resulting AUDIT_JOURNAL_xx table will have the same format as the corresponding “Audit journal
entry services” on page 658 table function. The table is owned by the caller who first creates the table
and *PUBLIC is configured with *EXCLUDE authority. The system name of the table is AJ_xx. The table is
not managed by the system. It is up to the user to grant access to other users and to maintain the table.
To view an AUDIT_JOURNAL_xx table, the caller must have:
• *USE authority to the library that contains the AUDIT_JOURNAL_xx table.
• *OBJOPR and *READ authority to the AUDIT_JOURNAL_xx table.
Examples
• Build a data mart for PW audit journal entries from the last month in the DMARTLIB library.
• Add journal data for PW entries to the existing data mart in DMARTLIB.
REMOTE_JOURNAL_INFO view
The REMOTE_JOURNAL_INFO view returns information about every remote journal defined for a local or
remote journal on the IBM i where this view is referenced. The remote journals returned by this service
exist on a different IBM i, as noted by the remote database (RDB) name.
This information is similar to what is returned by the Retrieve Journal Information
(QjoRetrieveJournalInformation) API.
SOURCE_JOURNAL SRC_JRN VARCHAR(10) The name of the journal that has the remote
journal defined.
REMOTE_DATABASE_NAME RMT_RDB VARCHAR(18) The name of the remote database that is the
target and contains the remote journal.
REMOTE_JOURNAL RMT_JRN VARCHAR(10) The name of the remote journal that is the target
for remote journaling.
REMOTE_JOURNAL_RECEIVER_LIBRARY RMT_RCVLIB VARCHAR(10) The library name of the remote journal receiver
that is the target for remote journaling.
The special value of *SRCRCVLIB indicates the
journal receivers are created on the target system
in the same library as they exist on the source
system.
REMOTE_JOURNAL_TYPE RMT_JTYPE VARCHAR(6) The type of remote journal that was created.
The type influences characteristics of the remote
journal such as journal receiver restore options,
redirection capabilities, and remote journal
association support.
DELIVERY_MODE DELIVERY VARCHAR(10) The remote journal delivery mode that is being
used to replicate journal entries to the remote
Nullable journal.
DATA_PORT_SERVICES_NODE_ID NODE_ID VARCHAR(8) The node identifier being used by data port
services to identify the target system in a cluster
Nullable environment. If a node identifier and at least
one internet address is retrieved, then data
port services is being used as an alternate
communication method to the target system.
Contains the null value if the remote journal is not
configured for data port services.
DATA_PORT_SERVICES_ADDRESS_1 IP_ADDR1 VARCHAR(45) The first internet address being used by data port
services to communicate to the target system.
Nullable
Contains the null value if the remote journal is not
configured for data port services.
DATA_PORT_SERVICES_ADDRESS_3 IP_ADDR3 VARCHAR(45) The third internet address being used by data port
services to communicate to the target system.
Nullable
Contains the null value if the remote journal is not
configured for data port services or there are less
than three internet addresses being used.
DATA_PORT_SERVICES_ADDRESS_4 IP_ADDR4 VARCHAR(45) The fourth internet address being used by data
port services to communicate to the target
Nullable system.
Contains the null value if the remote journal is not
configured for data port services or there are less
than four internet addresses being used.
SENDING_TASK_PRIORITY PRIORITY INTEGER The priority of the sending task on the source
system.
Nullable
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE or
DELIVERY_MODE is not *ASYNC or *ASYNCPEND.
MAXIMUM_RESTART_ATTEMPTS MAXRESTART INTEGER The number of times the operating system will
attempt to reactivate the remote journal after a
Nullable recoverable failure.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE.
FILTER_PROGRAM_JSON FTR_LISTJ VARCHAR(498) CCSID A list of programs and libraries. Journal entries
1208 sent on behalf of these programs were filtered
Nullable when sent to this journal receiver. The program’s
library name may be *ALL.
This list is returned as an array within a JSON
object. Each entry in the JSON array contains two
JSON objects:
• An object with a name of "LIBRARY" and
a value of the library name containing the
program
• An object with a name of "PROGRAM" and a
value of the program name
Contains the null value if the journal receiver
was not attached to a remote journal or
FILTER_PROGRAMS is zero.
BUNDLES_SENT BUNDLES BIGINT The number of bundles that have been sent
to the target system since the source journal
Nullable transitioned to an active state.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE.
MAXIMUM_BUNDLE_SIZE BUNDLE_SIZ BIGINT The number of bytes in the largest bundle that
has been sent to the target system since the
Nullable source journal transitioned to an active state.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE.
MAXIMUM_BUNDLE_SIZE_TIME BUNDLE_TIM TIMESTAMP The date and time that the maximum bundle size
was sent to the target system.
Nullable
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE or
MAXIMUM_BUNDLE_SIZE is 0.
SUPER_BUNDLE_MODE_COUNT SUPER_CNT BIGINT The number of times that the remote journal
environment has automatically gone into super
Nullable bundling mode. Super bundling mode helps the
remote journal environment keep up with the
local journal when the local journal has a high rate
of journal entry deposits.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE or
DELIVERY_MODE is not *ASYNC or *ASYNCPEND.
ENTRIES_BEHIND BEHIND BIGINT The number of entries that are waiting to be sent
to the target system.
Nullable
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE or
DELIVERY_MODE is not *ASYNC or *ASYNCPEND.
LAST_CATCHUP_TIME LAST_CATCH TIMESTAMP The date and time that the remote journal
environment last transitioned to DELIVERY_MODE
Nullable *ASYNCPEND or *SYNCPEND.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE.
LAST_ACTIVE_TIME LAST_ACT TIMESTAMP The date and time that the remote
journal environment last transitioned from
Nullable DELIVERY_MODE *ASYNCPEND or *SYNCPEND to
DELIVERY_MODE *ASYNC or *SYNC.
Contains the null value if
REMOTE_JOURNAL_STATE is INACTIVE
CONTROLLED_INACTIVATE_SEQUENCE_ INACT_SEQ DECIMAL(21,0) The sequence number of the last journal entry
NUMBER that was queued for replication before the Change
Nullable Remote Journal (CHGRMTJRN) command or the
Change Journal State (QjoChangeJournalState)
API was called to start a controlled inactivate of
the remote journal.
Contains the null value if
REMOTE_JOURNAL_STATE is not CTLINACT.
CONTROLLED_INACTIVATE_JOURNAL_ INACTJRCVL VARCHAR(10) The library of the journal receiver that contains
RECEIVER_LIBRARY the
Nullable CONTROLLED_INACTIVATE_SEQUENCE_NUMBE
R.
Contains the null value if
REMOTE_JOURNAL_STATE is not CTLINACT.
CONTROLLED_INACTIVATE_JOURNAL_ INACTJRCV VARCHAR(10) The name of the journal receiver that contains the
RECEIVER CONTROLLED_INACTIVATE_SEQUENCE_NUMBE
Nullable R.
Contains the null value if
REMOTE_JOURNAL_STATE is not CTLINACT.
SOURCE_JOURNAL_IASP_NUMBER SRC_ASPNUM INTEGER The number of the auxiliary storage pool to which
storage for the journal that has the remote journal
defined is allocated.
Example
• Return information about remote journals defined for system RMTSYS1.
SMAPP_ACCESS_PATHS view
The SMAPP_ACCESS_PATHS view returns a list of access paths which are monitored by System-Managed
Access Path Protection (SMAPP).
Some access paths are ineligible for SMAPP protection. See How the system chooses access paths to
protect for more details.
Authorization: The caller must have *JOBCTL special authority.
The following table describes the columns in the view. The system name is SMAPP_AP. The schema is
QSYS2.
Table 197. SMAPP_ACCESS_PATHS view
SYSTEM_TABLE_SCHEMA LIB_NAME VARCHAR(10) The library containing the database file associated
with the access path.
SYSTEM_TABLE_NAME FILE_NAME VARCHAR(10) The database file associated with the access path.
ASP_NUMBER ASPNUMBER INTEGER The number of the auxiliary storage pool containing
the access path.
IASP_NAME IASP_NAME VARCHAR(10) The name of the auxiliary storage pool containing
the access path. The special value of *SYSBAS is
returned if ASP_NUMBER is not greater than or equal
to 33.
STATUS STATUS VARCHAR(11) The eligibility and protection status of the access
path.
INELIGIBLE_REASON INELIG_RSN VARCHAR(17) The reason that the access path is not eligible for
access protection.
Nullable
MULTIPLE The access path is built over
JOURNALS physical files which are journaled
to separate journals.
ESTIMATED_RECOVERY EST_RECOV BIGINT The estimated amount of time, in seconds, that the
system would take to recover the access path during
an initial program load (IPL) or during the vary on of
an independent ASP after an abnormal system end if
the access path is not chosen for protection.
Example
• List all the access paths in APPLIB that are not currently protected.
Librarian Services
These services provide object and library list information.
JOURNAL_INHERIT_RULES view
The JOURNAL_INHERIT_RULES view returns the journal inherit rules for libraries.
The rules define which objects created in a library, moved into a library, or restored into a library should
inherit the journal state of the library and the inherited journal attributes.
Each rule defines object types, object names, and operations that the rule applies to. Multiple rules can
be defined for the same set of objects. If multiple rules are defined for the same object and operation, the
last rule defined for that object will be applied.
This information is similar to the journal inherit rules returned by the Retrieve Library Description
(QLIRLIBD) API.
Authorization: The caller must have *READ authority to the library.
LIBRARY_NAME LIBRARY VARCHAR(10) The name of the library for this rule.
JOURNALED JOURNALED VARCHAR(3) The current journaling status of the library. Rules are only in
effect when the library is journaled.
IASP_NUMBER IASPNUMBER INTEGER The number of the auxiliary storage pool (ASP) from which
the system allocates storage for the library.
IASP_NAME IASP_NAME VARCHAR(10) The device description name of the independent auxiliary
storage pool (IASP).
The special value of *SYSBAS indicates SYSBASE, which
includes the system ASP (ASP 1) and the basic user ASPs
(ASPs 2-32).
ORDINAL_POSITION ORDINAL INTEGER The order this rule was added for this library. The number
starts at one for each library and increments by one for
every additional rule for that library. If more than one rule
is defined for any object, the one with the higher number will
be used.
OBJECT_TYPE TYPE VARCHAR(7) Specifies the object type of the objects that are identified by
this rule.
OPERATION OPERATION VARCHAR(10) The operations performed on the object type for which
journaling is to be started if other criteria specified for the
object type are also satisfied.
RULE_ACTION ACTION VARCHAR(8) Indicates whether the objects that match the object type and
operation in this rule will be included or omitted from the list
of objects that inherit the journal options and journal state of
the library.
NAME_FILTER NAMEFILTER VARCHAR(10) The object names of the objects that are identified by this
rule.
Nullable
name This rule applies to all objects that match the
other criteria and match the specified name.
JOURNAL_IMAGES IMAGES VARCHAR(7) The kinds of journal images that are written to the journal
receiver for changes to objects that inherit the journal
Nullable options and journal state from the library.
OMIT_JOURNAL_ENTRY OMIT_ENTRY VARCHAR(7) The journal entries that are not to be written for changes to
objects that inherit the journaling options and state of the
Nullable library.
REMOTE_JOURNAL_FILTER RMT_FILTER VARCHAR(7) Specifies whether the journal entries written for the objects
that inherit the journal state of the library should be eligible
Nullable for remote journal filtering by object.
Example
• Retrieve the journal inherit rules for library APPLIB.
LIBRARY_INFO ( library-name
LIBRARY_NAME =>
, ignore-errors
IGNORE_ERRORS =>
)
, detailed-info
DETAILED_INFO =>
NO An error is returned.
YES A warning is returned.
No row is returned when an error is encountered. This is the default.
LIBRARY_SIZE All the columns including the LIBRARY_SIZE column are returned. For
a library with a large number of objects, LIBRARY_SIZE can be a time
consuming calculation. This is the default.
NO Null is returned for the LIBRARY_SIZE column.
The result of the function is a table containing one row with the format shown in the following table. All
the columns are nullable.
Table 199. LIBRARY_INFO table function
OBJECT_COUNT INTEGER The total number of external objects in the specified library. The count
includes objects to which you may not be authorized.
LIBRARY_SIZE BIGINT The size of the library, in bytes, which includes the size of the objects in the
library plus the size of the library object itself. This value will be a rounded
value for a library larger than 1 000 000 000 bytes.
Contains the null value if detailed-info is NO.
NO Some objects in the library were omitted because they were locked,
or the user does not have any authority to the object.
YES The size of all the objects in the library was used in determining the
total library size.
TEST The library is a test library. All objects in a test library can be
updated during a test. See the Start Debug (STRDBG) command in
the on-line help for more details.
TEXT_DESCRIPTION VARCHAR(50) The user-defined text that briefly describes the library and its function.
Contains the null value if the library has no descriptive text.
IASP_NAME VARCHAR(10) The auxiliary storage pool (ASP) device name where the library is stored.
If the library is in the system ASP or one of the basic user ASPs, contains
*SYSBAS.
Contains the null value if the name of the ASP device cannot be determined.
IASP_NUMBER INTEGER The number of the auxiliary storage pool (ASP) from which the system
allocates storage for the library.
CREATE_AUTHORITY VARCHAR(10) The default public authority for an object created into the library. This is
the authority given to a user who does not have specific authority to the
object, who is not on an authorization list specified for the object, and
whose user groups have no specific authority to the object. When you create
an object into the library, the AUT parameter on the create command for the
object determines the public authority for the object. If the AUT value on
the create command for the object is *LIBCRTAUT, which is the default, the
public authority for the object is set to the CRTAUT value for the library.
*CHANGE The user can read the object description and has
read, add, update, and delete authority to an object
created in this library.
*USE The user can read the object and its description but
cannot change them for an object created in this
library.
OBJECT_AUDIT_CREATE VARCHAR(7) The auditing value for objects created in this library.
*NONE Use or change access to the object is not logged (no audit
entry is sent to the security journal).
*USRPRF The user profile of the user who accesses the object
is used to determine if an audit record is sent for this
access. The OBJAUD parameter of the Change User Auditing
(CHGUSRAUD) command is used to turn auditing on for a
specific user.
Contains the null value if caller does not have either all object (*ALLOBJ) or
audit (*AUDIT) special authority.
JOURNAL_LIBRARY VARCHAR(10) The name of the library that contains the journal that receives the journaled
changes to the library, if the library is currently journaled. If the library was
previously journaled but is not currently journaled, contains the name of the
library that contains the last journal to which the library was journaled.
Contains the null value if journaling has never been started for this library.
JOURNAL_NAME VARCHAR(10) The name of the journal that receives the journaled changes to the library, if
the library is currently journaled. If the library was previously journaled but
is not currently journaled, contains the name of the last journal to which the
library was journaled.
Contains the null value if journaling has never been started for this library.
INHERIT_JOURNALING VARCHAR(3) Identifies whether new journal-eligible objects created into, moved into, or
restored into this library should inherit journaling from the library according
to the journal inherit rules.
NO The new journal-eligible objects will not inherit journaling from the
library.
YES The new journal-eligible objects will inherit journaling from the
library according to the journal inherit rules.
JOURNAL_INHERIT_RULES INTEGER The number of inherit rules defined for this library. The rules can be listed
using the QSYS2.JOURNAL_INHERIT_RULES view.
JOURNAL_START_TIMESTAMP TIMESTAMP The timestamp journaling was last started for this library.
Contains the null value if journaling has never been started for this library.
APPLY_STARTING_RECEIVER_LIBRARY VARCHAR(10) Specifies the library name of the oldest journal receiver needed to
successfully use the Apply Journaled Changes (APYJRNCHG) command.
Contains the null value if the object has not been journaled or it has not
been saved and restored since journaling was started.
APPLY_STARTING_RECEIVER VARCHAR(10) Specifies the name of the oldest journal receiver needed to successfully use
the Apply Journaled Changes (APYJRNCHG) command.
Contains the null value if the object has not been journaled or it has not
been saved and restored since journaling was started.
APPLY_STARTING_RECEIVER_ASP VARCHAR(10) The auxiliary storage pool (ASP) device name where
APPLY_STARTING_RECEIVER is stored. If APPLY_STARTING_RECEIVER is
in the system ASP or one of the basic user ASPs, contains *SYSBAS.
Contains the null value if the name of the ASP device cannot be determined.
Example
• Retrieve information about library APPLIB.
LIBRARY_LIST_INFO view
The LIBRARY_LIST_INFO view contains information about the current job's library list.
The information returned is similar to the detail available through the DSPLIBL (Display Library List) CL
command.
Authorization: None required.
The following table describes the columns in the view. The system name is LIBLIST. The schema is
QSYS2.
Table 200. LIBRARY_LIST_INFO view
Nullable
TYPE TYPE VARCHAR(15) The portion of the library list containing the
selected library. Possible values are:
IASP_NUMBER IASP SMALLINT The number of the auxiliary storage pool where
storage is allocated for the library.
Nullable
Example
• See the current library list for your job
object-type-list
OBJTYPELIST =>
)
, object-name
OBJECT_NAME =>
object- A character or graphic string expression that identifies the name of a library. If the library's
schema name is a delimited name, the delimited form of the name must be specified. It can be either
a long or short library name.
The following special values are allowed for object-schema.
The following special value is allowed for object-schema when object-type-list is '*LIB' or 'LIB'.
*ALLSIMPLE The fastest approach to retrieving all user and system library names
in *SYSBAS and the current thread's ASP group. Values are returned
for the following columns: OBJNAME, OBJLONGNAME, OBJTYPE, OBJLIB,
OBJLONGSCHEMA, IASP_NUMBER, and IASP_NAME. All other columns
return NULL.
object- A character or graphic string expression containing one or more system object types
type-list separated by either a blank or a comma. The object types can include or exclude the leading
* character. The special value of '*ALL' or 'ALL' can be used to return all objects in the library
object-schema.
object- A character or graphic string expression that identifies the name of an object or a library. If
name the object's name is a delimited name, the delimited form of the name must be specified.
It can be either a long or short object name. The name must be the valid system name for
the object unless the object is a file or a library; for files and libraries the SQL name can be
specified.
A generic name can be specified to find multiple system objects. If the last character in the
name is an asterisk, the name is a generic name. For example, to return object names that
start with 'EMP', specify an object-name value of 'EMP*'. When a generic name is specified,
long SQL names are not included in the search.
If this parameter is specified, only objects with this name in object-schema corresponding to
the object types in object-type-list are returned.
If this parameter is not specified, all objects in object-schema corresponding to the object
types in object-type-list are returned.
If object-schema is *ALL, *ALLSIMPLE, *ALLAVL, *ALLUSR, or *ALLUSRAVL and object-type is
*LIB or LIB, the object-name parameter is ignored.
*ALLSIMPLE The fastest approach to retrieving the system names for objects in a library.
All objects in object-schema corresponding to the object types in object-type-
list are returned. Values are returned for the following columns: OBJNAME,
OBJTYPE, OBJLIB, OBJLONGSCHEMA, IASP_NUMBER, and IASP_NAME. All
other columns return NULL.
The result of the function is a table containing a row for each object with the format shown in the following
table. All the columns are null capable.
Table 201. OBJECT_STATISTICS table function
LAST_USED_TIMESTAMP TIMESTAMP The date the object was used last. The time portion of the timestamp will always
be 0.
Contains the null value if the object has not been used.
LAST_USED_OBJECT VARCHAR(4) Indicates whether the LAST_USED_TIMESTAMP value is meaningful for this
object.
DAYS_USED_COUNT INTEGER The number of days an object has been used on the system.
LAST_RESET_TIMESTAMP TIMESTAMP The date when the days used count was last reset to zero. The time portion of the
timestamp will always be 0.
Contains the null value if the days used count has not been reset.
IASP_NUMBER SMALLINT The auxiliary storage pool (ASP) where storage is allocated for the object.
IASP_NAME VARCHAR(10) The device description name of the independent auxiliary storage pool (IASP).
The special value of *SYSBAS indicates SYSBASE, which includes the system ASP
(ASP 1) and the basic user ASPs (ASPs 2-32).
TEXT VARGRAPHIC(50) CCSID The description of the object for *LIB objects.
1200
Contains the null value if OBJTYPE is not *LIB.
CHANGE_TIMESTAMP TIMESTAMP The timestamp of the last time the object was changed.
USER_CHANGED VARCHAR(3) Indicates whether the object was modified by a user. Values are:
Contains the null value for certain objects that are installed as part of the
operating system.
SOURCE_FILE VARCHAR(10) The name of the source file that was used to create the object.
Contains the null value if a source file was not used.
SOURCE_LIBRARY VARCHAR(10) The name of the source file library that was used to create the object.
Contains the null value if a source file was not used.
SOURCE_MEMBER VARCHAR(10) The name of the source file member that was used to create the object.
Contains the null value if a source file was not used.
SOURCE_TIMESTAMP TIMESTAMP The last source update timestamp of the member in the source file at the time
the object was created.
Contains the null value if a source file was not used or if the source timestamp is
not available.
CREATED_SYSTEM VARCHAR(8) The name of the system on which the object was created.
CREATED_SYSTEM_VERSION VARCHAR(9) The version of the operating system when the object was created. The field has a
VxRxMx format where:
LICENSED_PROGRAM VARCHAR(7) The name of the licensed program if the object is part of a licensed program.
Contains the null value if the object is not a part of a licensed program.
LICENSED_PROGRAM_VERSION VARCHAR(9) The version number, release level, and modification level of the licensed program
if the object is part of a licensed program. The field has a VxRxMx format where:
Contains the null value if the object is not a part of a licensed program.
COMPILER_VERSION VARCHAR(9) The licensed program version number, release level, and modification level of the
compiler. The field has a VxRxMx format where:
Contains the null value if the object was not created with a compiler.
PTF_NUMBER CHAR(7) The Program Temporary Fix that resulted in the creation of this object.
Contains the null value for a user created object.
APAR_ID CHAR(6) The authorized program analysis report (APAR) with this identification number
associated with the last change.
Will contain the value CHGDFT for a command that is changed using
CHGCMDDFT.
The Change Object Description (QLICOBJD) API can change this field to any
value.
Contains the null value is no value is available.
USER_DEFINED_ATTRIBUTE VARCHAR(10) Further defines an object type. This field is set by the user by using the
QLICOBJD API.
Contains the null value if the attribute has not been set.
ALLOW_CHANGE_BY_PROGRAM VARCHAR(3) Identifies whether or not any changes other than the text or the days used count
and reset date can be made to the object's description by the Change Object
Description (QLICOBJD) API.
YES The QLICOBJD API can be used to change fields in the object's
description.
CHANGED_BY_PROGRAM VARCHAR(3) Identifies whether the object has been modified by the Change Object
Description (QLICOBJD) API.
COMPRESSED VARCHAR(4) Indicates whether the object is compressed or decompressed. Values are:
YES Compressed.
Contains the null value if the object is permanently decompressed and not
compressible.
PRIMARY_GROUP VARCHAR(10) The name of the user profile that is the primary group for the object.
Contains the null value if there is no primary group for the object.
NO The storage for the object data has not been freed.
YES The storage for the object data has been freed. See the SAVOBJ or
SAVLIB command, STG parameter, for more details.
ASSOCIATED_SPACE_SIZE INTEGER The size, in bytes, of the primary associated space of the object.
Contains the null value if the object has no primary associated space.
OPTIMUM_SPACE_ALIGNMENT VARCHAR(3) Identifies whether the primary associated space for the object has been
optimally aligned. Optimum alignment may allow for better performance of
applications that manipulate the object.
NO The space associated with the object has not been optimally aligned.
YES The space associated with the object has been optimally aligned.
OVERFLOW_STORAGE VARCHAR(3) Indicates if the object has overflowed the auxiliary storage pool it resides in.
OBJECT_DOMAIN VARCHAR(7) The domain that contains the object. Values are:
*USRPRF Audit this object only if the current user is being audited. The
current user is tested to determine if auditing should be done for
this object. The user profile can specify if only change access is
audited or if both read and change accesses are audited for this
object.
*CHANGE Audit all change access to this object by all users on the system.
*ALL Audit all access to this object by all users on the system. All access
is defined as a read or change operation.
Contains the null value if you do not have either all object (*ALLOBJ) or audit
(*AUDIT) special authority.
SYSTEM_TRUSTED_SOURCE VARCHAR(3) Indicates whether the object is signed by a source that is trusted by the system.
NO None of the object signatures came from a source that is trusted by the
system.
YES The object is signed by a source that is trusted by the system. If the
object has multiple signatures, at least one of the signatures came from
a source that is trusted by the system.
MULTIPLE_SIGNATURES VARCHAR(3) Indicates whether the object has more than one digital signature.
NO The object has only one digital signature or does not have a digital
signature.
SAVE_WHILE_ACTIVE_TIMESTAMP TIMESTAMP The timestamp at which the object was saved while active.
Contains the null value if the object has not been saved while active.
SAVE_DEVICE VARCHAR(5) The type of the device to which the object was last saved. Valid values are:
Contains the null value if the object has not been saved.
SAVE_FILE_LIBRARY VARCHAR(10) The save file library used to save the object.
Contains the null value if the object was not last saved to a save file.
SAVE_VOLUME VARCHAR(71) The tape or optical volumes used to save the object. A maximum of ten volumes
is returned. The string contains one blank between volume identifiers. If more
than ten volumes were used, an ellipsis (three periods) is returned to the right of
the identifier of the tenth volume.
Contains the null value if the object was not last saved to tape or optical.
SAVE_LABEL VARCHAR(17) The file label used when the object was saved to tape or optical.
Contains the null value if the object was not last saved to tape or optical.
SAVE_SEQUENCE_NUMBER DECIMAL(10,0) The sequence number used to when the object was saved to tape.
Contains the null value if the object was not last saved to tape.
LAST_SAVE_SIZE DECIMAL(15,0) The size of the object in bytes at the time of the last save. This value defines the
amount of storage that is required if the object is restored.
Contains the null value if the object has not been saved.
JOURNALED VARCHAR(3) Identifies the current journaling status of the object. Valid values are:
JOURNAL_NAME VARCHAR(10) The name of journal that receives the journaled changes or the name of the last
journal if the object is not currently journaled.
Contains the null value if the object has not been journaled.
JOURNAL_LIBRARY VARCHAR(10) The name of journal library that receives the journaled changes or the name of
the last journal library if the object is not currently journaled.
Contains the null value if the object has not been journaled.
JOURNAL_IMAGES VARCHAR(6) Specifies the kinds of images that are generated for changes to the object. Valid
values are:
*AFTER Only after images are generated for changes to the object.
*BOTH Both before and after images are generated for changes to the
object.
Contains the null value if the object has not been journaled.
OMIT_JOURNAL_ENTRY VARCHAR(7) Specifies the journal entries that are omitted. Valid values are:
*OPNCLO Open and close entries are omitted. Open and close operations on
the specified file members do not create open and close journal
entries.
Contains the null value if the object has not been journaled.
REMOTE_JOURNAL_FILTER VARCHAR(3) The remote journal filter value for the object. Valid values are:
NO The journal entries deposited for the object will not be eligible for remote
journal filtering.
YES The journal entries deposited for the object will be eligible for remote
journal filtering.
Contains the null value if the object has not been journaled.
APPLY_STARTING_RECEIVER VARCHAR(10) Specifies the name of the oldest journal receiver needed to successfully use
the Apply Journaled Changes (APYJRNCHG) or Remove Journaled Changes
(RMVJRNCHG) command.
Contains the null value if the object has not been journaled or it has not been
saved and restored since journaling was started.
APPLY_STARTING_RECEIVER_LIBRARY VARCHAR(10) Specifies the library name of the oldest journal receiver needed to successfully
use the Apply Journaled Changes (APYJRNCHG) or Remove Journaled Changes
(RMVJRNCHG) command.
Contains the null value if the object has not been journaled or it has not been
saved and restored since journaling was started.
AUTHORITY_COLLECTION_VALUE VARCHAR(10) Specifies the authority collection value used for the object when authority
collection for objects is active on the partition. Valid values are:
Example
• Find all journals in library MJATST.
or
or
• Find all programs and service programs in library MYLIB. Use *ALLSIMPLE to return the list quickly,
omitting the detail information.
• Find any CL commands that have had their parameter defaults changed.
SYSTEM_OBJECT_TYPES table
The SYSTEM_OBJECT_TYPES table returns a list of external object types found on IBM i.
Additional information about object types is available at this link: External object types
Authorization: None required.
The following table describes the columns in the table. The system name is OBJ_TYPES. The schema is
QSYS2.
System Column
Column Name Name Data Type Description
Example
List all the system object types that are found in libraries:
HISTORY_LOG_INFO (
start-time
START_TIME =>
, end-time
END_TIME =>
, generate-syslog
GENERATE_SYSLOG =>
)
, eof-delay
EOF_DELAY =>
start-time A timestamp expression that indicates the starting timestamp to use when returning
history log information.
If this parameter is omitted, the default of CURRENT DATE - 1 DAY is used.
end-time A timestamp expression that indicates the ending timestamp to use when returning history
log information.
generate- A character or graphic string expression that indicates whether to transform history log
syslog messages into syslog formatted detail. Values are:
eof-delay An integer expression that specifies the number of seconds to sleep when all history log
messages have been read. This delay allows the caller to establish a polling service that
will continually return rows, sleeping for the specified interval whenever all messages have
been processed.
A value of zero indicates no delay is used and a finite set of rows will be returned. A value
greater than zero indicates that the table function will sleep, as needed, to wait for new
history log messages and never end. If eof-delay is not specified or is the null value, zero is
used.
If this parameter has a value greater than zero, the generate-syslog parameter must be
RFC3164 or RFC5424, and the end-time parameter cannot be specified with a value other
than its default value.
When using a non-zero eof-delay parameter, avoid using query clauses that depend on
returning a finite number of rows. For example, using the FETCH FIRST n ROWS clause
can cause the query to end when the requested number of rows has been satisfied. A
query using the HISTORY_LOG_INFO function with a non-zero eof-delay parameter does
not allow data to be copied (ALWCPYDTA(*NO)). This means that a query requiring a copy
of data, such as one using an ORDER BY clause or UNION DISTINCT, will issue an error and
not be allowed. When using eof-delay, consider using a simple query to avoid blocking of
rows. When rows are blocked for data transport efficiency, rows won't be returned until the
block is full. Therefore, you should decide whether you favor data transport efficiency or
moving events as soon as they occur.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 203. HISTORY_LOG_INFO table function
ORDINAL_POSITION INTEGER A unique number for each row that indicates the time order of
messages in the job log. The first (oldest) message returned from the
history log will have a value of 1. Subsequent messages will have a
value one greater than the previous message. Since these values are
assigned when this catalog is queried, there will be no gaps in values.
FROM_USER VARCHAR(10) The current user of the job when the message was sent.
FROM_JOB VARCHAR(28) The qualified job name when the message was sent.
FROM_JOB_NAME VARCHAR(10) The name of the job when the message was sent.
FROM_JOB_USER VARCHAR(10) The user profile that started the job when the message was sent.
FROM_JOB_NUMBER VARCHAR(6) The job number of the job when the message was sent.
MESSAGE_LIBRARY VARCHAR(10) The name of the library containing the message file.
Contains the null value if MESSAGE_ID is null.
MESSAGE_TOKENS VARCHAR(4096) FOR BIT DATA The message token string. If the value is longer than 4096 characters,
it will be truncated with no warning.
Contains the null value if there are no message tokens.
MESSAGE_TEXT VARGRAPHIC(1024) CCSID 1200 The first level text of the message including tokens, or the impromptu
message text.
Contains the null value if MESSAGE_ID is null or if the message file
could not be accessed.
MESSAGE_SECOND_LEVEL_TEXT VARGRAPHIC(4096) CCSID 1200 The second level text of the message including tokens.
Contains the null value if MESSAGE_ID is null or if the message has no
second level text or if the message file could not be accessed.
SYSLOG_EVENT VARGRAPHIC(2048) CCSID 1200 The Common Event Format (CEF) syslog event for the message
preceded by a header of the requested type. If a header-type of
RFC3164 is requested, the maximum length is 1024 characters. If
a header-type of RFC5424 is requested, the maximum length is 2048
characters. The string will be truncated with no warning if it exceeds
the maximum length.
The key names returned for history log information are listed in the
Notes section.
Contains the null value if NO was specified for the
GENERATE_SYSLOG parameter.
1 user-level messages
4 security/authorization messages
3 Error condition
4 Warning condition
6 Informational message
Notes
Syslog information: Syslog information is returned for all messages in the history log. Syslog information
is also available for audit journal entries. See DISPLAY_JOURNAL table function for more details.
All history log messages return a SYSLOG_FACILITY value of 1 except as noted below. Messages are
assigned a SYSLOG_SEVERITY value in the following way:
• Severity 1 Alert: Action must be taken immediately
– MESSAGE_TYPE contains a value of INQUIRY, NOTIFY, or REPLY
• Severity 3 Error condition
– MESSAGE_ID contains a value of CPF1164 with a job ending code value in the MESSAGE_TEXT
column of 30 or higher
– MESSAGE_TYPE contains a value of ESCAPE when the SEVERITY column contains a value of 50 or
greater
• Severity 4 Warning condition
– MESSAGE_ID contains a value of CPF1393. The SYSLOG_FACILITY column is set to 4.
– MESSAGE_ID contains a value of CPF1164 with a job ending code value in the MESSAGE_TEXT
column of 20
– MESSAGE_TYPE contains a value of ESCAPE when the SEVERITY column contains a value of 30 or
greater but less than 50
Examples
• Return a list of history log messages for all of yesterday and today.
• Return a list of all history log messages for the last 24 hours.
• Return history log information since the last IPL, assuming that the last IPL timestamp is in a global
variable named LAST_IPL_TIME.
• Return syslog information formatted with an RFC3164 header for all history log messages from the start
of today forward into the future. When all history log messages have been returned to the caller, the
query will pause for 5 minutes (300 seconds) before checking again for messages.
JOBLOG_INFO ( job-name
JOB_NAME =>
)
, ignore-errors
IGNORE_ERRORS =>
job-name A character or graphic string expression that identifies the qualified name of a job. The
special value of '*' indicates the current job.
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 205. JOBLOG_INFO table function
ORDINAL_POSITION INTEGER A unique number for each row that indicates the time order of
messages in the job log. The first (oldest) message in the job log will
have a value of 1. Subsequent messages will have a value one greater
than the previous message. Since these values are assigned when this
catalog is queried, there will be no gaps in values. There is no visibility
of messages that have been deleted from the job log.
MESSAGE_TIMESTAMP TIMESTAMP The timestamp for when the message was issued.
FROM_LIBRARY VARCHAR(10) The library containing the program or service program that sent the
message.
FROM_PROGRAM VARCHAR(256) The program or service program name that sent the message.
TO_LIBRARY VARCHAR(10) The library containing the program or service program that received
the message
TO_PROGRAM VARCHAR(10) The program or service program name that received the message.
FROM_USER VARCHAR(10) The userid of the job when the message was sent.
MESSAGE_LIBRARY VARCHAR(10) The name of the library containing the message file.
MESSAGE_TOKENS VARCHAR(2048) FOR BIT DATA The message token string. If the value is longer than 2048 characters,
it will be truncated with no warning.
MESSAGE_TEXT VARGRAPHIC(1024) CCSID 1200 The first level text of the message including tokens.
MESSAGE_SECOND_LEVEL_TEXT VARGRAPHIC(4096) CCSID 1200 The second level text of the message including tokens.
QUALIFIED_JOB_NAME VARCHAR(28) The qualified name of the job for this job log.
Examples
• Return joblog information for job 347117/QUSER/QZDASOINIT.
MESSAGE_FILE_DATA view
The MESSAGE_FILE_DATA view returns one row for each message in a message file.
The information is similar to what is returned by the Display Message Description (DSPMSGD) CL
command and the Retrieve Message (QMHRTVM) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the message file, and
• *USE authority to the message file.
The following table describes the columns in the view. The system name is MSGF_DATA. The schema is
QSYS2.
Table 206. MESSAGE_FILE_DATA view
MESSAGE_DATA MSGDATA VARCHAR(2078) A string containing all the message data fields, also referred to
as substitution variables, for the message. The format of the
Nullable string is described following this table.
Contains the null value if no message data fields are defined.
LOG_PROBLEM LOGPRB VARCHAR(4) The log problem value for the message.
CREATION_LEVEL CRT_LEVEL INTEGER The level number of the message. This is a value from 1 to 99.
MODIFICATION_LEVEL MOD_LEVEL INTEGER The modification level number of the message. This is a value
from 1 to 99.
CCSID CCSID INTEGER The CCSID that applies to the stored values of MESSAGE_TEXT
and MESSAGE_SECOND_LEVEL_TEXT.
DEFAULT_PROGRAM_LIBRARY DFT_PGMLIB VARCHAR(10) The library specified for the default program. Can contain the
following special values:
Nullable
*CURLIB The current library is used.
DEFAULT_PROGRAM DFT_PGM VARCHAR(10) The name of the program called to take default action if
this message is sent as an escape message to a program or
Nullable procedure that is not monitoring for it.
Contains the null value if no default program is defined.
REPLY_TYPE REPLY_TYPE VARCHAR(6) The type of valid values that can be made to an inquiry or notify
message.
Nullable
*ALPHA Only an alphabetic string is valid. Blanks are not
allowed.
REPLY_LENGTH REPLY_LEN INTEGER The maximum length of a reply to an inquiry or notify message.
REPLY_DECIMAL_POSITIONS REPLY_DEC INTEGER The maximum number of decimal positions allowed in the
message reply.
Nullable
Contains the null value if there is no reply type or if REPLY_TYPE
is not *DEC.
VALID_REPLY_VALUES REPLY_VALS VARCHAR(659) The list of valid reply values. Each value is a character string with
a length of 32. One blank separates values.
Nullable
Contains the null value if no valid reply values are defined.
VALID_REPLY_LOWER_LIMIT LOWERLIMIT VARCHAR(32) The lower value limit for a valid reply.
Nullable Contains the null value if no range values for replies are defined.
VALID_REPLY_UPPER_LIMIT UPPERLIMIT VARCHAR(32) The upper value limit for a valid reply.
Nullable Contains the null value if no range values for replies are defined.
VALID_REPLY_RELATIONSHIP_ REL_OP CHAR(3) The relational operator for a relational test entry.
OPERATOR Nullable *EQ Equal to
VALID_REPLY_RELATIONSHIP_ REL_VALUE VARCHAR(32) The value to be compared to the reply entered for a relational
VALUE test entry.
Nullable
Contains the null value if no relationship for valid replies is
defined.
SPECIAL_REPLY_VALUES SPECIALVAL VARCHAR(1319) The list of special reply values. Each pair of values consists of
the from-value followed by a colon (:) followed by the to-value.
Nullable One blank separates each pair of values.
Contains the null value if no special reply values are defined.
DUMP_LIST DUMP_LIST VARCHAR(815) The list of data items to be dumped when the message is sent
as an escape message to a program that is not monitoring for it.
Nullable The list contains entries separated by a single blank.
Contains the null value if there is no dump list for this message.
ALERT_INDEX ALERTINDEX INTEGER The number of the message data field that is passed with the
alert.
Nullable
Contains the null value if no alert is sent or no message data
field is passed with the alert.
The MESSAGE_DATA column contains all of the substitution variables formatted as follows. A single blank
separates each variable attribute. There is one blank between each variable definition. The order of the
attributes is:
1. Variable identifier, such as &1.
2. Data type of the variable.
Example
Find any messages in the APPLIB/APPMSGS message file that contain the word VALUE in upper case,
lower case, or mixed case in either the message text or the second level message text.
, message-queue-name
QUEUE_NAME =>
, message-filter
MESSAGE_FILTER =>
)
, severity-filter
SEVERITY_FILTER =>
message- A character or graphic string expression that contains the name of the library containing
queue-library message-queue-name. If omitted, the default is QSYS.
message- A character or graphic string expression that contains the name of a message queue. If
queue-name omitted, the default is QSYSOPR.
message-filter A character or graphic string expression that indicates the type of messages to be
returned. The string can contain one or more of the following values separated by
blanks. Specifying 'COMPLETE INQUIRY SENDER' is the same as specifying ALL.
severity-filter An integer value indicating the minimum severity of messages to be returned. The value
must be from 0 to 99. The default is 0, indicating all messages are to be returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 207. MESSAGE_QUEUE_INFO table function
MESSAGE_TEXT VARGRAPHIC(1024) The first level text of the message including tokens, or the impromptu message
CCSID 1200 text.
Contains the null value if MESSAGE_TYPE is REPLY or if the message file could not
be accessed.
ASSOCIATED_MESSAGE_KEY BINARY(4) For MESSAGE_TYPE of REPLY, contains the associated inquiry or notify message
key.
Contains the null value for other message types.
FROM_USER VARCHAR(10) The current user of the thread when the message was sent.
FROM_JOB VARCHAR(28) The qualified job name of the job that sent the message.
MESSAGE_FILE_LIBRARY VARCHAR(10) The name of the library containing the message file.
Contains the null value if MESSAGE_ID is null or if the message file could not be
accessed.
MESSAGE_TOKENS VARCHAR(4096) FOR The message token string. If the value is longer than 4096 characters, it will be
BIT DATA truncated with no warning.
Contains the null value if there are no tokens.
MESSAGE_SECOND_LEVEL_TEXT VARGRAPHIC(4096) The second level text of the message including tokens.
CCSID 1200
Contains the null value if MESSAGE_ID is null or if the message has no second
level text or if the message file could not be accessed.
Example
• Return a list of inquiry messages in QSYSOPR that have not been replied to
MESSAGE_QUEUE_LIBRARY MSGQ_LIB VARCHAR(10) The name of the library containing the message queue.
MESSAGE_QUEUE_NAME MSGQ_NAME VARCHAR(10) The name of the message queue containing the message.
MESSAGE_TEXT MSG_TEXT VARGRAPHIC(102 The first level text of the message including tokens, or the
4) CCSID 1200 impromptu message text.
Nullable Contains the null value if the message file could not be accessed.
MESSAGE_TIMESTAMP MSG_TIME TIMESTAMP The timestamp when the message was sent.
ASSOCIATED_MESSAGE_KEY ASSOC_KEY BINARY(4) For MESSAGE_TYPE of REPLY, contains the associated inquiry or
notify message key.
Nullable
Contains the null value for other message types.
FROM_USER FROM_USER VARCHAR(10) The current user of the thread when the message was sent.
FROM_JOB FROM_JOB VARCHAR(28) The qualified job name of the job that sent the message.
MESSAGE_FILE_LIBRARY MSGF_LIB VARCHAR(10) The name of the library containing the message file.
MESSAGE_TOKENS MSG_TOKENS VARCHAR(4096) The message token string. If the value is longer than 4096
FOR BIT DATA characters, it will be truncated with no warning.
Nullable Contains the null value if there are no tokens.
MESSAGE_SECOND_LEVEL_TEXT MSG_TEXT2 VARGRAPHIC(409 The second level text of the message including tokens.
6) CCSID 1200
Contains the null value if MESSAGE_ID is null or if the message
Nullable has no second level text or if the message file could not be
accessed.
Example
• Examine all inquiry messages and their responses.
REPLY_INQUIRY_MESSAGES ( message_id
MESSAGE_ID =>
, search-message_text
SEARCH_MESSAGE_TEXT =>
, response
RESPONSE =>
)
, remove-message
REMOVE_MESSAGE =>
message-id A character string containing the message identifier of the inquiry message. The special
value *IMMED can be specified to indicate the message has no message identifier.
search- A character string containing a string that must exist in the message text in order for the
message-text inquiry message to be selected. The comparison is case insensitive.
When message-id is *IMMED, a value must be specified. Otherwise, a value is optional.
response A character string containing the response to be provided to any inquiry messages that
meet the message-id and search-string criteria.
If response is omitted or contains the value *DFT, the default reply stored in the message
description of the inquiry message is sent as the reply, or the system default reply of *N
is used.
remove- A character string that indicates whether the inquiry message and its reply are removed
message from the message queue.
The result of the function is an integer that indicates the number of inquiry messages that were
responded to.
Note
This function is provided in the SYSTOOLS schema as an example of how to respond to inquiry messages
in the QSYSOPR message queue using an SQL scalar function. Similar to other Db2 for i provided tools
within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper
functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Examples
• Respond to any inquiry messages for message identifier CPA7025. Leave the messages in the message
queue.
VALUES SYSTOOLS.REPLY_INQUIRY_MESSAGES(
MESSAGE_ID => 'CPA7025',
RESPONSE => 'I',
REMOVE_MESSAGE => 'NO'
);
• Respond to any impromptu inquiry messages containing the text string 'restore'.
VALUES SYSTOOLS.REPLY_INQUIRY_MESSAGES(
MESSAGE_ID => '*IMMED'
SEARCH_MESSAGE_TEXT => 'restore',
RESPONSE => 'CONTINUE',
REMOVE_MESSAGE => 'YES'
);
REPLY_LIST_INFO view
The REPLY_LIST_INFO view contains information about the current job's reply list entries.
The information returned is similar to the detail available through the Work with Reply List Entries
(WRKRPYLE) CL command.
Authorization: None required.
System Column
Column Name Name Data Type Description
SEQUENCE_NUMBER SEQNO SMALLINT The number that specifies the search order of the
entries in the reply list.
MESSAGE_ID MSGID VARCHAR(7) The identifier of the inquiry message for which
automatic system action is to be taken.
A value of ANY indicates that this reply list
entry matches any message identifier. Unless
comparison data is specified for this reply list
entry, all reply list entries with a sequence number
greater than this one are ignored.
COMPARISON_DATA COMPDATA VARGRAPHIC(28) CCSID The character string that is compared with the
1200 message data of the inquiry message.
COMPARISON_DATA_OFFSET OFFSET SMALLINT The position in the message data of the inquiry
message at which the comparison with the
Nullable COMPARISON_DATA starts.
Contains the null value if there is no comparison
data.
DUMP_JOB DUMPJOB VARCHAR(3) Specifies whether the job that sent the inquiry
message is to be dumped.
Example
• See the reply list entries for your job
SEND_MESSAGE procedure
The SEND_MESSAGE procedure sends an informational message to the QSYSOPR message queue.
Authorization: The caller must have:
• *OBJOPR and *ADD authorities to the QSYSOPR message queue,
• *EXECUTE authority to the library containing the message file, and
• *USE authority to the message file.
, message-length
MESSAGE_LENGTH =>
, message-text
MESSAGE_TEXT =>
, message-file-library
MESSAGE_FILE_LIBRARY =>
)
, message-file
MESSAGE_FILE =>
message-id A character string expression that identifies the message ID to send to the
QSYSOPR message queue.
message-length An integer value that defines the length of message-text.
message-text The message text for the message.
message-file-library The library that contains message-file. Can contain the special value *LIBL. The
default is QSYS.
message-file The message file that contains message-id. The default is QSQLMSG.
Notes
This procedure is designed to send a predefined message to the QSYSOPR message queue. The message
is expected to have one substitution variable defined as *CHAR *VARY 2.
When sending a message from a Query Supervisor exit program, SQL7064 in the QSYS/QSQLMSG
message file is defined for this purpose. When sending a message in other situations, it is recommended
that a different message should be used.
Example
• Send a message to the QSYSOPR message queue when a critical error is diagnosed.
Performance Services
These services provide information related to system performance.
COLLECTION_SERVICES_INFO view
The COLLECTION_SERVICES_INFO view returns the configuration properties for Collection Services.
The values returned for the columns in the view are closely related to the values returned by the
Configure Perf Collection (CFGPFRCOL) CL command and the Retrieve Collection Services Attributes
(QypsRtvColSrvAttributes) API.
System Column
Column Name Name Data Type Description
ACTIVE_COLLECTION_LIBRARY CURCOL_LIB VARCHAR(10) The name of the library where the currently active management
collection object is stored.
Nullable
Contains the null value if there is no active collection.
ACTIVE_COLLECTION_NAME CURCOL VARCHAR(10) The name of the current management collection object.
ACTIVE_COLLECTION_PROFILE CURCOL_PRF VARCHAR(10) The name of the collection profile being used by the active collection.
The collection profile defines which categories of data to collect.
Nullable
*CUSTOM A profile where both the categories to collect and
category interval times may be customized.
ACTIVE_COLLECTION_START_TIM START_TIME TIMESTAMP The UTC timestamp when the current (active) collection was started.
E
Nullable Contains the null value if there is no active collection.
COLLECTION_LIBRARY LIB VARCHAR(10) The name of the library where performance data is stored.
COLLECTION_PROFILE DFTCOLPRF VARCHAR(10) The name of the configured collection profile. The collection profile
defines which categories of data to collect.
DEFAULT_COLLECTION_INTERVAL INTERVAL INTEGER The default interval, in seconds, used when collecting data for a
category.
Nullable
Values are: 15, 30, 60, 300, 900, 1800, or 3600 seconds.
Contains the null value if not collecting on an interval.
MGTCOL_RETENTION_PERIOD RETPERIOD INTEGER The management collection (*MGTCOL) object retention period., in
hours. *MGTCOL objects in the configured collection library that
Nullable are older than the retention period are automatically deleted when
Collection Services is started or cycled.
Contains the null value for permanent retention.
CYCLE_TIME CYCTIME INTEGER The number of minutes past midnight when the first cycle is to occur.
The maximum value is 1439 minutes (which is one minute less than 24
hours).
CYCLE_INTERVAL CYCITV INTEGER The number of hours between cycles. The cycle time can range from a
minimum value of one hour to a maximum value of 24 hours.
System Column
Column Name Name Data Type Description
CREATE_STANDARD_DB_FILES CRTDBF VARCHAR(3) Whether the standard database file collection is created by Collection
Services while performance data is being collected.
RETENTION_DAYS STDDTARET INTEGER This retention period, in days, used to determine how long standard
database file collections should be retained on the system. When
Nullable Collection Services is started or cycled, the Collection Services server
job (QYPSPFRCOL) will automatically delete standard database file
collections in the configured collection library that are older than the
current retention period.
Contains the null value for permanent retention.
CREATE_SUMMARY_DB_FILES CRTPFRSUM VARCHAR(3) Whether additional logical files are created as supported by the
CRTPFRSUM command.
CREATE_SYSTEM_MONITOR_ CRTSYSMON VARCHAR(3) Whether additional system monitor database files should be created by
DB_FILES Collection Services while performance data is being collected.
ENABLE_SYSTEM_MONITORING ENBSYSMON VARCHAR(3) Whether Collection Services is configured to collect and produce data
for system monitors.
SYSTEM_MONITOR_ SYSMONRET INTEGER This retention period, in days, used to determine how long system
DB_FILE_RETENTION monitor database file collections should be retained on the system.
Nullable When Collection Services is started or cycled, the Collection Services
server job (QYPSPFRCOL) will automatically delete system monitor
database file collections in the configured collection library that are
older than the retention period.
Contains the null value for permanent retention.
CATEGORY_LIST SYSMONCGY VARCHAR(2000) A list of collection categories that are included in the system monitor
collection. Each category can have an independent collection interval.
CCSID 1208 This list is returned as an array within a JSON object.
Nullable
Each entry in the JSON array contains two JSON objects:
• An object with a name of "category" and a value of the category name
• An object with a name of "interval" and a value of the category's
collection interval, in seconds
Contains the null value if CATEGORY_LIST_COUNT is 0.
System Column
Column Name Name Data Type Description
EXCLUDED_LINE_LIST EXC_LIST VARCHAR(598) A list of communication line names that are excluded from the
calculation of communication line protocol metrics. Each entry is ten
Nullable characters long with a comma and space separating entries.
Contains the null value if EXCLUDED_LINE_COUNT is 0.
CREATE_HISTORICAL_DATA CRTPFRHST VARCHAR(3) Whether historical data will be created when Collection Services is
cycled.
HISTORICAL_DATA_INTERVAL HSTITV INTEGER The time interval, in seconds, used to create historical data.
HISTORICAL_SUMMARY_DATA_ HSTSUMRET INTEGER The historical summary data retention period, in months, that
RETENTION determines how long Collection Services historical summary data is
to exist. Historical summary data is stored in files beginning with
QAPMHMxxxx. Historical summary data older than the retention period
is deleted.
CREATE_HISTORICAL_DETAILED_ CRTHSTDTL VARCHAR(3) Whether historical detailed data will be created when Collection
DATA Services is cycled. Creating historical detailed data will allow detailed
data for the top contributors of various metrics to be stored in the
historical collection to be used as drill-down data. The number of top
contributors is determined by the value of the historical detailed data
filter.
HISTORICAL_DETAILED_DATA_ HSTDTLRET INTEGER The historical detailed data retention period, in days, that determines
RETENTION how long Collection Services historical detailed data is to exist.
Historical detailed data is stored in files beginning with QAPMHDxxxx.
Historical detailed data older than the retention period is deleted.
HISTORICAL_DETAILED_DATA_ HSTFILTER INTEGER The number of top contributors for each metric to be stored in the
FILTER historical data collection to be used as detailed drill-down data.
Nullable
Contains the null value if all detailed data is kept.
Example
• Return the Collection Services configuration properties.
PowerHA Services
These table functions and views provide information about PowerHA.
PowerHA SQL Services
Product Services
These services provide information about licensed products.
CHECK_PRODUCT_OPTIONS (
check-signature
CHECK_SIGNATURE =>
check- An expression that indicates whether the digital signatures of objects are to be checked.
signature
*ALL All objects that can be digitally signed will have the signature verified. Any
object that can be signed but has no signature will be identified in a message
but the product will not be set to be in error. Any signed object with a signature
that is not valid will be identified in a message. If an invalid signature is found,
the product will be set to be in an erroneous state.
*NONE Digital signatures of objects will not be checked.
*SIGNED Objects with digital signatures are checked. Any object that has been signed
will have the signature verified. Objects with invalid signatures will be identified
in a message and the product will be set to be in an erroneous state. This is the
default.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 211. CHECK_PRODUCT_OPTIONS table function
PRODUCT_OPTION VARCHAR(5) The product option of the product. Can contain the following special
value:
FAILURE_MESSAGE_ID CHAR(7) The message ID of the failure when CHECK_SUCCESSFUL has a value
of NO.
Examine the job log for additional message details. The CL command
listed in the CHKPRDOPT_COMMAND column can be used to run the
check again.
Contains the null value if CHECK_SUCCESSFUL is YES.
FAILURE_MESSAGE_TEXT VARGRAPHIC(1024) The message text for the failure when CHECK_SUCCESSFUL has a
value of NO.
CCSID 1200
Contains the null value if CHECK_SUCCESSFUL is YES.
CHKPRDOPT_COMMAND VARCHAR(1000) The CL command string used to check this product option.
Example
• List any potential problems with all installed software products.
LICENSE_EXPIRATION_CHECK procedure
The LICENSE_EXPIRATION_CHECK procedure sends a message to the QSYSOPR message queue for
every license that corresponds to an installed product that has already expired or is set to expire within
the specified number of days.
Authorization: See Note below.
LICENSE_EXPIRATION_CHECK (
)
expiration-interval
EXPIRATION_INTERVAL =>
expiration- An integer value that indicates the number of days to use as the threshold for
interval checking license information. If not specified, 30 will be used.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to work with license
information using an SQL procedure. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL
source can be extracted and used as a model for building similar procedures, or to create a customized
version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Send an informational message to the system operator message queue, QSYS/QSYSOPR, for every
installed product with a license that will expire in the next 10 days.
CALL SYSTOOLS.LICENSE_EXPIRATION_CHECK(10);
LICENSE_TERM LIC_TERM VARCHAR(6) The license term indicates whether the authorized usage limit
for a product exists until the next version, next release, or next
modification level of the product.
• Vx or vv for products licensed by version.
• VxRy or vvrr for products licensed by release.
• VxRyMz or vvrrmm for products licensed by modification.
RELEASE_LEVEL RLS_LVL VARCHAR(6) The version, release, and modification level of the product in either
VxRyMz or vvrrmm format.
INSTALLED INSTALLED VARCHAR(3) Indicates whether this feature number of the product is installed.
USAGE_LIMIT USG_LIMIT INTEGER The usage limit of the product or feature that contains license
information. Values are 0-999999 indicating the number of users
Nullable allowed to access the product.
Contains null if there is no usage limit.
USAGE_LIMIT_UPDATED USG_UPDATE TIMESTAMP(0) The timestamp when the usage limit was last updated.
Nullable Contains null if the usage limit has never been updated.
USAGE_COUNT USG_COUNT DECIMAL(8,2) The current usage count for the product or feature. Valid values are
0 through 999999. If the product is using processor usage type, the
usage count value is rounded up to the next whole number.
GLOBAL_COUNT GLOB_COUNT DECIMAL(8,2) The number of jobs currently using this product or feature across
all system partitions.
THRESHOLD THRESHOLD DECIMAL(10,2) The usage limit threshold for this product or feature.
PEAK_USAGE PEAK_USAGE DECIMAL(10,2) For concurrent usage, the maximum number of uses held by
license users of the product or feature at one time.
For registered usage, the maximum number of uses that have been
registered through license users for the product or feature.
For processor usage, the maximum number of processors
configured for this system partition while this product or feature
was in use.
LAST_PEAK LAST_PEAK TIMESTAMP(0) The timestamp when the peak usage of the product or feature last
occurred since the peak usage was reset to zero.
Nullable
Contains null if the product has not been used since the peak usage
was reset to zero.
COMPLIANCE_TYPE COMP_TYPE VARCHAR(10) The compliance type of the program determines the action taken
when the usage limit of the product or feature is exceeded.
LOG_VIOLATION LOG VARCHAR(3) Specifies whether or not requests exceeding the usage limit are
logged in the QUSRSYS/QLZALOG journal.
YES The requests for a license when the usage count is greater
than or equal to the usage limit will be logged.
LICENSE_EXPIRATION EXPIR_DATE DATE The date the license will expire. After the expiration date is
reached, the usage limit is reset to the default usage limit.
Nullable
Contains null if the license has no expiration date.
GRACE_PERIOD GRACE_PRD INTEGER The number of days a user has to obtain a new license key after a
product or feature exceeds its usage limit.
GRACE_END GRACE_END DATE The date the grace period expires. When a request for license uses
exceeds the usage limit for a product or feature, the date the grace
Nullable period expires is determined by adding the number of days in the
grace period to the current date.
Contains null if there is no grace period or the grace period has
expired.
VENDOR_DATA VENDOR VARCHAR(8) Information the vendor defined when the key was added using the
Add License Key Information (ADDLICKEY) command.
MESSAGE_QUEUE1 MESSAGE_1 VARCHAR(10) The name of the first message queue to which messages will be
sent.
Nullable
Each of these message queues, in addition to the system operator
message queue, will be sent a messages if one of the following
occurs:
• The usage count threshold is met.
• A license request is made, and the usage count is equal to or
greater than the usage limit.
• The usage limit is changed.
The messages sent include:
• CPI9E10 - License usage limit changed for product &1.
• CPI9E19 - Usage limit threshold exceeded.
• CPI9E75 - Grace period will expire on &3.
• CPI9E76 - Expiration date will be reached on &3.
Contains null if there is no first message queue.
MESSAGE_QUEUE_LIBRARY1 LIBRARY_1 VARCHAR(10) The library containing the first message queue.
MESSAGE_QUEUE2 MESSAGE_2 VARCHAR(10) The name of the second message queue to which messages will be
sent.
Nullable
Contains null if there is no second message queue.
MESSAGE_QUEUE_LIBRARY2 LIBRARY_2 VARCHAR(10) The library containing the second message queue.
MESSAGE_QUEUE3 MESSAGE_3 VARCHAR(10) The name of the third message queue to which messages will be
sent.
Nullable
Contains null if there is no third message queue.
MESSAGE_QUEUE_LIBRARY3 LIBRARY_3 VARCHAR(10) The library containing the third message queue.
MESSAGE_QUEUE4 MESSAGE_4 VARCHAR(10) The name of the fourth message queue to which messages will be
sent.
Nullable
Contains null if there is no fourth message queue.
MESSAGE_QUEUE_LIBRARY4 LIBRARY_4 VARCHAR(10) The library containing the fourth message queue.
MESSAGE_QUEUE5 MESSAGE_5 VARCHAR(10) The name of the fifth message queue to which messages will be
sent.
Nullable
Contains null if there is no fifth message queue.
MESSAGE_QUEUE_LIBRARY5 LIBRARY_5 VARCHAR(10) The library containing the fifth message queue.
Example
Return information about all licensed products and features that will expire within the next 2 weeks.
SOFTWARE_PRODUCT_INFO view
The SOFTWARE_PRODUCT_INFO view returns information about software products.
The values returned for the columns in the view are closely related to the values returned by the Display
Software Resources (DSPSFWRSC) command and the Retrieve Product Information (QSZRTVPR) API.
Authorization: None required.
PRODUCT_OPTION PROD_OPT VARCHAR(5) The product option of the product. Can contain
the following special value:
LOAD_ID LOAD_ID VARCHAR(4) The load ID of the product load for which
information was returned.
INSTALLED INSTALLED VARCHAR(3) Whether the code load for this product option
is installed. A load is installed if a product
load (*PRDLOD) object is loaded on the system
by the Restore Licensed Program (RSTLICPGM)
command.
SYMBOLIC_LOAD_STATE SYM_STATE VARCHAR(9) The symbolic state of the load for which
information was returned. This value, in
conjunction with the LOAD_ERROR column, can
be used to determine if the load is installed
correctly.
LOAD_ERROR LOAD_ERROR VARCHAR(3) Whether there is a known error for this load.
LOAD_STATE LOAD_STATE CHAR(2) The state of the load for which information was
returned.
LOAD_STATE (continued)
60 The product load object for this load was
loaded onto the system by the RSTLICPGM
command.
PRODUCT_LIBRARIES PROD_LIB VARCHAR(120) The list of product load libraries. Each library
name entry is ten characters long with one blank
Nullable separating entries.
Contains the null value if
PRODUCT_LIBRARY_COUNT is 0.
PRODUCT_DIRECTORIES PROD_DIR DBCLOB(5M) CCSID 1200 The list of product directories. Directory entries
are separated by the string ' -- ' (a blank, two
Nullable minus signs, and a blank).
Contains the null value if
PRODUCT_DIRECTORY_COUNT is 0.
PRIMARY_LANGUAGE_LOAD_ID LANG_ID CHAR(4) For code loads, this field contains the primary
language of the product option.
Nullable
Contains the null value for language loads and for
code loads when no language is installed in the
libraries for the code load.
RELEASE_DATE REL_DATE DATE Indicates the value specified for the release date
when the product definition for this product load
Nullable was created.
Contains the null value if no release date was
specified.
MINIMUM_VRM_BASE MIN_BASE CHAR(6) The minimum release level that is allowed for the
*BASE option that will run with the current level
Nullable of the option for the product. Can containing the
following special value:
LEVEL_ID LEVEL_ID CHAR(3) The level identifier of the product for which
information was returned. The format is Lxx.
Nullable
Contains the null value for all products other than
the operating system and Licensed Internal Code.
REGISTRATION_TYPE REG_TYPE CHAR(2) The registration type associated with the product.
The registration type and registration value
together make up the registration ID for the
product.
Example
• List any licensed programs that are in an error state.
PTF Services
These views provide PTF information.
DEFECTIVE_PTF_CURRENCY view
The DEFECTIVE_PTF_CURRENCY is a view which returns a list of defective PTFs on the system that do not
have the corrective PTF applied.
The data returned by this view is the same data that is returned by GO QMGTOOLS/MG option 24 (PTF
Menu), then taking option 3 (Compare DEFECTIVE PTFs from IBM). This information is generally refreshed
one time each week.
Authorization: See Note below.
The following table describes the columns in the view. The system name is DEFPTF_CUR. The schema is
SYSTOOLS.
Table 214. DEFECTIVE_PTF_CURRENCY view
PARTITION_NAME PART_NAME VARGRAPHIC(255) CCSID The name of the partition as it is known to the HMC.
1200
APAR_ID APAR_ID CHAR(7) The APAR associated with the fixing PTF.
FIXING_PTF FIXING_PTF CHAR(7) The PTF identifier of the corrective PTF. Returns the
value UNKNOWN if the corrective PTF cannot be
determined.
Note
This view is provided in the SYSTOOLS schema as an example of how to retrieve live data from a
service using SQL. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be
extracted and used as a model for building similar interfaces, or to create a customized version within a
user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
List any defective PTFs on the current system that have not had the corrective PTF installed.
ESA_CONNECTION CONNECTION VARCHAR(18) The type of connection between the IBM i and
IBM support servers.
Nullable
DIRECT LAN A direct LAN connection is
CONNECT configured
UNKNOWN No response
If either RESULT_BY_IP_ADDRESS or
RESULT_BY_HOSTNAME has a value of SUCCESS,
ESA has a working connection.
UNKNOWN No response
If either RESULT_BY_IP_ADDRESS or
RESULT_BY_HOSTNAME has a value of SUCCESS,
ESA has a working connection.
SERVER_PORT SERV_PORT INTEGER The port of the server. The default port is 443.
Example
• Return the connection information for the Electronic Service Agent.
FIRMWARE_CURRENCY view
The FIRMWARE_CURRENCY view implements a live comparison of the firmware fix level installed on the
partition against the level available through a feed from the Fix Level Recommendation Tool (FLRT).
When queried, the view uses Display Hardware Resources (DSPHDWRSC) and Display Firmware Status
(DSPFMWSTS) commands and the JSON_TABLE and HTTPGETCLOB functions to consume a live JSON
feed from the Fix Level Recommendation Tool. When querying this view, the job CCSID cannot be 65535
or the query will fail.
FW_RELEASE_DATE FW_GA DATE The general availability date of the firmware on the
partition.
FW_UPDATE_ACCESS_KEY_ KEY_EXP DATE The expiration date of the Update access key. Server
EXPIRATION firmware fix packs with a later date are not activated
Nullable until a valid Update access key expiration date is
detected.
Contains the null value if the update access key
expiration date is not available.
FW_UPDATE_POLICY UPD_POLICY VARCHAR(5) Indicates how changes are made to the server
firmware.
FW_IPL_SOURCE IPL_SRC VARCHAR(9) The copy of the server firmware that was used on
the previous server IPL.
FW_IPL_REQUIRED IPL_REQD VARCHAR(3) Whether an IPL is required to activate PTFs for the
server firmware product.
FW_PRODUCT_ID PRODUCT_ID VARCHAR(7) The IBM i product that matches the level of the
server firmware on the system. Managing the server
Nullable firmware level is performed by applying or removing
PTFs for this product.
Contains the null value if no product ID exists for the
active server firmware.
Notes
• The view requires the system to have access to the internet with the ability to access the FLRT website.
The FLRT website is:
https://www14.software.ibm.com/support/customercare/flrt/liteTable?prodKey=fw&format=json
• If the FLRT website is relocated, this view can be updated by the user. Use the Insert Generated SQL
feature in ACS to extract the source for the SYSTOOLS.FLRT_FW_INFO table function. Update the link
and recreate the table function.
• If any of the CL commands or SQL functions used by the view encounter an error, an error will be
returned to indicate the failure. The job log can be examined to determine the root cause of the
problem.
• This view is provided in the SYSTOOLS schema as an example of how to retrieve live data using an
SQL view and table function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source
can be extracted and used as a model for building similar interfaces, or to create a customized version
within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the
service and examine the implementation.
Example
Examine the firmware fix level information for the partition.
Nullable
Nullable
PTF_GROUP_LEVEL_INSTALLED GRP_LVL INTEGER The most recent level of this PTF Group installed on
the partition.
Nullable
PTF_GROUP_LEVEL_AVAILABLE GRP_IBMLVL INTEGER The PTF Group level which is available from IBM
PSP.
Nullable
LAST_UPDATED_BY_IBM GRP_UPDATE DATE The date that IBM made the latest PTF Group level
available.
Nullable
PTF_GROUP_RELEASE GRP_RLS VARCHAR(6) The release level of the PTF Group. For example,
'R730' indicates IBM i 7.3 release level.
Nullable
PTF_GROUP_STATUS_ON_SYSTEM GRP_SYSSTS VARCHAR(20) This column will always contain the value
'INSTALLED'.
Nullable
PTF_GROUP_LAST_UPDATED_BY_IBM GRP_LSTUPD CHAR(10) The date that IBM made the latest PTF Group level
available. This is the character form of the date
Nullable formatted as MM/DD/YYYY.
https://public.dhe.ibm.com/services/us/igsc/PSP/xmldoc.xml
Example
Compare the PTF Group service level detail, ordering the results from furthest behind to current.
Related reference
SYSTOOLS
SYSTOOLS is a set of Db2 for IBM i supplied examples and tools.
GROUP_PTF_DETAILS view
The GROUP_PTF_DETAILS is a view containing a query which implements a live comparison of the PTFs
within PTF Groups installed on the partition against the service levels listed on the IBM Preventive Service
Planning website.
When queried, the view uses the XMLTable() and HTTPGETBLOB() table functions to consume a live XML
feed from IBM Preventive Service Planning (PSP). If the partition cannot connect to the PSP website, the
query will fail with an SQL4302. When querying this view, the job CCSID cannot be 65535 or the query
will fail.
The results of the query show which PTFs from all PTF Groups installed on the partition match the latest
level made available by IBM and those which have a more recent version available.
Authorization: See Note below.
The following table describes the columns in the view. The system name is GRPPTFDTL. The schema is
SYSTOOLS.
Table 218. GROUP_PTF_DETAILS view
APAR_NAME APAR_NAME VARCHAR(7) The APAR name associated with the PTF.
INCLUDED_IN_GROUP INCLUDED DATE The date that this PTF was first made available in a group
PTF.
PTF_CUM_PACKAGE PTF_CUMPKG VARCHAR(8) The identifier of the cumulative PTF package containing
this PTF.
Nullable
Nullable
PTF_PRODUCT_LOAD PRODLOAD VARCHAR(4) The load ID of the product load for the PTF.
Nullable
PTF_SAVE_FILE SAVF VARCHAR(3) Indicates whether a save file exists for the PTF.
PTF_COVER_LETTER COVER VARCHAR(3) Indicates whether a cover letter exists for the PTF.
PTF_ON_ORDER ONORD VARCHAR(3) Indicates whether the PTF has been ordered.
Nullable NO The PTF has not been ordered or has already been
received.
PTF_IPL_ACTION IPLACT VARCHAR(19) The action to be taken on this PTF during the next
unattended IPL.
Nullable
NONE No action occurs at the next IPL.
PTF_ACTION_REQUIRED ACTREQ VARCHAR(12) Indicates whether an action is required to make this PTF
active when it is applied. See the cover letter to determine
Nullable what action needs to be taken.
PTF_IPL_REQUIRED IPLREQ VARCHAR(9) Indicates whether an IPL is required to apply this PTF.
PTF_IS_RELEASED RELEASED VARCHAR(3) Indicates whether the PTF save file is available for
distribution to another system. This is set to YES only when
Nullable the System Manager for IBM i licensed program is on the
system and the product is supported. The PTF_SAVE_FILE
column must have a value of YES before using the value in
this column.
PTF_MINIMUM_LEVEL MINLVL VARCHAR(2) The indicator of the lowest level of the product to which
this PTF can be applied. The level can be AA to 99.
Nullable
Contains the null value if the product does not have a level.
PTF_MAXIMUM_LEVEL MAXLVL VARCHAR(2) The indicator of the highest level of the product to which
this PTF can be applied. The level can be AA to 99.
Nullable
Contains the null value if the product does not have a level.
PTF_STATUS_TIMESTAMP STATTIME TIMESTAMP The date and time that the PTF status was last changed.
Nullable Contains the null value when the status date and time is
not available.
PTF_SUPERSEDED_BY_PTF SUPERSEDE VARCHAR(7) The identifier of the PTF that has replaced this PTF.
Nullable This field will be blank when the PTF is not superseded
or when the superseding PTF has not been loaded on the
system.
PTF_CREATION_TIMESTAMP CRTTIME TIMESTAMP The date and time that the PTF was created.
Nullable Contains the null value when the creation date and time
cannot be determined.
PTF_INCLUDED_IN_GROUP_DATE PTF_DATE VARCHAR(10) The date that this PTF was first made available in a group
PTF. Contains the character form of a date formatted as
MM/DD/YY.
Notes
The PSP websites used by this service are found based upon the PTF groups that are currently installed
on the partition. For each distinct PTF group, a unique PSP XML feed is accessed:
https://public.dhe.ibm.com/services/us/igsc/PSP/<PTF-Group-Name>.xml
For example, the JAVA PTF group details can be accessed using:
https://public.dhe.ibm.com/services/us/igsc/PSP/SF99572.xml
Example
• Review the details for the PTFs which have not yet been applied for the PTF groups installed on this
partition.
Related reference
SYSTOOLS
GROUP_PTF_INFO view
The GROUP_PTF_INFO view contains information about the group PTFs for the server.
The information returned is similar to the information available from Work with PTF Groups (WRKPTFGRP)
CL command.
Authorization: The caller must have *USE authority to the Work with PTF Groups (WRKPTFGRP)
command.
The following table describes the columns in the view. The system name is GRPPTFINFO. The schema is
QSYS2.
Table 219. GROUP_PTF_INFO view
COLLECTED_TIME COLLE00001 TIMESTAMP Date and time of when this row information was
generated.
Nullable
Nullable
Nullable
Nullable
Example
Determine the level of the latest CUM PTF group installed on the system.
PTF_COVER_LETTER ( ptf-id
PTF_ID =>
)
, ignore_errors
IGNORE_ERRORS =>
NO An error is returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 220. PTF_COVER_LETTER table function
LINE_NUMBER INTEGER The position of this row in the PTF cover letter. The first
row has a value of 1.
PTF_COVER_LETTER_LINE VARCHAR(80) The data for this row in the PTF cover letter.
Note
This function is provided in the SYSTOOLS schema as an example of how to return PTF cover letter
information from a system file by using an SQL table function. Similar to other Db2 for i provided tools
within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper
functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Return cover letters for any PTFs that have been loaded but not applied.
PTF_INFO view
The PTF_INFO view contains information about PTFs for the server.
The information returned is similar to QpzListPTF API.
Authorization: The caller must have *USE authority to the Display Program Temporary Fix (DSPPTF)
command.
Nullable
Nullable
PTF_PRODUCT_OPTION_2 PRODOPT2 VARCHAR(6) Product option. The column contains the optional part
number or *BASE.
Nullable
Nullable
Nullable
Nullable
Nullable
PTF_PRODUCT_LOAD PRODLOAD VARCHAR(4) The load ID of the product load for the PTF.
Nullable
PTF_SAVE_FILE SAVF VARCHAR(3) Indicates whether a save file exists for the PTF.
PTF_COVER_LETTER COVER VARCHAR(3) Indicates whether a cover letter exists for the PTF.
PTF_ON_ORDER ONORD VARCHAR(3) Indicates whether the PTF has been ordered.
Nullable NO The PTF has not been ordered or has already been
received.
PTF_IPL_ACTION IPLACT VARCHAR(19) The action to be taken on this PTF during the next
unattended IPL.
Nullable
NONE No action occurs at the next IPL.
PTF_ACTION_REQUIRED ACTREQ VARCHAR(12) Indicates whether an action is required to make this PTF
active when it is applied. See the cover letter to determine
Nullable what action needs to be taken.
PTF_IPL_REQUIRED IPLREQ VARCHAR(9) Indicates whether an IPL is required to apply this PTF.
PTF_IS_RELEASED RELEASED VARCHAR(3) Indicates whether the PTF save file is available for
distribution to another system. This is set to YES only
Nullable when the System Manager for IBM i licensed program
is on the system and the product is supported. The
PTF_SAVE_FILE column must have a value of YES before
using the value in this column.
PTF_MINIMUM_LEVEL MINLVL VARCHAR(2) The indicator of the lowest level of the product to which
this PTF can be applied. The level can be AA to 99.
Nullable
Contains the null value if the product does not have a
level.
PTF_MAXIMUM_LEVEL MAXLVL VARCHAR(2) The indicator of the highest level of the product to which
this PTF can be applied. The level can be AA to 99.
Nullable
Contains the null value if the product does not have a
level.
PTF_STATUS_TIMESTAMP STATTIME TIMESTAMP The date and time that the PTF status was last changed.
Nullable Contains the null value when the status date and time is
not available.
PTF_SUPERSEDED_BY_PTF SUPERSEDE VARCHAR(7) The identifier of the PTF that has replaced this PTF.
Nullable This field will be blank when the PTF is not superseded
or when the superseding PTF has not been loaded on the
system.
PTF_LATEST_SUPERSEDING_PTF LATEST_PTF VARCHAR(7) The identifier of the most recent PTF that has superseded
this PTF.
Nullable
Contains the null value when PTF_LOADED_STATUS is not
PERMANENTLY APPLIED or SUPERSEDED.
PTF_CREATION_TIMESTAMP CRTTIME TIMESTAMP The date and time that the PTF was created.
Nullable Contains the null value when the creation date and time
cannot be determined.
PTF_TEMPORARY_APPLY_TIMESTAMP TMPTIME TIMESTAMP The date and time that the PTF was temporarily applied.
Nullable Contains the null value if the PTF has not been temporarily
applied.
Examples
• Find which PTFs will be impacted by the next IPL.
Security Services
These views, procedures, and functions provide security information.
AUTHORIZATION_LIST_INFO view
The AUTHORIZATION_LIST_INFO view returns a list of all objects secured by an authorization list.
The information returned is similar to the information available through the Display Authorization List
Objects (DSPAUTLOBJ) CL command and the List Objects Secured by Authorization List (QSYLATLO) API.
Authorization: The caller must have:
• *READ authority to the authorization list, or
• Authorized to the QIBM_DB_SECADM function usage identifier.
The following table describes the columns in the view. The system name is AUTHL_INFO. The schema is
QSYS2.
Table 222. AUTHORIZATION_LIST_INFO view
Nullable Returns the null value if the object is not in the QSYS
or QDLS file system.
SYSTEM_OBJECT_NAME SYS_ONAME VARCHAR(10) The object that is secured by the authorization list.
Nullable Returns the null value if the object is not in the QSYS
or QDLS file system.
SYSTEM_OBJECT_TYPE SYS_OTYPE VARCHAR(8) The system object type of the secured object.
OBJECT_ATTRIBUTE OBJATTR VARCHAR(5) The attribute for the secured object's type.
OBJECT_SCHEMA OSCHEMA VARCHAR(128) The SQL schema name for this object.
Nullable Returns the null value if the object is not in the QSYS
or QDLS file system.
OBJECT_TYPE OTYPE VARCHAR(9) The SQL object type. The following values can be
returned.
Nullable
ALIAS The object is an SQL alias.
PRIMARY_GROUP GROUP VARCHAR(10) The user who is the primary group for the object.
TEXT_DESCRIPTION TEXT VARCHAR(50) The descriptive text for the secured object.
Nullable Returns the null value if the object is not in the QSYS
or QDLS file system.
ASPGRP ASPGRP VARCHAR(10) The name of the ASP device containing the object. A
value of *SYSBAS indicates the system ASP and all
basic user ASPs.
PATH_NAME PATH_NAME DBCLOB(16M) The path name for the object that is secured by the
CCSID 1200 authorization list.
Nullable Returns the null value if the object is in the QSYS or
QDLS file system.
DLO_NAME DLO_NAME VARCHAR(12) The document library object (DLO) name for the
object.
Nullable
Returns the null value if OBJECT_TYPE is not *DOC
(document) or *FLR (folder).
FOLDER_PATH FOLDER VARCHAR(63) The name of the folder that contains the DLO object.
Example
Return information about all the object secured by authorization list APP1.
AUTHORIZATION_NAME USER_NAME VARCHAR(10) User profile name. Can contain the following special
value.
OBJECT_AUTHORITY OBJ_AUTH VARCHAR(12) The authority that the user has to the object.
Contains one of the following values:
TEXT_DESCRIPTION TEXT VARCHAR(50) The descriptive text for the authorization list.
Example
List the public security settings for all authorization lists.
SELECT *
FROM QSYS2.AUTHORIZATION_LIST_USER_INFO
WHERE AUTHORIZATION_NAME = '*PUBLIC';
CERTIFICATE_INFO (
certificate-store-password
CERTIFICATE_STORE_PASSWORD =>
)
, certificate-store
CERTIFICATE_STORE =>
certificate- An expression that contains the password for the specified certificate store. It is
store- recommended that the password be passed as a variable, not as a string visible as clear
password text.
The following value can be used instead of specifying the password.
*NOPWD The certificate store password will be retrieved from the stashed password
file.
certificate- A character or graphic string expression that indicates the certificate store from which a
store list of certificates is to be retrieved. The value can either be a fully qualified Integrated File
System (IFS) directory path and file name of the certificate store, starting with a leading
forward slash (/), or one of the following special values. If the file name does not identify
a certificate store, no rows are returned. If certificate-store is not specified, *SYSTEM is the
default.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 224. CERTIFICATE_INFO table function
KEY_ENCIPHERMENT VARCHAR(3) Indicates if the certificate has the key encipherment extension.
DATA_ENCIPHERMENT VARCHAR(3) Indicates if the certificate has the data encipherment extension.
KEY_AGREEMENT VARCHAR(3) Indicates if the certificate has the key agreement extension
KEY_CERTIFICATE_SIGNATURE VARCHAR(3) Indicates if the certificate has the key certificate signature extension.
NO The certificate does not have the key certificate signature extension.
CRL_SIGNATURE VARCHAR(3) Indicates if the certificate has the Certificate Revocation List (CRL) signature
extension.
ENCIPHER_ONLY VARCHAR(3) Indicates if the certificate has the encipher only extension.
DECIPHER_ONLY VARCHAR(3) Indicates if the certificate has the decipher only extension.
IP_ADDRESS_COUNT INTEGER The number of addresses in the IP_ADDRESSES column. Currently, only one
IP address is returned.
Contains the null value if no IP addresses are available.
DOMAIN_NAME_COUNT INTEGER The number of domain names in the DOMAIN_NAMES column. Currently,
only one domain name is returned.
Contains the null value if no domain names are available.
CRYPTOGRAPHIC_DEVICES VARCHAR(109) A list of cryptographic device descriptions. Each entry is ten characters long.
A single blank separates entries.
Contains the null value if CRYTOGRAPHIC_DEVICE_COUNT is 0.
SUBJECT_COMMON_NAME VARCHAR(256) The subject's common name. The SUBJECT set of columns define
information about the end-entity that is being described for the certificate.
Contains the null value if no value is available.
ISSUER_COMMON_NAME VARCHAR(256) The issuer's common name. The ISSUER set of columns define information
about the Certificate Authority that signed the end-entity certificate.
Contains the null value if no value is available.
Example
Retrieve all the certificates for the *SYSTEM certificate store that will be expired within the next month.
Use a password that has been set in a global variable.
, password
P_PASSWORD =>
, password-expired
P_PASSWORD_EXPIRED =>
, status
P_STATUS =>
, initial-program
P_INITIAL_PROGRAM =>
, limit-capabilities
P_LIMIT_CAPABILITIES =>
, text
P_TEXT =>
, password-expiration-interval
P_PASSWORD_EXPIRATION_INTERVAL =>
, job-description
P_JOB_DESCRIPTION =>
, group-profile
P_GROUP_PROFILE =>
, user-expiration-date
P_USER_EXPIRATION_DATE =>
, user-expiration-interval
P_USER_EXPIRATION_INTERVAL =>
, special-authority-action
P_SPECIAL_AUTHORITY_ACTION =>
, special-authority
P_SPECIAL_AUTHORITY =>
)
, preview
PREVIEW =>
user-name A character string containing the name of the user profile whose values are to be
changed.
special-authority A character string that specifies a single special authority value to be added to or
removed from the user profile when the special-authority-action parameter has a
value or *ADD or *REMOVE. This is the SPCAUT parameter. The default is NULL,
meaning the value is not changed.
preview A character string that indicates whether the table function should execute the
CHGUSRPRF command that has been constructed based upon the input parameters
or whether only a preview of the potential action should be shown.
The result of the function is a table containing a single row with the details about the user profile change.
The columns of the result table are described in the following table. The result columns are nullable.
Table 225. CHANGE_USER_PROFILE table function
Note
This function is provided in the SYSTOOLS schema as a helper function to manage user profiles. Similar to
other Db2 for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for
building similar helper functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Disable all enabled user profiles that have no password set.
Preview the list of profiles that will be affected.
DRDA_AUTHENTICATION_ENTRY_INFO view
The DRDA_AUTHENTICATION_ENTRY_INFO view returns user server authentication entry information.
A server authentication entry defines a userid and password to send on a connect request over
TCP/IP. A server authentication list is associated with every user profile on the system. The Add Server
Authentication Entry (ADDSVRAUTE) command is used to add entries.
System Column
Column Name Name Data Type Description
SERVER_NAME SRVR_NAME VARGRAPHIC(200) The target system for the authentication entry.
CCSID 1200
This is the name of the RDB or QDDMDRDASERVER that is used
for connections made on behalf of RDB DDM files or DRDA
connections. For a non-RDB DDM file that does not use the RDB
directory, the value will be QDDMDRDASERVER or QDDMSERVER.
See Client security in a TCP/IP network for more information.
PASSWORD_STORED PW_STORED VARCHAR(3) Indicates whether a password is stored for the authentication
entry.
Example
For an auditor, generate a list of user profiles that have authentication entries on the system:
SELECT DISTINCT(AUTHORIZATION_NAME)
FROM QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO
FUNCTION_INFO view
The FUNCTION_INFO view contains details about function usage identifiers.
The values returned for the columns in the view are closely related to the values returned by the Display
Function Usage (DSPFCNUSG) CL command.
Authorization: None required.
The following table describes the columns in the view. The system name is FCN_INFO. The schema is
QSYS2.
Table 227. FUNCTION_INFO view
Nullable
FUNCTION_CATEGORY FCNCAT VARCHAR(10) Indicates whether the function is a client or host function.
Nullable
1 - CLIENT The function is a locally managed client function within IBM i
Navigator.
Nullable
PRODUCT The function is a function product.
FUNCTION_NAME_MESSAGE_TEXT FCNMSGTXT VARGRAPHIC(330) The first-level text for the function-name message ID.
CCSID(1200)
Nullable
Nullable
FUNCTION_DESCRIPTION_MESSAGE_ FCNDESCTXT VARGRAPHIC(330) The first-level text for the function-description message ID.
TEXT CCSID(1200)
Nullable
Nullable
FUNCTION_PRODUCT_ID FCNPRDID VARCHAR(30) The ID of the product that the function is registered for.
Nullable
FUNCTION_GROUP_ID FCNGRPID VARCHAR(30) The ID of the function group that the function is grouped with. If the function
is not grouped with a function group, this field is set to *NONE.
Nullable
Nullable
DENIED The default usage does not allow usage of the function.
ALLOBJ_INDICATOR ALLOBJ VARCHAR(8) Indicates whether a user with *ALLOBJ special authority can use the function.
Nullable
NOT USED The user, its groups, or default must allow usage of the
function.
USAGE_INFORMATION_INDICATOR USGINFO VARCHAR(3) Indicates whether there is usage information defined for the function.
Nullable
NO There is no usage information defined for the function.
Example
Determine what function usage IDs exist and their default configuration.
USER_NAME USER_NAME VARCHAR(10) The name of the user profile that has a usage setting for this
function
Example
Determine what function usage has been granted or revoked.
GROUP_PROFILE_ENTRIES view
The GROUP_PROFILE_ENTRIES view contains one row for each user profile that is part of a group profile.
Both group profile (GRPPRF) and supplemental group profile (SUPGRPPRF) information is considered for
each user profile.
Authorization: The caller must have *READ authority to the user profile.
The following table describes the columns in the view. The system name is GROUPLIST. The schema is
QSYS2.
Table 229. GROUP_PROFILE_ENTRIES view
Nullable
OBJECT_OWNERSHIP view
The OBJECT_OWNERSHIP view returns ownership information for all objects.
The values returned for the columns in the view are closely related to the values returned by the
WRKOBJOWN CL command and the List Objects User Is Authorized to, Owns, or Is Primary Group of
(QSYLOBJA) API.
Authorization: The caller must have *READ authority to the user profile that owns the object.
OBJECT_LIBRARY LIBNAME VARCHAR(10) The name of the library containing the object.
IASP_NAME IASP_NAME VARCHAR(10) The auxiliary storage pool (ASP) device name
where the object is stored. If the object is in
the system ASP or one of the basic user ASPs,
contains *SYSBAS.
Examples
• Return a list of all objects owned by user FRANKDBA.
• Return a list of only objects in the IFS that are owned by user FRANKDBA.
, system-object-name ,
SYSTEM_OBJECT_NAME =>
object-type )
OBJECT_TYPE =>
system-object-schema A character or graphic string expression that identifies the library that contains
system-object-name.
system-object-name A character or graphic string expression that identifies the object.
object-type A character or graphic string expression that specifies the system object type of
system-object-name.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 231. OBJECT_PRIVILEGES table function
AUTHORIZATION_USER VARCHAR(10) User profile name. Can contain the following special value.
OBJECT_AUTHORITY VARCHAR(12) The authority that the user has to the object. Contains one of
the following special values:
AUTHORIZATION_LIST VARCHAR(10) The name of the authorization list if the object is secured by an
authorization list.
Contains null if the object is not secured by an authorization
list.
PRIMARY_GROUP VARCHAR(10) The user who is the primary group for the object.
Returns the null value if there is no primary group for the
object.
SELECT *
FROM TABLE(QSYS2.OBJECT_PRIVILEGES('APPLIB', 'EMPLOYEE', '*FILE'));
OBJECT_PRIVILEGES view
The OBJECT_PRIVILEGES view returns a row for every user authorized to an object, along with their
associated object and data authorities.
The information returned is similar to the information available through the Display Object Authority
(DSPOBJAUT) CL command.
Authorization: All authorized users are returned for an object when at least one of the following is true:
• The caller has *OBJMGT authority.
• The caller is the owner of the object.
• The object is an authorization list.
• The caller is authorized to the QIBM_DB_SECADM function usage identifier.
Otherwise, only authorizations for the caller are returned.
The following table describes the columns in the view. The system name is OBJ_PRIV. The schema is
QSYS2.
Table 232. OBJECT_PRIVILEGES view
OBJECT_SCHEMA OSCHEMA VARCHAR(128) The SQL schema name for this object.
SQL_OBJECT_TYPE SQLTYPE VARCHAR(9) The SQL object type. The following values can be
returned.
Nullable
ALIAS The object is an SQL alias.
AUTHORIZATION_NAME USER_NAME VARCHAR(10) User profile name. Can contain the following special
value.
OBJECT_AUTHORITY OBJ_AUTH VARCHAR(12) The authority that the user has to the object.
Contains one of the following special values:
OWNER OWNER VARCHAR(10) The user profile that owns the object.
AUTHORIZATION_LIST AUTL VARCHAR(10) The name of the authorization list if the object is
secured by an authorization list.
Nullable
Contains null if the object is not secured by an
authorization list.
PRIMARY_GROUP GROUP VARCHAR(10) The user who is the primary group for the object.
Example
Find user profiles that are publicly accessible.
SELECT *
FROM QSYS2.OBJECT_PRIVILEGES
WHERE SYSTEM_OBJECT_SCHEMA = 'QSYS' AND
OBJECT_TYPE = '*USRPRF' AND
AUTHORIZATION_NAME = '*PUBLIC' AND
OBJECT_AUTHORITY <> '*EXCLUDE';
SECURITY_INFO view
The SECURITY_INFO view returns one row containing information about the IBM i security configuration.
The values returned for the columns in the view are closely related to the values returned by the Display
Security Attributes (DSPSECA) and Display Security Auditing (DSPSECAUD) CL commands and by the
Retrieve Security Attributes (QSYRTVSA) API.
Authorization: The caller must have *AUDIT special authority to see the system values for QAUDCTL,
QAUDLVL, QAUDLVL2, and QCRTOBJAUD.
To see the AUDIT_JOURNAL_RECEIVER_LIBRARY and AUDIT_JOURNAL_RECEIVER values, the caller
must have:
• *OBJOPR and some data authority other than *EXECUTE to journal QSYS/QAUDJRN.
The following table describes the columns in the view. The system name is SEC_INFO. The schema is
QSYS2.
Table 233. SECURITY_INFO view
SECURITY_LEVEL SECLVL INTEGER The security level that is currently being used by the system.
PENDING_SECURITY_LEVEL PENDSECLVL INTEGER The security level that the system will use after the next IPL.
Nullable Contains the null value if the security level will not change after
the next IPL.
PASSWORD_LEVEL PWDLVL INTEGER The password level that is currently being used by the system.
PENDING_PASSWORD_LEVEL PENDPWDLVL INTEGER The password level that the system will use after the next IPL.
Nullable Contains the null value if the password level will not change after
the next IPL.
PASSWORD_CHANGE_BLOCK QPWDCHGBLK VARCHAR(5) The current setting for the block password change
(QPWDCHGBLK) system value.
PASSWORD_EXPIRATION_INTERVAL QPWDEXPITV VARCHAR(6) The current setting for the password expiration interval
(QPWDEXPITV) system value.
PASSWORD_EXPIRATION_WARNING QPWDEXPWRN INTEGER The current setting for the password expiration warning
(QPWDEXPWRN) system value.
PASSWORD_LIMIT_DIGITS QPWDLMTAJC INTEGER The current setting for the limit adjacent digits in password
(QPWDLMTAJC) system value.
PASSWORD_LIMIT_CHARACTERS QPWDLMTCHR VARCHAR(10) The current setting for the limit characters in password
(QPWDLMTCHR) system value.
PASSWORD_LIMIT_REPEAT QPWDLMTREP INTEGER The current setting for the limit repeating characters in
password (QPWDLMTREP) system value.
PASSWORD_LIMIT_POSITIONS QPWDPOSDIF INTEGER The current setting for the limit password character positions
(QPWDPOSDIF) system value.
PASSWORD_REQUIRE_DIGIT QPWDRQDDGT INTEGER The current setting for the require digit in password
(QPWDRQDDGT) system value.
PASSWORD_MAXIMUM_LENGTH QPWDMAXLEN INTEGER The current setting for the maximum password length
(QPWDMAXLEN) system value.
PASSWORD_MINIMUM_LENGTH QPWDMINLEN INTEGER The current setting for the minimum password length
(QPWDMINLEN) system value.
PASSWORD_DUPLICATION QPWDRQDDIF INTEGER The current setting for the duplicate password control
(QPWDRQDDIF) system value.
PASSWORD_RULES QPWDRULES VARCHAR(750) The current setting for the password rules (QPWDRULES) system
value.
PASSWORD_VALIDATION_PROGRAM QPWDVLDPGM VARCHAR(20) The current setting for the password validation program
(QPWDVLDPGM) system value.
CREATE_PUBLIC_AUTHORITY QCRTAUT VARCHAR(8) The current setting for the create default public authority
(QCRTAUT) system value.
CREATE_OBJECT_AUDITING QCRTOBJAUD VARCHAR(7) The current setting for the create object auditing (QCRTOBJAUD)
system value.
Returns the value *NOTAVL if caller does not have *AUDIT
special authority.
MAXIMUM_SIGNON_ATTEMPTS QMAXSIGN VARCHAR(6) The current setting for the maximum sign-on attempts allowed
(QMAXSIGN) system value.
MAXIMUM_SIGNON_ACTION QMAXSGNACN INTEGER The current setting for the action to take for failed sign-on
attempts (QMAXSGNACN) system value.
VERIFY_OBJECT_RESTORE QVFYOBJRST INTEGER The current setting for the verify object on restore
(QVFYOBJRST) system value.
ALLOW_OBJECT_RESTORE QALWOBJRST VARCHAR(150) The current setting for the allow object restore (QALWOBJRST)
system value.
USE_ADOPTED_AUTHORITY QUSEADPAUT VARCHAR(10) The current setting for the use adopted authority (QUSEADPAUT)
system value.
ALLOW_USER_DOMAIN QALWUSRDMN VARCHAR(500) The current setting for the allow user domain objects in libraries
(QALWUSRDMN) system value.
LIMIT_SECOFR_ACCESS QLMTSECOFR INTEGER The current setting for the limit security officer device access
(QLMTSECOFR) system value.
INACTIVE_JOB_TIMEOUT QINACTITV VARCHAR(5) The current setting for the inactive job time-out (QINACTITV)
system value.
INACTIVE_JOB_MESSAGE_QUEUE QINACTMSGQ VARCHAR(20) The current setting for the inactive job message queue
(QINACTMSGQ) system value.
DISCONNECTED_JOB_INTERVAL QDSCJOBITV VARCHAR(5) The current setting for the time interval before disconnected
jobs end (QDSCJOBITV) system value.
AUTOCONFIGURE_DEVICES QAUTOCFG INTEGER The current setting for the autoconfigure devices (QAUTOCFG)
system value.
AUTOCONFIGURE_REMOTE_ QAUTORMT INTEGER The current setting for the autoconfigure of remote controllers
CONTROLLERS (QAUTORMT) system value.
AUDITING_CONTROL QAUDCTL VARCHAR(50) The current setting for the auditing control (QAUDCTL) system
value.
Returns the value *NOTAVL if caller does not have *AUDIT
special authority.
AUDITING_LEVEL QAUDLVL VARCHAR(160) The current setting for the auditing level (QAUDLVL) system
value.
Returns the value *NOTAVL if caller does not have *AUDIT
special authority.
AUDITING_LEVEL_EXTENSION QAUDLVL2 VARCHAR(990) The current setting for the auditing level extension (QAUDLVL2)
system value.
Returns the value *NOTAVL if caller does not have *AUDIT
special authority.
AUDIT_JOURNAL_RECEIVER_ JRNRCV_LIB VARCHAR(10) The name of the library that contains the journal receiver
LIBRARY attached to the security journal.
Nullable
Contains the null value if AUDIT_JOURNAL_EXISTS is NO or if
caller is not authorized.
AUDIT_JOURNAL_RECEIVER JRNRCV VARCHAR(10) The name of the journal receiver attached to the security journal.
OBJECT_AUTHORITY_COLLECTION_ OBJ_COLL VARCHAR(3) Whether authority collection for objects is active on the
ACTIVE partition. Authority collection for objects is started using
the Start Authority Collection (STRAUTCOL) command with
TYPE(*OBJAUTCOL) and ended using the End Authority
Collection (ENDAUTCOL) command with TYPE(*OBJAUTCOL).
ALLOW_DIGITAL_CERTIFICATE_ DCM_ADD VARCHAR(3) Whether digital certificates can be added to a certificate store
ADD using the Add Verifier (QYDOADDV, QydoAddVerifier) API, and
whether the password for a certificate store can be reset using
Digital Certificate Manager (DCM).
ALLOW_SECURITY_SYSVAL_ SYSVAL_CHG VARCHAR(3) Whether the security related system values can be changed.
CHANGE
NO The security related system values cannot be changed.
ALLOW_SERVICE_TOOLS_ SSTPWD_CHG VARCHAR(3) Whether a service tools user ID with a default password that is
PASSWORD_CHANGE expired can change its own password.
NEXT_USER_ID NEXT_UID BIGINT The value that will be used the next time a user ID number (UID)
is generated for a user profile.
NEXT_GROUP_ID NEXT_GID BIGINT The value that will be used the next time a group ID number
(GID) is generated for a user profile.
Example
• Return the security and password levels for the system.
SET_COLUMN_ATTRIBUTE procedure
The SET_COLUMN_ATTRIBUTE procedure sets the SECURE attribute for a column so variable values used
for the column cannot be seen in the database monitor or plan cache.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the table, and
• *OBJOPR and *OBJALTER authorities to the table.
SET_COLUMN_ATTRIBUTE (
SECURE This column does not contain data that needs to be secured in a database
NO monitor or plan cache
SECURE This column contains data that needs to be secured in a database monitor
YES or plan cache.
All variable values for any query that references this column will not be
visible in a database monitor or plan cache unless the security officer has
started the database monitor or the security officer is accessing the plan
cache. All host variable values will appear as *SECURE when examined
from the monitor and plan cache unless the user is the QSECOFR user.
The secure setting for a column is shown in the SECURE column of the QSYS2/SYSCOLUMNS2 catalog.
Example
Set the credit card column in the ORDERS table so it is secure.
SPECIAL_AUTHORITY_DATA_MART table
The SPECIAL_AUTHORITY_DATA_MART table is a data mart that contains information about special
authorities for users. These authorities can come directly from a user profile or can be obtained through
membership in a group profile.
This data mart is implemented as a materialized query table (MQT). The data in this table is only
populated and refreshed when requested by a user. This is done by using the REFRESH TABLE SQL
statement.
Gathering the special authority information can be a long running task. Consider running the refresh in a
batch job.
Authorization: The table is shipped with public authority of *EXCLUDE.
To refresh the table, the caller must have:
• *EXECUTE authority to the SYSTOOLS library, and
• *OBJMGT, *OBJOPR, *ADD, and *DELETE authority to the SYSTOOLS/SPEC_AUTH file.
To query the table, the caller must have:
• *EXECUTE authority to the SYSTOOLS library, and
• *OBJOPR and *READ authority to the SYSTOOLS/SPEC_AUTH file.
The following table describes the columns in the table. The system name is SPEC_AUTH. The schema is
SYSTOOLS.
Table 234. SPECIAL_AUTHORITY_DATA_MART table
System Column
Column Name Name Data Type Description
System Column
Column Name Name Data Type Description
AUTHORITY_SOURCE AUTHSRC VARCHAR(13) Source of the special authority for this row.
GROUP_PROFILE_NAME GROUP_NAME VARCHAR(10) The group profile that provided the special authority for this row.
Nullable Contains the null value if the special authority was obtained from
the user profile.
TEXT_DESCRIPTION TEXT VARCHAR(50) The descriptive text for the user profile.
Nullable Contains the null value if the user profile has no text description.
LAST_USED_DATE LAST_USED DATE The date the user profile was used last.
Nullable Contains the null value if the user profile has not been used.
Examples
• Update the table to contain the current special authority values for all user profiles on the system.
• List all the users who have *ALLOBJ special authority, either directly from their user profile or as part of
a group profile.
SQL_CHECK_FUNCTION_USAGE ( function-usage )
FUNCTION_USAGE =>
Example
• Check whether the current user is authorized to the QIBM_DB_SQLADM function usage identifier.
VALUES QSYS2.SQL_CHECK_FUNCTION_USAGE('QIBM_DB_SQLADM');
SQL_CHECK_SPECIAL_AUTHORITY (
SPECIAL_AUTHORITY =>
special-authority )
special-authority A character string containing one system special authority value. It must include the
leading * character.
Example
• Check whether the current user has *JOBCTL special authority.
VALUES QSYS2.SQL_CHECK_SPECIAL_AUTHORITY('*JOBCTL');
USER_INFO view
The USER_INFO view contains information about user profiles.
The USER_INFO_BASIC view returns a subset of this information and is faster.
The values returned for the columns in the view are closely related to the values returned by Retrieve
User Information (QSYRUSRI) API. Refer to the API for more detailed information.
Authorization: The caller must have *OBJOPR and *READ authorities to the *USRPRF. To see a non-
null value for the USER_DEFAULT_PASSWORD column, the caller must have *ALLOBJ and *SECADM
authorities.
The following table describes the columns in the view. The schema is QSYS2.
Table 235. USER_INFO view
Nullable
PREVIOUS_SIGNON PRVSIGNON TIMESTAMP The date and time the user last signed on.
SIGN_ON_ATTEMPTS_NOT_VALID SIGNONINV INTEGER The number of sign-on attempts that were not
valid since the last successful sign-on.
Nullable
STATUS STATUS VARCHAR(10) The status of the user profile. Contains one of the
following values:
Nullable
*DISABLED The user profile is disabled;
therefore, the user cannot sign
on.
NETSERVER_DISABLED NETSERVER VARCHAR(3) Whether this user profile is disabled for IBM i
NetServer use.
PASSWORD_CHANGE_DATE PWDCHGDAT TIMESTAMP The date the user's password was last changed.
Nullable
PASSWORD_LEVEL_0_1 PWD_0_1 VARCHAR(3) Indicates whether the user profile has a password
that can be used for a system at QPWDLVL 0 or 1.
Nullable
NO The password cannot be used.
PASSWORD_LEVEL_2_3 PWD_2_3 VARCHAR(3) Indicates whether the user profile has a password
that can be used for a system at QPWDLVL 2 or 3.
Nullable
NO The password cannot be used.
PASSWORD_EXPIRATION_INTERVAL PWDEXPITV SMALLINT The number of days (from 1 through 366) the
user's password can remain active before it must
Nullable be changed. Can also be one of the following
values:
DAYS_UNTIL_PASSWORD_EXPIRES PWDDAYSEXP INTEGER The number of days until the password will expire.
A value of 0 indicates the password is expired.
Nullable
Contains null if the password will not expire within
the number of days specified by the password
expiration warning (QPWDEXPWRN) system value.
USER_CLASS_NAME USRCLS VARCHAR(10) The user's class name. Contains one of the
following values:
Nullable
*PGMR The user has a class of
programmer.
SPECIAL_AUTHORITIES SPCAUT VARCHAR(88) A list of the special authorities the user has. Up to
8 authorities are returned. Each entry is padded
Nullable with blanks to fill 11 characters.
Contains null if the user has no special authorities.
GROUP_PROFILE_NAME GRPPRF VARCHAR(10) The name of the group profile. Contains the value
*NONE if the user does not have a group profile.
Nullable
SUPPLEMENTAL_GROUP_LIST SUPGRPLIST VARCHAR(150) A list of supplemental groups for the user profile.
Up to 15 supplemental groups are returned. Each
Nullable entry except for the last one is padded with
blanks to fill 10 characters.
Contains null if the user has no supplemental
groups.
OWNER OWNER VARCHAR(10) This field indicates who is to own objects created
by this user. Contains one of the following values:
Nullable
*GRPPRF The user's group profile owns any
objects the user creates.
GROUP_AUTHORITY GRPAUT VARCHAR(10) The authority the user's group profile has to
objects the user creates. Contains one of the
Nullable following values:
ASSISTANCE_LEVEL ASTLVL VARCHAR(10) The user interface that the user will use. Contains
one of the following values:
Nullable
*ADVANCED The expert system user
interface.
CURRENT_LIBRARY_NAME CURLIB VARCHAR(10) The name of the user's current library. Contains
*CRTDFT if the user does not have a current
Nullable library.
INITIAL_MENU_NAME INLMNU VARCHAR(10) The initial menu for the user. Can contain the
special value *SIGNOFF.
Nullable
INITIAL_MENU_LIBRARY_NAME INLMNULIB VARCHAR(10) The name of the library that the initial menu is in.
Can contain the special value *LIBL.
Nullable
Contains null if the menu name is *SIGNOFF.
INITIAL_PROGRAM_NAME INITPGM VARCHAR(10) The initial program for the user. Contains *NONE
is there is no initial program.
Nullable
INITIAL_PROGRAM_LIBRARY_NAME INITPGMLIB VARCHAR(10) The name of the library that the initial program is
in. Can contain the special value *LIBL.
Nullable
Contains null if the initial program name is *NONE.
TEXT_DESCRIPTION TEXT VARCHAR(50) The descriptive text for the user profile.
KEYBOARD_BUFFERING KBDBUF VARCHAR(10) The keyboard buffering value that is used when a
job is initialized for this user. Contains one of the
Nullable following special values:
HIGHEST_SCHEDULING_PRIORITY PTYLMT CHAR(1) The highest scheduling priority the user is allowed
to have for each job submitted to the system.
Nullable
JOB_DESCRIPTION_NAME JOBD VARCHAR(10) The name of the job description used for jobs that
start through subsystem work station entries.
Nullable
JOB_DESCRIPTION_LIBRARY_NAME JOBDLIB VARCHAR(10) Job description library name. Can contain the
special value *LIBL.
Nullable
ACCOUNTING_CODE ACGCDE VARCHAR(15) The accounting code that is associated with this
user.
Nullable
Contains null if there is no accounting code.
MESSAGE_QUEUE_NAME MSGQ VARCHAR(10) The name of the message queue that is used by
this user.
Nullable
MESSAGE_QUEUE_LIBRARY_NAME MSGQLIB VARCHAR(10) The name of the library the message queue is in.
Can contain the special value *LIBL.
Nullable
MESSAGE_QUEUE_DELIVERY_METHOD DLVRY VARCHAR(10) How the messages are delivered to the message
queue used by the user. Contains one of the
Nullable following values:
MESSAGE_QUEUE_SEVERITY SEV SMALLINT The lowest severity that a message can have and
still be delivered to a user in break or notify mode
Nullable
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) The output queue used by this user. Can contain
one of the following special values:
Nullable
*DEV An output queue with the same
name as the device specified in the
printer device parameter is used by
the user.
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library where the output queue is
located.
Nullable
Contains null if the output queue name is *DEV or
*WRKSTN.
PRINT_DEVICE PRTDEV VARCHAR(10) The printer used to print for this user. Can contain
one of the following special values:
Nullable
*SYSVAL The default system printer
specified in the system value
QPRTDEV is used.
ATTENTION_KEY_HANDLING_ ATNPGM VARCHAR(10) The attention key handling program for this user.
PROGRAM_NAME Can contain one of the following special values:
Nullable
*NONE No Attention-key-handling program
is used.
ATTENTION_KEY_HANDLING_ ATNPGMLIB VARCHAR(10) The name of the library where the program is
PROGRAM_LIBRARY_NAME located. Can contain the special value *LIBL.
Nullable
Contains null if the attention key handling
program is *NONE or *SYSVAL.
LANGUAGE_ID LANGID VARCHAR(10) The language ID used by the system for this user.
Can contain the following special value:
Nullable
*SYSVAL The system value QLANGID is used
to determine the user's language ID.
COUNTRY_OR_REGION_ID CNTRYID VARCHAR(10) Country or region ID. Can contain the following
special value:
Nullable
*SYSVAL The system value QCNTRYID is used
to determine the user's country or
region ID.
CHARACTER_CODE_SET_ID CCSID VARCHAR(6) The CCSID for the user. Can contain the following
special value:
Nullable
QCCSID The system value QCCSID is used to
determine the user's character code
set ID.
USER_OPTIONS USROPT VARCHAR(77) A list of the options for users to customize their
environment. Up to 7 options are returned. Each
Nullable entry is padded with blanks to fill 11 characters.
Contains null if there are no user options.
SORT_SEQUENCE_TABLE_NAME SRTSEQ VARCHAR(10) The name of the sort sequence table used
for string comparisons. Can contain one of the
Nullable following special values:
SORT_SEQUENCE_TABLE_LIBRARY_NAME SRTSEQLIB VARCHAR(10) The name of the library that is used to locate the
sort sequence table.
Nullable
Contains null if the sort sequence table is a
special value.
OBJECT_AUDITING_VALUE OBJAUD VARCHAR(10) The object auditing value for this user. Contains
one of the following values:
Nullable
*ALL Object read and change operations
are audited for the current user
if the object's auditing value is
*USRPRF.
USER_ACTION_AUDIT_LEVEL AUDLVL VARCHAR(363) The action audit values for this user. Up to 31
options are returned. Each entry is padded with
Nullable blanks to fill 11 characters.
Contains null if there are no action values or if the
caller is not authorized to retrieve the action audit
level.
GROUP_AUTHORITY_TYPE GRPAUTTYP VARCHAR(10) The type of authority the user's group profile has
to objects the user creates. Contains one of the
Nullable following special values:
USER_ID_NUMBER UID BIGINT The user ID number for the user profile.
Nullable
GROUP_ID_NUMBER GID BIGINT The group ID number for the user profile. The
value 0 is returned if the user has no group ID
Nullable number.
LOCALE_JOB_ATTRIBUTES SETJOBATR VARCHAR(88) A list of the job attributes that are taken from the
user's locale path. This column contains a list of
Nullable up to 8 items. Each entry is padded with blanks to
fill 11 characters.
GROUP_MEMBER_INDICATOR GRPMBR VARCHAR(3) Whether this user is a group that has members.
Contains one of the following values:
Nullable
NO The user is not a group, or is a group but
does not have any members.
CHARACTER_IDENTIFIER_CONTROL CHRIDCTL VARCHAR(10) The character identifier control for the user. Can
contain the following special values:
Nullable
*DEVD The *DEVD special value
performs the same function as on
the CHRID command parameter
for display files, printer files, and
panel groups.
BLOCK_PASSWORD_CHANGE PWDCHGBLK VARCHAR(10) Specifies the time period, in hours, during which
a password is blocked from being changed
Nullable following the prior successful password change
operation. Can contain one of the following
special values:
USER_EXPIRATION_INTERVAL USREXPITV SMALLINT The number of days (from 1 through 366) before
the user profile is automatically disabled. The
Nullable value 0 is returned if no expiration interval is
defined.
USER_EXPIRATION_DATE USREXPDATE TIMESTAMP The date when the user profile expires and is
automatically disabled or deleted.
Nullable
Contains null if the user profile will not expire.
USER_EXPIRATION_ACTION ACTION VARCHAR(8) The action that will occur when the user profile
has expired. Contains one of the following values:
Nullable
*DELETE The user profile will be deleted. If
the user profile cannot be deleted,
it will be disabled.
HOME_DIRECTORY HOMEDIR VARGRAPHIC(1024) The home directory for this user profile.
CCSID 1200
Nullable
LOCALE_PATH_NAME LOCALE VARGRAPHIC(1024) The locale path name that is assigned to the user
CCSID 1200 profile when a job is started. Can contain one of
the following special values:
Nullable
*C The C locale path name is assigned.
USER_OWNER USER_OWNER VARCHAR(10) The user profile that owns this user profile.
Nullable
USER_CREATOR CREATOR VARCHAR(10) The user profile that created this user profile.
Nullable
Nullable
CREATION_TIMESTAMP TIMESTAMP TIMESTAMP Timestamp of when the user profile was created.
Nullable
LAST_USED_TIMESTAMP LASTUSED TIMESTAMP The date the user profile was used last. The time
portion of the timestamp will always be 0.
Nullable
DAYS_USED_COUNT DAYSUSED INTEGER The number of days the user profile has been
used on the system.
Nullable
LAST_RESET_TIMESTAMP LASTRESET TIMESTAMP The date when the days used count was last reset
to zero. The time portion of the timestamp will
Nullable always be 0.
AUTHORITY_COLLECTION_ACTIVE AUTCOLACT VARCHAR(3) Whether authority collection is active for this user.
Example
USER_INFO_BASIC view
The USER_INFO_BASIC view contains information about user profiles.
This view returns a subset of columns that are returned by the USER_INFO view. It does
not return: USER_OWNER , USER_CREATOR, SIZE, CREATION_TIMESTAMP, LAST_USED_TIMESTAMP,
DAYS_USED_COUNT, or LAST_RESET_TIMESTAMP. USER_INFO_BASIC typically performs much better
than USER_INFO.
The values returned for the columns in the view are closely related to the values returned by Retrieve
User Information (QSYRUSRI) API. Refer to the API for more detailed information.
Authorization: The caller must have *OBJOPR and *READ authorities to the *USRPRF. To see a non-
null value for the USER_DEFAULT_PASSWORD column, the caller must have *ALLOBJ and *SECADM
authorities.
The following table describes the columns in the view. The system name is USER_INFOB. The schema is
QSYS2.
Table 236. USER_INFO_BASIC view
Nullable
PREVIOUS_SIGNON PRVSIGNON TIMESTAMP The date and time the user last signed on.
SIGN_ON_ATTEMPTS_NOT_VALID SIGNONINV INTEGER The number of sign-on attempts that were not
valid since the last successful sign-on.
Nullable
STATUS STATUS VARCHAR(10) The status of the user profile. Contains one of the
following values:
Nullable
*DISABLED The user profile is disabled;
therefore, the user cannot sign
on.
NETSERVER_DISABLED NETSERVER VARCHAR(3) Whether this user profile is disabled for IBM i
NetServer use.
PASSWORD_CHANGE_DATE PWDCHGDAT TIMESTAMP The date the user's password was last changed.
Nullable
PASSWORD_LEVEL_0_1 PWD_0_1 VARCHAR(3) Indicates whether the user profile has a password
that can be used for a system at QPWDLVL 0 or 1.
Nullable
NO The password cannot be used.
PASSWORD_LEVEL_2_3 PWD_2_3 VARCHAR(3) Indicates whether the user profile has a password
that can be used for a system at QPWDLVL 2 or 3.
Nullable
NO The password cannot be used.
PASSWORD_EXPIRATION_INTERVAL PWDEXPITV SMALLINT The number of days (from 1 through 366) the
user's password can remain active before it must
Nullable be changed. Can also be one of the following
values:
DAYS_UNTIL_PASSWORD_EXPIRES PWDDAYSEXP INTEGER The number of days until the password will expire.
A value of 0 indicates the password is expired.
Nullable
Contains null if the password will not expire within
the number of days specified by the password
expiration warning (QPWDEXPWRN) system value.
USER_CLASS_NAME USRCLS VARCHAR(10) The user's class name. Contains one of the
following values:
Nullable
*PGMR The user has a class of
programmer.
SPECIAL_AUTHORITIES SPCAUT VARCHAR(88) A list of the special authorities the user has. Up to
8 authorities are returned. Each entry is padded
Nullable with blanks to fill 11 characters.
Contains null if the user has no special authorities.
GROUP_PROFILE_NAME GRPPRF VARCHAR(10) The name of the group profile. Contains the value
*NONE if the user does not have a group profile.
Nullable
SUPPLEMENTAL_GROUP_LIST SUPGRPLIST VARCHAR(150) A list of supplemental groups for the user profile.
Up to 15 supplemental groups are returned. Each
Nullable entry except for the last one is padded with
blanks to fill 10 characters.
Contains null if the user has no supplemental
groups.
OWNER OWNER VARCHAR(10) This field indicates who is to own objects created
by this user. Contains one of the following values:
Nullable
*GRPPRF The user's group profile owns any
objects the user creates.
GROUP_AUTHORITY GRPAUT VARCHAR(10) The authority the user's group profile has to
objects the user creates. Contains one of the
Nullable following values:
ASSISTANCE_LEVEL ASTLVL VARCHAR(10) The user interface that the user will use. Contains
one of the following values:
Nullable
*ADVANCED The expert system user
interface.
CURRENT_LIBRARY_NAME CURLIB VARCHAR(10) The name of the user's current library. Contains
*CRTDFT if the user does not have a current
Nullable library.
INITIAL_MENU_NAME INLMNU VARCHAR(10) The initial menu for the user. Can contain the
special value *SIGNOFF.
Nullable
INITIAL_MENU_LIBRARY_NAME INLMNULIB VARCHAR(10) The name of the library that the initial menu is in.
Can contain the special value *LIBL.
Nullable
Contains null if the menu name is *SIGNOFF.
INITIAL_PROGRAM_NAME INITPGM VARCHAR(10) The initial program for the user. Contains *NONE
is there is no initial program.
Nullable
INITIAL_PROGRAM_LIBRARY_NAME INITPGMLIB VARCHAR(10) The name of the library that the initial program is
in. Can contain the special value *LIBL.
Nullable
Contains null if the initial program name is *NONE.
TEXT_DESCRIPTION TEXT VARCHAR(50) The descriptive text for the user profile.
KEYBOARD_BUFFERING KBDBUF VARCHAR(10) The keyboard buffering value that is used when a
job is initialized for this user. Contains one of the
Nullable following special values:
HIGHEST_SCHEDULING_PRIORITY PTYLMT CHAR(1) The highest scheduling priority the user is allowed
to have for each job submitted to the system.
Nullable
JOB_DESCRIPTION_NAME JOBD VARCHAR(10) The name of the job description used for jobs that
start through subsystem work station entries.
Nullable
JOB_DESCRIPTION_LIBRARY_NAME JOBDLIB VARCHAR(10) Job description library name. Can contain the
special value *LIBL.
Nullable
ACCOUNTING_CODE ACGCDE VARCHAR(15) The accounting code that is associated with this
user.
Nullable
Contains null if there is no accounting code.
MESSAGE_QUEUE_NAME MSGQ VARCHAR(10) The name of the message queue that is used by
this user.
Nullable
MESSAGE_QUEUE_LIBRARY_NAME MSGQLIB VARCHAR(10) The name of the library the message queue is in.
Can contain the special value *LIBL.
Nullable
MESSAGE_QUEUE_DELIVERY_METHOD DLVRY VARCHAR(10) How the messages are delivered to the message
queue used by the user. Contains one of the
Nullable following values:
MESSAGE_QUEUE_SEVERITY SEV SMALLINT The lowest severity that a message can have and
still be delivered to a user in break or notify mode
Nullable
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) The output queue used by this user. Can contain
one of the following special values:
Nullable
*DEV An output queue with the same
name as the device specified in the
printer device parameter is used by
the user.
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library where the output queue is
located.
Nullable
Contains null if the output queue name is *DEV or
*WRKSTN.
PRINT_DEVICE PRTDEV VARCHAR(10) The printer used to print for this user. Can contain
one of the following special values:
Nullable
*SYSVAL The default system printer
specified in the system value
QPRTDEV is used.
ATTENTION_KEY_HANDLING_ ATNPGM VARCHAR(10) The attention key handling program for this user.
PROGRAM_NAME Can contain one of the following special values:
Nullable
*NONE No Attention-key-handling program
is used.
ATTENTION_KEY_HANDLING_ ATNPGMLIB VARCHAR(10) The name of the library where the program is
PROGRAM_LIBRARY_NAME located. Can contain the special value *LIBL.
Nullable
Contains null if the attention key handling
program is *NONE or *SYSVAL.
LANGUAGE_ID LANGID VARCHAR(10) The language ID used by the system for this user.
Can contain the following special value:
Nullable
*SYSVAL The system value QLANGID is used
to determine the user's language ID.
COUNTRY_OR_REGION_ID CNTRYID VARCHAR(10) Country or region ID. Can contain the following
special value:
Nullable
*SYSVAL The system value QCNTRYID is used
to determine the user's country or
region ID.
CHARACTER_CODE_SET_ID CCSID VARCHAR(6) The CCSID for the user. Can contain the following
special value:
Nullable
QCCSID The system value QCCSID is used to
determine the user's character code
set ID.
USER_OPTIONS USROPT VARCHAR(77) A list of the options for users to customize their
environment. Up to 7 options are returned. Each
Nullable entry is padded with blanks to fill 11 characters.
Contains null if there are no user options.
SORT_SEQUENCE_TABLE_NAME SRTSEQ VARCHAR(10) The name of the sort sequence table used
for string comparisons. Can contain one of the
Nullable following special values:
SORT_SEQUENCE_TABLE_LIBRARY_NAME SRTSEQLIB VARCHAR(10) The name of the library that is used to locate the
sort sequence table.
Nullable
Contains null if the sort sequence table is a
special value.
OBJECT_AUDITING_VALUE OBJAUD VARCHAR(10) The object auditing value for this user. Contains
one of the following values:
Nullable
*ALL Object read and change operations
are audited for the current user
if the object's auditing value is
*USRPRF.
USER_ACTION_AUDIT_LEVEL AUDLVL VARCHAR(363) The action audit values for this user. Up to 31
options are returned. Each entry is padded with
Nullable blanks to fill 11 characters.
Contains null if there are no action values or if the
caller is not authorized to retrieve the action audit
level.
GROUP_AUTHORITY_TYPE GRPAUTTYP VARCHAR(10) The type of authority the user's group profile has
to objects the user creates. Contains one of the
Nullable following special values:
USER_ID_NUMBER UID BIGINT The user ID number for the user profile.
Nullable
GROUP_ID_NUMBER GID BIGINT The group ID number for the user profile. The
value 0 is returned if the user has no group ID
Nullable number.
LOCALE_JOB_ATTRIBUTES SETJOBATR VARCHAR(88) A list of the job attributes that are taken from the
user's locale path. This column contains a list of
Nullable up to 8 items. Each entry is padded with blanks to
fill 11 characters.
GROUP_MEMBER_INDICATOR GRPMBR VARCHAR(3) Whether this user is a group that has members.
Contains one of the following values:
Nullable
NO The user is not a group, or is a group but
does not have any members.
CHARACTER_IDENTIFIER_CONTROL CHRIDCTL VARCHAR(10) The character identifier control for the user. Can
contain the following special values:
Nullable
*DEVD The *DEVD special value
performs the same function as on
the CHRID command parameter
for display files, printer files, and
panel groups.
BLOCK_PASSWORD_CHANGE PWDCHGBLK VARCHAR(10) Specifies the time period, in hours, during which
a password is blocked from being changed
Nullable following the prior successful password change
operation. Can contain one of the following
special values:
USER_EXPIRATION_INTERVAL USREXPITV SMALLINT The number of days (from 1 through 366) before
the user profile is automatically disabled. The
Nullable value 0 is returned if no expiration interval is
defined.
USER_EXPIRATION_DATE USREXPDATE TIMESTAMP The date when the user profile expires and is
automatically disabled or deleted.
Nullable
Contains null if the user profile will not expire.
USER_EXPIRATION_ACTION ACTION VARCHAR(8) The action that will occur when the user profile
has expired. Contains one of the following values:
Nullable
*DELETE The user profile will be deleted. If
the user profile cannot be deleted,
it will be disabled.
HOME_DIRECTORY HOMEDIR VARGRAPHIC(1024) The home directory for this user profile.
CCSID 1200
Nullable
LOCALE_PATH_NAME LOCALE VARGRAPHIC(1024) The locale path name that is assigned to the user
CCSID 1200 profile when a job is started. Can contain one of
the following special values:
Nullable
*C The C locale path name is assigned.
AUTHORITY_COLLECTION_ACTIVE AUTCOLACT VARCHAR(3) Whether authority collection is active for this user.
Example
Determine which users have *ALLOBJ special authority.
Spool Services
These views and functions provide information about spooled files.
DELETE_OLD_SPOOLED_FILES procedure
The DELETE_OLD_SPOOLED_FILES procedure deletes spooled files according to filtering criteria. It can
optionally return a preview of the files that meet the filtering criteria without performing the delete.
Authorization: See Note below.
delete-older-than
DELETE_OLDER_THAN =>
, p-output-queue-library-name
P_OUTPUT_QUEUE_LIBRARY_NAME =>
, p-output-queue-name
P_OUTPUT_QUEUE_NAME =>
, p-user-name
P_USER_NAME =>
)
, preview
PREVIEW =>
delete-older- A timestamp value that defines the starting point for deleting spooled files. Any
than spooled file older than this timestamp is eligible for deletion. The default is CURRENT
TIMESTAMP - 3 MONTHS.
p-output- A character or graphic string that specifies the name of a library. Any spooled file in any
queue-library- output queue in this library is eligible for deletion. The default is *ALL.
name
p-output- A character or graphic string that specifies an output queue name. Any spooled file in
queue-name this output queue is eligible for deletion. The default is *ALL.
p-user-name A character or graphic string that specifies the name of a user whose spooled files are
to be deleted. Any spooled file with this user name is eligible for deletion. The default
is *ALL.
preview A character or graphic string that indicates whether the identified spooled files should
be deleted or returned as a result set.
NO The spooled files will be deleted. This is the default.
YES A result set list of spooled files will be returned. No files will be deleted.
Note
This procedure is provided in the SYSTOOLS schema as an example of how to delete spooled files and
how to return a result set using an SQL procedure. Similar to other Db2 for i provided tools within
SYSTOOLS, the SQL source can be extracted and used as a model for building similar procedures, or to
create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Delete all the spooled files in PRT01 that are older than 30 days.
GENERATE_PDF ( job-name
JOB_NAME =>
, spooled-file-name
SPOOLED_FILE_NAME =>
, spooled-file-number
SPOOLED_FILE_NUMBER =>
, path-name )
PATH_NAME =>
job-name A character string containing a qualified job name. Can contain the following special
value:
* Use the name of the current job.
path-name A character string containing the name of the path where the result PDF file is to be
written.
The result of the function is an integer. If the command is successful, the function returns a value of 1. If
the command returns an error, the function returns a value of -1.
Note
This function is provided in the SYSTOOLS schema as an example of how spooled file data can be
converted to PDF format by embedding the CPYSPLF CL command in an SQL scalar function. Similar to
other Db2 for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for
building similar helper functions, or to create a customized version within a user-specified schema.
Example
Convert the specified spooled file to PDF format and save it as /usr/listing1.
VALUES SYSTOOLS.GENERATE_PDF(
JOB_NAME => '908049/QUSER/QZDASOINIT',
SPOOLED_FILE_NAME => 'PGMA',
SPOOLED_FILE_NUMBER => 2,
PATH_NAME => '/usr/listing1');
OUTPUT_QUEUE_ENTRIES ( outq-lib ,
OUTQ_LIB =>
outq-name
OUTQ_NAME =>
, detailed-info )
DETAILED_INFO =>
outq-lib A character or graphic string expression that identifies the name of the library containing
outq-name. If this parameter is blank, the default of *LIBL is used.
outq-name A character or graphic string expression that identifies the name of an output queue.
detailed-info A character or graphic string expression that indicates the type of information to be
returned.
YES All the information available for the output queue is returned.
NO Only the general information is returned for the output queue. This is the
information in the columns prior to the ACCOUNTING_CODE column. This is the
default.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 237. OUTPUT_QUEUE_ENTRIES table function
SPOOLED_FILE_NAME VARCHAR(10) The file name that was specified by the user program when the file was created,
or the name of the device file used to create this file.
USER_NAME VARCHAR(10) The name of the user profile that produced the file.
USER_DATA VARCHAR(10) The user-specified data that describes this file. Contains null if there is no user-
specified data.
OPEN The file has not been completely processed and is not ready
to be selected by a writer.
PRINTING The file has been completely sent to the printer but print
complete status has not been sent back.
SAVED The file has been printed and then saved. This file remains
saved until it is released.
SENDING The file is being sent or has been sent to a remote system.
FORM_TYPE VARCHAR(10) The type of form that should be loaded in the printer to print this file.
JOB_NAME VARCHAR(28) The qualified job name that produced the file.
DEVICE_TYPE VARCHAR(10) The type of data stream used to represent the file.
SYSTEM VARCHAR(8) The name of the system where the job that created the spooled file ran.
Values for the following columns are returned when the DETAILED_INFO parameter is YES. Otherwise, the columns will contain the null value.
ACCOUNTING_CODE VARCHAR(15) An identifier assigned by the system to record the resources used to write this
file.
EXPIRATION_DATE DATE The date the file will be eligible for removal from the system by the Delete
Expired Spooled Files (DLTEXPSPLF) command. Contains the null value if the file
will not expire.
*YES The file is set to save status after it has been written.
TOTAL_RECORDS INTEGER The total number of records in the printer file. It is possible for TOTAL_RECORDS
to be larger than MAXIMUM_RECORDS due to a reply to inquiry message
CPA4072.
Contains null if the spooled file data stream is not *AFPDS, *AFPDSLINE, or
*LINE, or if the file is open.
MAXIMUM_RECORDS INTEGER The maximum number of records allowed in the file at the time the file was
opened.
Contains null if there is no maximum.
PAGE_LENGTH INTEGER The page length, in lines per page, used by the spooled file.
LINES_PER_INCH DECIMAL(5,1) The number of lines per vertical inch defined in the printer file.
PAGE_WIDTH INTEGER The page width, in characters per printed line, used by the spooled file.
CHARACTERS_PER_INCH DECIMAL(5,1) The number of characters per horizontal inch, defined in the printer file.
PRINT_FIDELITY VARCHAR(8) The kind of error handling that is performed when printing.
*CONTENT The printing overrides errors in the data stream and continues
printing with the printers best quality based on the content
fidelity.
PAGE_ROTATION VARCHAR(5) The degree of rotation of the text on the page, with respect to the way the form is
loaded into the printer.
*DEVD The operating system sends a device default rotation value to the
printer. Page rotation is dependent on the printer's specifications.
*COR Output created for a form 13.2 inches wide by 11.0 inches long is
adjusted to print on a form 11.0 inches wide by 8.5 inches long.
*FORMDF The file uses a user-specified form definition. This value is used
only for *LINE, *AFPDS, and *AFPDSLINE printer device type files.
*YES The printing is on both sides of the page with the top of each page
the same for both sides.
*TUMBLE The printing is on both sides with the top of one printed page at the
opposite end from the top of the other printed page.
FILE_AVAILABLE VARCHAR(8) The time when this file becomes available to an output device for processing.
*JOBEND The file is available when the job that owns the file is completed.
STARTING_PAGE VARCHAR(10) The page at which printing is to start for the file. Can contain the following special
value:
ENDING_PAGE VARCHAR(10) The page at which printing is to end for the file. Can contain the following special
value:
DEVICE_FILE_LIBRARY VARCHAR(10) The name of the library that contains the device file.
DEVICE_FILE_NAME VARCHAR(10) The name of the device file used to create the spooled file.
USER_DEFINED_DATA BINARY(255) Data defined by the user to be used by user applications or user-specified
programs that process spooled files.
Contains null when there is no user-defined data.
PROGRAM_THAT_OPENED_FILE_LIBRARY VARCHAR(10) The name of the library that contains the program that opened the file. Contains
null when the program is not known.
PROGRAM_THAT_OPENED_FILE_NAME VARCHAR(10) The name of the program that opened the spooled file. Contains null when the
program is not known.
FORM_DEFINITION_LIBRARY VARCHAR(10) The name of the library that contains the form definition. Contains null if
FORM_DEFINITION_NAME is a special value or if no form definition is specified
for this spooled file.
FORM_DEFINITION_NAME VARCHAR(10) The name of the form definition to use for this print request. Can contain one of
the following special values:
*DEVD The form definition in the printer device description will be used.
*INLINE The form definition defined in the spooled file data stream will be
used.
*INLINED The form definition defined in the spooled file data stream will be
used. If a form definition is not found, the form definition in the
printer device description will be used.
F1DFLT The form definition defined in the spooled file data stream will be
used.
Contains null when no form definition is specified for this spooled file.
PAGE_DEFINITION_LIBRARY VARCHAR(10) The name of the library containing the page definition. Contains the null value for
*LINE or *AFPDSLINE printer device type files.
PAGE_DEFINITION_NAME VARCHAR(10) The name of the page definition to use for the file. Contains the null value for
*LINE or *AFPDSLINE printer device type files.
FRONT_OVERLAY_LIBRARY VARCHAR(10) The name of the library containing the front overlay. Can contain one of these
special values:
FRONT_OVERLAY_NAME VARCHAR(10) The name of the front overlay. Can contain the following special value:
BACK_OVERLAY_LIBRARY VARCHAR(10) The name of the library containing the back overlay. Contains null when
BACK_OVERLAY_NAME is a special value.
BACK_OVERLAY_NAME VARCHAR(10) The name of the back overlay. Can contain the following special values:
CHARACTER_SET_LIBRARY VARCHAR(10) The name of the library containing the font character set object. Can contain one
of these special values:
*CURLIB The current library is searched for the font character set object.
*LIBL The library list is used to locate the font character set object.
CHARACTER_SET_NAME VARCHAR(10) The name of the font character set object used to print this file. Can contain the
following special value:
*FONT The information specified on the font parameter is used instead of the
character set and code page.
CODE_PAGE_LIBRARY VARCHAR(10) The name of the library containing the code page used to print this spooled file.
Can contain one of these special values:
*CURLIB The current library is searched for the code page name.
*LIBL The library list is used to locate the code page name.
Contains null when no code page is specified for this spooled file.
CODE_PAGE_NAME VARCHAR(10) The name of the code page used to print this spooled file. Contains null when no
code page is specified for this spooled file.
CHARACTER_SET_POINTSIZE DECIMAL(5,1) The point size in which this file's characters should be printed. Contains null if the
character set does not have a point size.
CODED_FONT_LIBRARY VARCHAR(10) The name of the library containing the coded font used to print this spooled file.
Can contain one of these special values:
CODED_FONT_NAME VARCHAR(10) The name of the coded font used to print this spooled file. Can contain the
following special value:
*FNTCHRSET The values used are the values specified on the character set
name and library name and code page name and library name
fields.
CODED_FONT_POINTSIZE DECIMAL(5,1) The point size in which this file's characters should be printed. Contains null if the
coded font does not have a point size.
MULTIBYTE_DATA VARCHAR(10) Whether the file can contain double-byte character set (DBCS) data, Unicode
data, or both. Values are *YES and *NO.
DBCS_CODED_FONT_LIBRARY VARCHAR(10) The name of the library containing the DBCS-coded font. Can contain one of these
special values:
DBCS_CODED_FONT_NAME VARCHAR(10) The name of the DBCS-coded font used to print DBCS-coded data on printers
configured as AFP(*YES). Can contain the following special value:
DBCS_CODED_FONT_POINTSIZE DECIMAL(5,1) The point size in which this file's DCBS characters should be printed. Contains
null if the DBCS-coded font does not have a point size.
Example
Find the 100 largest spool files in the QEZJOBLOG output queue. Since no detailed information is needed,
specify NO to avoid the additional processing.
SELECT *
FROM TABLE(QSYS2.OUTPUT_QUEUE_ENTRIES('*LIBL', 'QEZJOBLOG', 'NO')) A
ORDER BY SIZE DESC
FETCH FIRST 100 ROWS ONLY
OUTPUT_QUEUE_ENTRIES view
The OUTPUT_QUEUE_ENTRIES view returns one row for each spooled file in every output queue. This
view uses the QSYS2.OUTPUT_QUEUE_ENTRIES table function with DETAILED_INFO => 'YES'.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the output queue, and
– *READ authority to the output queue object, or
– *SPLCTL special authority, or
– *JOBCTL special authority and the output queue is defined with OPRCTL(*YES).
To achieve the best performance when querying the OUTPUT_QUEUE_ENTRIES view, the use
of a WHERE clause is recommended if you are interested in examining specific output
queue libraries or output queues. OUTPUT_QUEUE_ENTRIES_BASIC typically performs much
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) Name of the output queue containing the spooled file.
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library that contains the output queue.
CREATE_TIMESTAMP CREATED TIMESTAMP The timestamp when the file was created.
SPOOLED_FILE_NAME SPOOLNAME VARCHAR(10) The file name that was specified by the user program when the
file was created, or the name of the device file used to create
this file.
USER_NAME USER_NAME VARCHAR(10) The name of the user profile that produced the file.
USER_DATA USER_DATA VARCHAR(10) The user-specified data that describes this file. Contains null if
there is no user-specified data.
Nullable
SAVED The file has been printed and then saved. This
file remains saved until it is released.
FORM_TYPE FORM_TYPE VARCHAR(10) The type of form that should be loaded in the printer to print this
file.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name that produced the file.
DEVICE_TYPE DEVTYPE VARCHAR(10) The type of data stream used to represent the file.
FILE_NUMBER FILENUM INTEGER The spooled file number of the specified file.
SYSTEM SYSTEM VARCHAR(8) The name of the system where the job that created the spooled
file ran.
ACCOUNTING_CODE ACGCDE VARCHAR(15) An identifier assigned by the system to record the resources
used to write this file.
EXPIRATION_DATE EXPDATE DATE The date the file will be eligible for removal from the system
by the Delete Expired Spooled Files (DLTEXPSPLF) command.
Nullable Contains the null value if the file will not expire.
SAVE_AFTER_WRITE SAVEAFTER VARCHAR(4) Indicates whether this file is to be saved after it is written.
*YES The file is set to save status after it has been written.
TOTAL_RECORDS TOTALRCDS INTEGER The total number of records in the printer file. It is possible for
TOTAL_RECORDS to be larger than MAXIMUM_RECORDS due to
a reply to inquiry message CPA4072.
Contains null if the spooled file data stream is not *AFPDS,
*AFPDSLINE, or *LINE, or if the file is open.
MAXIMUM_RECORDS MAXRCDS INTEGER The maximum number of records allowed in the file at the time
the file was opened.
Contains null if there is no maximum.
PAGE_LENGTH PAGELEN INTEGER The page length, in lines per page, used by the spooled file.
LINES_PER_INCH LPI DECIMAL(5,1) The number of lines per vertical inch defined in the printer file.
PAGE_WIDTH WIDTH INTEGER The page width, in characters per printed line, used by the
spooled file.
CHARACTERS_PER_INCH CPI DECIMAL(5,1) The number of characters per horizontal inch, defined in the
printer file.
PRINT_FIDELITY FIDELITY VARCHAR(8) The kind of error handling that is performed when printing.
PAGE_ROTATION ROTATION VARCHAR(5) The degree of rotation of the text on the page, with respect to
the way the form is loaded into the printer.
FILE_AVAILABLE FILEAVAIL VARCHAR(8) The time when this file becomes available to an output device
for processing.
*JOBEND The file is available when the job that owns the
file is completed.
STARTING_PAGE STARTPAGE VARCHAR(10) The page at which printing is to start for the file. Can contain the
following special value:
ENDING_PAGE ENDPAGE VARCHAR(10) The page at which printing is to end for the file. Can contain the
following special value:
DEVICE_FILE_LIBRARY DEVLIB VARCHAR(10) The name of the library that contains the device file.
DEVICE_FILE_NAME DEVFILE VARCHAR(10) The name of the device file used to create the spooled file.
USER_DEFINED_DATA USRDFNDTA BINARY(255) Data defined by the user to be used by user applications or
user-specified programs that process spooled files.
Contains null when there is no user-defined data.
PROGRAM_THAT_OPENED_ LIBOPEN VARCHAR(10) The name of the library that contains the program that opened
FILE_LIBRARY the file. Contains null when the program is not known.
Nullable
PROGRAM_THAT_OPENED_ PGMOPEN VARCHAR(10) The name of the program that opened the spooled file. Contains
FILE_NAME null when the program is not known.
Nullable
FORM_DEFINITION_LIBRARY FORMLIB VARCHAR(10) The name of the library that contains the form definition.
Contains null if FORM_DEFINITION_NAME is a special value or if
Nullable no form definition is specified for this spooled file.
FORM_DEFINITION_NAME FORMNAME VARCHAR(10) The name of the form definition to use for this print request. Can
contain one of the following special values:
Nullable
*DEVD The form definition in the printer device
description will be used.
PAGE_DEFINITION_LIBRARY PAGELIB VARCHAR(10) The name of the library containing the page definition. Contains
the null value for *LINE or *AFPDSLINE printer device type files.
Nullable
PAGE_DEFINITION_NAME PAGENAME VARCHAR(10) The name of the page definition to use for the file. Contains the
null value for *LINE or *AFPDSLINE printer device type files.
Nullable
FRONT_OVERLAY_LIBRARY FRONTLIB VARCHAR(10) The name of the library containing the front overlay. Can contain
one of these special values:
Nullable
*CURLIB The current ibrary is searched the front overlay.
FRONT_OVERLAY_NAME FRONTNAME VARCHAR(10) The name of the front overlay. Can contain the following special
value:
BACK_OVERLAY_LIBRARY BACKLIB VARCHAR(10) The name of the library containing the back overlay. Contains
null when BACK_OVERLAY_NAME is a special value.
Nullable
BACK_OVERLAY_NAME BACKNAME VARCHAR(10) The name of the back overlay. Can contain the following special
values:
CHARACTER_SET_LIBRARY CHRSETLIB VARCHAR(10) The name of the library containing the font character set object.
Can contain one of these special values:
Nullable
*CURLIB The current library is searched for the font
character set object.
CHARACTER_SET_NAME CHRSETNAME VARCHAR(10) The name of the font character set object used to print this file.
Can contain the following special value:
CODE_PAGE_LIBRARY CODELIB VARCHAR(10) The name of the library containing the code page used to print
this spooled file. Can contain one of these special values:
Nullable
*CURLIB The current library is searched for the code page
name.
CODE_PAGE_NAME CODENAME VARCHAR(10) The name of the code page used to print this spooled file.
Contains null when no code page is specified for this spooled
Nullable file.
CHARACTER_SET_POINTSIZE CHARSIZE DECIMAL(5,1) The point size in which this file's characters (defined by
CHARACTER_SET) should be printed. Contains null if the
Nullable character set does not have a point size.
CODED_FONT_LIBRARY FONTLIB VARCHAR(10) The name of the library containing the coded font used to print
this spooled file. Can contain one of these special values:
Nullable
*CURLIB The current library is searched for the coded font.
CODED_FONT_NAME FONTNAME VARCHAR(10) The name of the coded font used to print this spooled file. Can
contain the following special value:
CODED_FONT_POINTSIZE FONTSIZE DECIMAL(5,1) The point size in which this file's characters (defined by
CODED_FONT) should be printed. Contains null if the coded font
Nullable does not have a point size.
MULTIBYTE_DATA MULTIBYTE VARCHAR(10) Whether the file can contain double-byte character set (DBCS)
data, Unicode data, or both. Values are *YES and *NO.
DBCS_CODED_FONT_LIBRARY DBCSLIB VARCHAR(10) The name of the library containing the DBCS-coded font. Can
contain one of these special values:
Nullable
*CURLIB The current library is searched for the DBCS-coded
font.
DBCS_CODED_FONT_NAME DBCSNAME VARCHAR(10) The name of the DBCS-coded font used to print DBCS-coded
data on printers configured as AFP(*YES). Can contain the
following special value:
DBCS_CODED_FONT_POINTSIZE DBCSSIZE DECIMAL(5,1) The point size in which this file's DCBS characters (defined
by DBCS_CODED_FONT) should be printed. Contains null if the
Nullable DBCS-coded font does not have a point size.
Example
For the output queue with the largest number of files, determine how many kilobytes of data would be
deleted by running the Delete Expired Spooled Files (DLTEXPSPLF) CL command.
OUTPUT_QUEUE_ENTRIES_BASIC view
The OUTPUT_QUEUE_ENTRIES_BASIC view returns one row for each spooled file in every output queue.
This view uses the QSYS2.OUTPUT_QUEUE_ENTRIES table function with DETAILED_INFO => 'NO'.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the output queue, and
– *READ authority to the output queue object, or
– *SPLCTL special authority, or
– *JOBCTL special authority and the output queue is defined with OPRCTL(*YES).
To achieve the best performance when querying the OUTPUT_QUEUE_ENTRIES_BASIC view,
the use of a WHERE clause is recommended if you are interested in examining specific
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) Name of the output queue containing the spooled file.
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library that contains the output queue.
CREATE_TIMESTAMP CREATED TIMESTAMP The timestamp when the file was created.
SPOOLED_FILE_NAME SPOOLNAME VARCHAR(10) The file name that was specified by the user program when the
file was created, or the name of the device file used to create
this file.
USER_NAME USER_NAME VARCHAR(10) The name of the user profile that produced the file.
USER_DATA USER_DATA VARCHAR(10) The user-specified data that describes this file. Contains null if
there is no user-specified data.
Nullable
SAVED The file has been printed and then saved. This
file remains saved until it is released.
FORM_TYPE FORM_TYPE VARCHAR(10) The type of form that should be loaded in the printer to print this
file.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name that produced the file.
DEVICE_TYPE DEVTYPE VARCHAR(10) The type of data stream used to represent the file.
FILE_NUMBER FILENUM INTEGER The spooled file number of the specified file.
SYSTEM SYSTEM VARCHAR(8) The name of the system where the job that created the spooled
file ran.
Examples
• Find the 100 largest spool files in the QEZJOBLOG output queue.
OUTPUT_QUEUE_INFO view
The OUTPUT_QUEUE_INFO view returns one row for each output queue.
The values returned for the columns in the view are similar to the values returned by the Retrieve Output
Queue Information (QSPROUTQ) API. Refer to the API for more detailed information.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the output queue, and
– *READ authority to the output queue object, or
– *SPLCTL special authority, or
– *JOBCTL special authority and the output queue is defined with OPRCTL(*YES).
The following table describes the columns in the view. The system name is OUTQ_DTL. The schema is
QSYS2.
Table 240. OUTPUT_QUEUE_INFO view
OUTPUT_QUEUE_LIBRARY_NAME OUTQLIB VARCHAR(10) The name of the library that contains the output queue.
NUMBER_OF_FILES FILES INTEGER The total number of spooled files currently on this output queue.
NUMBER_OF_WRITERS WRITERS INTEGER The number of printer writers that have been started to this
output queue.
WRITERS_TO_AUTOSTART AUTOSTART INTEGER The number of remote printer writers to autostart to this output
queue at system IPL.
PRINTER_DEVICE_NAME DEV_NAME VARCHAR(10) The name of the printer device. If more than one writer is started,
this is the printer device name of the first writer.
Nullable
Contains the null value if WRITER_TYPE is not PRINTER.
ORDER_OF_FILES FILE_ORDER VARCHAR(7) The order of the spooled files on the output queue.
*FIFO The queue is first-in first-out for each file. That is,
on the queue, new spooled files are placed behind
all other spooled files that have the same priority.
*JOBNBR The queue entries for the spooled files are sorted
in priority sequence using the job number (the date
and time that the job entered the system) of the job
that created the spooled file.
DISPLAY_ANY_FILE ANYFILE VARCHAR(6) Whether users who have authority to read this output queue can
display the output data of any output file on this queue, or only
the data in their own files.
JOB_SEPARATORS JOB_SEP VARCHAR(4) The number of job separators (0-9) to be placed at the beginning
of the output for each job having spooled file entries on this
output queue. Can also contain the following special value:
MAXIMUM_PAGES MAX_PAGES INTEGER Only spooled files with this number of pages or less
will print between MAXIMUM_PAGES_STARTING_TIME and
Nullable MAXIMUM_PAGES_ENDING_TIME. If more than one set of
maximum spooled file size values is defined for this output
queue, only information for the first set is returned.
Contains the null value if no maximum spooled file size is defined.
MAXIMUM_PAGES_STARTING_ MAX_START TIME The starting time, in local job time, that spooled files exceeding
TIME MAXIMUM_PAGES will be restricted from printing. If a spooled
Nullable file exceeds the page limit it will be in deferred status until
ENDING_TIME.
Contains the null value if no maximum spooled file size is defined.
MAXIMUM_PAGES_ENDING_ MAX_END TIME The ending time, in local job time, when spooled files exceeding
TIME MAXIMUM_PAGES will be allowed to print.
Nullable
Contains the null value if no maximum spooled file size is defined.
OPERATOR_CONTROLLED OPR_CTRL VARCHAR(4) Whether users with job control authority are allowed to manage
or control the files on this queue. Users have job control authority
if SPCAUT(*JOBCTL) is specified in their user profile.
*YES Users with job control authority can control the queue
and make changes to the files on the queue.
AUTHORITY_TO_CHECK ALL_AUTH VARCHAR(7) Indicates what type of authorities to the output queue allow the
user to control all the files on the queue.
*OWNER Only the owner of the output queue can control all
the output files on the queue.
DATA_QUEUE_LIBRARY DTAQ_LIB VARCHAR(10) The name of the library containing the data queue.
Nullable Contains the null value if no data queue is associated with this
output queue.
DATA_QUEUE_NAME DTAQ_NAME VARCHAR(10) The name of the data queue associated with this output queue.
Nullable Contains the null value if no data queue is associated with this
output queue.
WRITER_JOB_NAME WRITER_JOB VARCHAR(28) The qualified job name of the writer job. If more than one writer is
started, this is the name of the first writer.
Nullable
Contains the null value if a writer job is not started for this queue.
WRITER_JOB_STATUS WRITER_STS VARCHAR(4) The status of the writer job. If more than one writer is started,
this is the status of the first writer.
Nullable
END The writer job has ended.
Contains the null value if a writer job is not started for this queue.
WRITER_TYPE WRITER_TYP VARCHAR(7) The type of writer started for this output queue.
Contains the null value if a writer job is not started for this queue.
SPOOLED_FILE_ASP_ATTRIBUTE ASP_ATTR VARCHAR(8) The auxiliary storage pool (ASP) where the spooled files are to
reside.
SPOOLED_FILE_ASP_NUMBER ASPNUM INTEGER The number of the auxiliary storage pool (ASP) where the spooled
files reside.
SPOOLED_FILE_ASPGRP ASPGRP VARCHAR(10) The name of the auxiliary storage pool (ASP) device where the
spooled files reside. Can also contain the following special value:
Nullable
*SYSBAS The spooled files resides in the system ASP (ASP 1)
or one of the defined basic user ASPs (ASPs 2-32).
Nullable Contains the null value if the output queue has no description.
MESSAGE_QUEUE_LIBRARY MSGQ_LIB VARCHAR(10) The name of the library containing the message queue. Can
contain the following special value:
Nullable
*LIBL The library list is searched to find the message queue.
Contains the null value if the output queue is not a remote output
queue or if WRITER_TYPE is PRINTER.
MESSAGE_QUEUE_NAME MSGQ_NAME VARCHAR(10) The name of the message queue to which messages, created by
the remote writer started to this output queue, are sent.
Nullable
Contains the null value if the output queue is not a remote output
queue or if WRITER_TYPE is PRINTER.
HOST_PRINT_TRANSFORM TRANSFORM VARCHAR(4) Whether to use the host print transform function to transform a
spooled file.
Nullable
*NO Do not transform data streams using host print
transform.
MANUFACTURER_TYPE_AND_ TYPE_MODEL VARCHAR(17) The manufacturer, type, and model for a printer using the host
MODEL print transform function.
Nullable
See Printer Model Settings for Host Print Transform (HPT) in the
IBM Support Portal for the list of supported values.
Contains the null value when NETWORK_CONNECTION_TYPE
is *SNA, or when NETWORK_CONNECTION_TYPE is *IP and
HOST_PRINT_TRANSFORM is *NO.
WORKSTATION_CUSTOMIZING_ CUSTOM_LIB VARCHAR(10) The library name for the workstation customizing object.
OBJECT_LIBRARY Nullable Contains the null value if there is no workstation customizing
object or if NETWORK_CONNECTION_TYPE is *SNA and
USER_DRIVER_PROGRAM_NAME is null.
WORKSTATION_CUSTOMIZING_ CUSTOM_NAM VARCHAR(10) The name of an object that consists of a table of attributes used
OBJECT_NAME to customize a given ASCII device.
Nullable
Contains the null value if there is no workstation customizing
object or if NETWORK_CONNECTION_TYPE is *SNA and
USER_DRIVER_PROGRAM_NAME is null.
NETWORK_CONNECTION_TYPE NET_TYPE VARCHAR(7) The type of network connection to the remote system.
Nullable *IP The TCP/IP network is used as the connectivity to
the remote system.
Contains the null value if the output queue is not a remote output
queue.
DESTINATION_TYPE DEST_TYPE VARCHAR(8) The type of destination system that spooled files on this output
queue are being sent to.
Nullable
*NDS The destination is Novell NetWare 3 or 4, and the
connection type is *USRDFN.
Contains the null value if the output queue is not a remote output
queue.
Nullable Contains the null value if the output queue is not a remote output
queue.
REMOTE_PRINTER_QUEUE REMOTE_PRT VARCHAR(255) The name of the remote printer. Can also contain one of these
special values:
Nullable
*SYSTEM The default system printer on the remote system
will determine the printer queue.
*USER The user profile that creates the spooled file will
determine the user ID on the remote system that it
is sent to.
Contains the null value if the output queue is not a remote output
queue.
INTERNET_ADDRESS IP_ADDRESS VARCHAR(15) The internet address of the remote system to which the print
request will be sent.
Nullable
Contains the null value if the output queue is not a remote output
queue.
Contains the null value if the output queue is not a remote output
queue.
USER_DRIVER_PROGRAM_ UDP_LIB VARCHAR(10) The name of the library that contains the user driver program.
LIBRARY Can also be one of these special values:
Nullable
*CURLIB The current library for the job is used to locate the
user driver program.
USER_DRIVER_PROGRAM_NAME UDP_NAME VARCHAR(10) The name of the user-specified driver program that is used to
process the spooled files on the output queue.
Nullable
Contains the null value if no user driver program is specified.
USER_DEFINED_OBJECT_LIBRARY UDO_LIB VARCHAR(10) The name of the library that contains the user-defined object.
Can also be one of these special values:
Nullable
*CURLIB The current library for the job is used to locate the
user-defined object.
USER_DEFINED_OBJECT_NAME UDO_NAME VARCHAR(10) The name of the user-defined object that is used by user
applications or user-specified programs that process spooled
Nullable files.
Contains the null value if no user-defined object is specified.
*FILE File.
DATA_TRANSFORM_PROGRAM_ DTP_LIB VARCHAR(10) The name of the library that contains the data transform program.
LIBRARY Can also be one of these special values:
Nullable
*CURLIB The current library for the job is used to locate the
data transform program.
DATA_TRANSFORM_PROGRAM_ DTP_NAME VARCHAR(10) The name of the user-specified data transform program that is
NAME used by the driver program.
Nullable
Contains the null value if no data transform program is specified.
Nullable Contains the null value if there are not at least two user-defined
options.
Nullable Contains the null value if there are not at least three user-defined
options.
Nullable Contains the null value if there are not at least four user-defined
options.
USER_DEFINED_DATA UDEF_DATA VARBINARY(5000) Data defined by the user to be used by user applications or user-
specified programs that process spooled files.
Nullable
Contains the null value if there is no user-defined data.
LDAP_PUBLISHING_STATUS PUBLISHED VARCHAR(3) Whether the output queue is published in the network directory.
FORMS_CONTROL_BUFFER FORMS_BUF VARCHAR(8) The forms control buffer (FCB) for files sent to a VM/MVS™ host
system. Contains either the name of the FCB or one of the
Nullable following special values:
VM_MVS_CLASS VM_CLASS CHAR(1) The VM/MVS SYSOUT class for distributions sent to a VM host
system or to a MVS host system. Values are A-Z, 0-9 to indicate
Nullable the distribution class.
Contains the null value if not defined for this output queue.
Example
PRINTER_FILE_INFO view
The PRINTER_FILE_INFO view returns many attributes of IBM i printer files.
The information is returned by using the Display File Description (DSPFD) CL command.
Authorization: See Note below.
The following table describes the columns in the view. The system name is PRTF_INFO. The schema is
SYSTOOLS.
Table 241. PRINTER_FILE_INFO view
PRINTER_FILE_LIBRARY PRTF_LIB VARCHAR(10) Name of the library that contains the printer file.
SPOOLED_OUTPUT_QUEUE_LIBRARY OUTQ_LIB VARCHAR(10) Library containing output queue for spooled files.
SPOOLED_OUTPUT_QUEUE OUTQ VARCHAR(10) Output queue for spooled files. Can contain the following
special value:
DEFINER DEFINER VARCHAR(10) The user who created the printer file.
CREATE_TIMESTAMP CREATED TIMESTAMP The time the printer file was created.
LAST_USED_TIMESTAMP LAST_USED TIMESTAMP The time the printer file was last used.
Nullable Contains the null value if the printer file has never been
used.
MAXIMUM_RECORDS MAXRCDS INTEGER The maximum number of records allowed in the spooled
file.
Nullable
Contains the null value if there is no maximum.
FILE_AVAILABLE FILEAVAIL VARCHAR(8) The time when a spooled file becomes available to an
output device for processing.
OUTPUT_PRIORITY OUTPTY VARCHAR(4) For spooled output, the assigned priority on the output
queue. Can contain the following special value:
USER_DATA USER_DATA VARCHAR(10) For spooled output, user-specified data that identifies the
file. Can contain the following special value:
SPOOLED_FILE_OWNER SPOOL_OWN VARCHAR(10) For spooled output, the owner assigned to the spooled
file. Can contain the following special values:
PAGE_LENGTH PAGE_LEN DECIMAL(6,3) The page length, in lines per page, used by the spooled
file.
PAGE_WIDTH PAGE_WIDTH DECIMAL(6,3) The page width, in characters per printed line, used by the
spooled file.
LINES_PER_INCH LPI DECIMAL(3,1) The line spacing setting on the printer, in lines per inch.
CHARACTERS_PER_INCH CPI DECIMAL(3,1) The printer character density, in characters per inch.
NUMBER_RECORD_FORMATS FORMATS INTEGER The number of record formats defined for the printer file
RECORD_FORMAT RCDFMT CLOB(1M) CCSID 1208 A list of record formats for the printer file. The value
is returned as a JSON array, with each array element
Nullable containing a JSON object with information for one format.
The array name is RCDFMT. The array elements consist of:
• The format name, with a key of FORMAT_NAME
• The number of fields in the format, with a key of
FORMAT_NUMBER_FIELDS
• The length of the format, with a key of
FORMAT_RECORD_LENGTH
• The format level ID, with a key of FORMAT_LEVEL_ID
• Descriptive text for the format, with a key of
FORMAT_TEXT
Contains the null value if record format information is not
available for this printer file.
Note
This function is provided in the SYSTOOLS schema as an example of returning information from a CL
command's OUTFILE. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be
extracted and used as a model for building similar helper functions, or to create a customized version
within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
• Look at some printer file attributes for printer files in library APPLIB1.
SELECT J.*
FROM SYSTOOLS.PRINTER_FILE_INFO,
JSON_TABLE(RECORD_FORMAT, 'lax $.RCDFMT'
COLUMNS (FORMAT_NAME VARCHAR(10),
FORMAT_FIELDS INTEGER,
FORMAT_LENGTH INTEGER,
FORMAT_LEVEL_ID CHAR(13),
FORMAT_TEXT VARCHAR(50)
)) J
WHERE PRINTER_FILE_LIBRARY = 'APPLIB1' AND PRINTER_FILE = 'INVOICE';
, spooled-file-name
SPOOLED_FILE_NAME =>
)
, spooled-file-number
SPOOLED_FILE_NUMBER =>
job-name A character string containing a qualified job name. Can contain the following special
value:
spooled-file-name A character string containing the name of the spooled file. If this parameter is
omitted, QPJOBLOG is used.
spooled-file- The number of the spooled file. If this parameter is omitted, the spooled file with
number the highest number matching spooled-file-name is used.
The result of the function is a table containing a row for each record in the specified spooled file. The
columns of the result table are described in the following table. The result columns are nullable.
Table 242. SPOOLED_FILE_DATA table function
SPOOLED_DATA VARCHAR(200) The data for this row in the spooled file.
Note
This function is provided in the SYSTOOLS schema as an example of how spooled file data can be
returned by embedding the CPYSPLF CL command in an SQL table function. Similar to other Db2 for i
provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar
helper functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
Return the most recent QSYSPRT file for a specific job:
SPOOLED_FILE_INFO (
user-name
USER_NAME =>
, starting-timestamp
STARTING_TIMESTAMP =>
, ending-timestamp
ENDING_TIMESTAMP =>
, status
STATUS =>
, job-name
JOB_NAME =>
, output-queue
OUTPUT_QUEUE =>
, user-data
USER_DATA =>
, form-type
FORM_TYPE =>
)
, system-name
SYSTEM_NAME =>
user-name A character string containing user profile names to filter on. The list can contain up to 20
values separated by blanks.
Can be one of the following special values:
*ALL Spooled files are included in the list regardless of the current status. This
is the default.
*CLOSED The file has been completely processed by a program, but
SCHEDULE(*JOBEND) was specified. The job that produced the spooled
file has not finished.
*DEFERRED This spooled file has been deferred from printing.
*FINISHED This spooled file is no longer in the system. These spooled files are
included in the list of spooled files only if the qualified job name is
specified.
*HELD The file has been held.
*MESSAGE This file has a message that needs a reply or needs an action to be taken.
*OPEN The file has not been completely processed and is not ready to be
selected by a writer.
*PENDING This file is pending (waiting) to be printed.
*PRINTER The file has been completely sent to the printer, but the print complete
status has not been sent back.
*READY The file is available to be written to an output device by a writer.
*SAVED The file has been written and then saved. This file remains saved until it is
released.
*SENDING This spooled file is being sent or has been sent to a remote system.
*WRITING This file is currently being produced by the writer on an output device.
output- A character string containing the name of the output queue to filter on. An output queue
queue name must be in the format library-name/outq-name. The list can contain up to 20 values
separated by blanks.
*LIBL or *CURLIB can be specified for the library name.
Instead of a list of qualified output queue names, the following special value can be used:
*ALL Spooled files are included in the list regardless of the output queue. This is the
default.
user-data A character string containing the value of the user-specified data or file name for spooled
files to filter on.
Can be the following special value:
form-type A character string containing the form type value to filter on.
Can be one of the following special values:
*ALL Spooled files are included in the list regardless of the value for form type. This is
the default.
*STD Only files that specify the standard form type are included in the list.
system- A character string containing the name of the system where the job that created the
name spooled file ran.
Can be one of the following special values:
*ALL The list is not filtered based on job system name. This is the default.
*CURRENT Only spooled files created on the current system are to be returned.
The result of the function is a table containing rows with the format shown in the following table. All
columns are nullable.
Table 243. SPOOLED_FILE_INFO table function
SAVED The file has been written and then saved. This
file remains saved until it is released.
OUTPUT_PRIORITY INTEGER The priority of the spooled file. The priority ranges from 1 (highest)
to 9 (lowest).
Contains the null value when STATUS is DELETED.
CREATION_TIMESTAMP TIMESTAMP(0) The timestamp, based on local job time, when the file was opened.
SIZE BIGINT The spooled file size in bytes. The size of the spooled file is
the data stream size plus the spooled file's attributes, plus the
"overhead" storage used to store the spooled file's data stream.
Contains the null value if the size is not available or STATUS is
DELETED.
TOTAL_PAGES INTEGER The total number of pages or number of records for the spooled
file.
Contains the null value if the total number of pages is not available
or STATUS is DELETED.
QUALIFIED_JOB_NAME VARCHAR(28) The qualified job name of the job that owns the spooled file.
JOB_NAME VARCHAR(10) The name of the job that owns the spooled file.
JOB_USER VARCHAR(10) The name of the user that owns the spooled file.
JOB_NUMBER VARCHAR(6) The number of the job that owns the spooled file.
FORM_TYPE VARCHAR(10) Spooled file form type. The type of form to load in the printer to
print this file.
Contains the null value when STATUS is DELETED.
OUTPUT_QUEUE VARCHAR(10) The name of the output queue in which the spooled file is located.
Contains the null value when STATUS is DELETED.
ASP_NUMBER INTEGER The auxiliary storage pool in which the spooled file resides.
Contains the null value when STATUS is DELETED.
SYSTEM VARCHAR(8) The name of the system where the job that created the spooled file
ran.
INTERNET_PRINT_PROTOCOL_JOB_ID INTEGER The IPP job identifier assigned by the system based on the output
queue to which the file was added or moved. This value ranges
from 1 to 2147483647 and is not guaranteed to be unique for a
given output queue.
Contains the null value when STATUS is DELETED.
Example
• List all the spooled files for the current job.
Storage Services
These views provide information about storage and storage devices.
ADD_DEVICE_LOCKING_POLICY ( policy-password
POLICY_PASSWORD =>
, resource-name )
RESOURCE_NAME =>
policy- A character string that contains the policy password. It must be at least 8 characters
password long and cannot exceed 32 characters.
resource-name A character string that contains the resource name of the NVMe device to be added to
the locking policy.
The following special value can be specified:
*ALL All NVMe devices that have a namespace configured are added to the locking
policy.
Example
• Add a new device to the locking policy.
ASP_INFO view
The ASP_INFO view returns information about auxiliary storage pools (ASPs).
The values returned for the columns in the view are similar to the values returned by the Work with
Configuration Status (WRKCFGSTS) CL command and the Open List of ASPs (QYASPOL) API.
Authorization: None required.
The following table describes the columns in the view. The system name is ASP_INFO. The schema is
QSYS2.
Table 244. ASP_INFO view
DEVICE_DESCRIPTION_NAME DEVD_NAME VARCHAR(10) The name of the device description that most
Nullable recently brought the independent ASP (IASP) to
varyon/active state.
Contains the null value if the ASP is not an IASP.
ASP_NUMBER ASP_NUM INTEGER A unique identifier for an ASP. Possible values are 1
through 255.
33-255 IASPs
RDB_NAME RDB_NAME VARCHAR(18) The name that is assigned to the database that this
Nullable ASP defines.
Contains the null value if ASP_TYPE is UDFS or
USER.
NUMBER_OF_DISK_UNITS DISK_UNITS INTEGER The total number of disk units in the ASP. If
mirroring is active for disk units within the ASP, the
mirrored pair of units is counted as one.
DISK_UNITS_PRESENT PRESENT VARCHAR(4) Indicates whether disk units in the ASP were found.
ENCRYPTED_ASP ENCRYPTED VARCHAR(3) Whether the data contained in the ASP is encrypted.
TOTAL_CAPACITY TOTCAP BIGINT The total number of used and unused megabytes in
Nullable the ASP. A special value of -2 is returned if the size
of this field is exceeded.
Contains the null value if the capacity cannot be
determined.
TOTAL_CAPACITY_AVAILABLE TOTCAPA BIGINT The total number of unused megabytes in the ASP.
Nullable A special value of -2 is returned if the value was too
big to return.
Contains the null value if the capacity cannot be
determined.
PROTECTED_CAPACITY PROTCAP BIGINT The total number of used and unused megabytes in
Nullable the ASP that are protected by mirroring or device
parity. A special value of -2 is returned if the value
was too big to return.
Contains the null value if the capacity cannot be
determined.
PROTECTED_CAPACITY_AVAILABLE PROTCAPA BIGINT The number of unused megabytes in the ASP that
Nullable are protected by mirroring or device parity. A special
value of -2 is returned if the value was too big to
return.
Contains the null value if the capacity cannot be
determined.
UNPROTECTED_CAPACITY UNPROTCAP BIGINT The total number of used and unused megabytes in
Nullable the ASP that are not protected by mirroring or device
parity. A special value of -2 is returned if the value
was too big to return.
Contains the null value if the capacity cannot be
determined.
UNPROTECTED_CAPACITY_ UNPROTCAPA BIGINT The number of unused megabytes in the ASP that
AVAILABLE Nullable are not protected by mirroring or device parity. A
special value of -2 is returned if the value was too
big to return.
Contains the null value if the capacity cannot be
determined.
STORAGE_THRESHOLD_PERCENTAGE THRESHOLD INTEGER When the storage in the ASP reaches this
percentage, a warning message is sent to the
QSYSOPR message queue. When this percentage
is reached for the system ASP (ASP 1), message
CPF0907 is sent. When this percentage is reached
for a user ASP, message CPI0953 is sent.
END_IMMEDIATE END_IMMED VARCHAR(3) This column only applies to the system ASP (ASP 1).
Nullable
NO If a request for space in the system ASP
cannot be satisfied because there is not
enough storage, the system will be allowed
to continue running.
COMPRESSION_RECOVERY_POLICY COMP_RECOV VARCHAR(18) The compression recovery policy for the ASP. If
the ASP has compressed drives as part of its
configuration, this value controls how overflow
situations are handled for this ASP. The following
policies allow the user to control what is done when
the ASP appears full.
COMPRESSED_DISK_UNITS COMPRESSED VARCHAR(4) Whether there are compressed disk units in the ASP.
MULTIPLE_CONNECTION_DISK_UNITS MULT_CONN VARCHAR(3) A disk unit may have multiple resource names.
Each resource name represents a unique connection
to the disk unit. All active connections are used
to communicate with the disk unit. This attribute
indicates whether the disk unit has more than one
connection.
BALANCE_STATUS BALANCE VARCHAR(8) The current status of the balance function for this
Nullable ASP.
BALANCE_TYPE BAL_TYPE VARCHAR(21) The type of balance activity that is currently running
Nullable or was done last.
BALANCE_DATA_MOVED BAL_MOVED BIGINT The number of megabytes that have been moved
Nullable by the balance function. A special value of -2 is
returned if the value was too big to return.
Contains the null value if BALANCE_STATUS is not
RUNNING.
BALANCE_TIMESTAMP BAL_TIME TIMESTAMP(0) The timestamp of the last status change for the
Nullable balance function.
Contains the null value when BALANCE_TYPE is
NONE or the null value.
TRACE_STATUS TRC_STATUS VARCHAR(10) The current status of the trace function. The trace
Nullable gathers statistics about the data on the disk units
within the ASP. This data is used by the balance
functions.
TRACE_DURATION TRC_DUR INTEGER The number of minutes that the trace function has
Nullable run collecting data for this ASP. The trace can be run
multiple times for an ASP.
Contains the null value when TRACE_STATUS is
NONE or the null value.
TRACE_TIMESTAMP TRC_TIME TIMESTAMP(0) The timestamp of the last status change for the
Nullable trace function.
Contains the null value when TRACE_STATUS is
NONE or the null value.
GEOGRAPHIC_MIRROR_ROLE GEO_ROLE VARCHAR(10) The current role of the geographically mirrored IASP.
Nullable
DETACHED System owns a detached mirror
copy.
GEOGRAPHIC_MIRROR_COPY_STATE GEO_CSTATE VARCHAR(14) The mirror state of the geographic mirror copy.
Nullable
ACTIVE Geographic mirroring is actively
replicating.
GEOGRAPHIC_MIRROR_DATA_STATE GEO_DSTATE VARCHAR(12) The condition of the data on the geographic mirror
Nullable copy.
GEOGRAPHIC_MIRROR_SUSPEND_TIMEOUT GEO_WAIT INTEGER The number of seconds the production node waits
for a response from the mirror copy node before
suspending geographic mirroring.
Contains the null value if geographic mirroring is not
configured.
RESOURCE_NAME RESOURCE VARCHAR(10) The resource name that identifies the ASP by which
Nullable a collection of disks is known.
Contains the null value for the system ASP, any user
ASPs, and for an IASP where the name cannot be
determined.
PRIMARY_ASP_RESOURCE_NAME PRIMARY VARCHAR(10) The resource name of the primary ASP for a
Nullable secondary ASP.
Contains the null value if ASP_TYPE is not
SECONDARY.
ACCESS_PATH_TARGET_ SMAPP VARCHAR(7) The time, in minutes, targeted for access path
RECOVERY_TIME protection for this ASP.
Nullable
1-1440 The number of minutes set for the
system access path recovery time.
ACCESS_PATH_ESTIMATED_ AP_RECOV INTEGER The amount of time, in minutes, that the system will
RECOVERY_TIME take to recover the access paths during the vary on
Nullable of this independent storage pool (IASP). This value
assumes that all access paths that are protected are
recovered during vary on of the IASP.
The estimated system access path recovery time is
influenced by the include access paths setting for
the system.
• If the include access paths setting is *ELIGIBLE,
this value is the estimated system access path
recovery time of all the eligible access paths that
are not chosen for protection.
• If the include access paths setting is *ALL,
this value is the estimated system access path
recovery time of all the eligible access paths that
are not chosen for protection plus all the access
paths that are not eligible for protection.
Contains the null value when system-managed
access path protection is off, if the user does not
have *JOBCTL authority, or if this is an IASP that is
varied off.
Example
• Show ASP information for the partition.
ASP_JOB_INFO view
The ASP_JOB_INFO view returns information about active jobs that are using an independent auxiliary
storage pool (IASP).
The information is similar to what is returned by the Work with ASP Jobs (WRKASPJOB) CL command.
Authorization: None required to see information for jobs where the caller's user profile is the same as the
job user identity of the job for which the information is being returned. Otherwise, the caller must have
*JOBCTL special authority, or be authorized to the QIBM_DB_SQLADM or QIBM_DB_SYSMON function
usage identifiers.
The following table describes the columns in the view. The system name is ASPJ_INFO. The schema is
QSYS2.
Table 245. ASP_JOB_INFO view
IASP_NAME IASP_NAME VARCHAR(10) The name of the independent ASP (IASP) device description.
IASP_NUMBER IASPNUM INTEGER The number associated with the ASP device.
JOB_STATUS JOB_STATUS VARCHAR(4) The status of the initial thread of the job.
Nullable For the list of values see Work Management API Attribute
Descriptions in Application Programming Interfaces and search
on "Active job status".
BCH Batch
INT Interactive
PJ Prestart job
SYS System
AUTHORIZATION_NAME USER_NAME VARCHAR(10) The user profile under which the initial thread is running at this
Nullable time.
SQL_STATEMENT_TEXT SQL_STMT VARCHAR(10000) Statement text of the last SQL statement to run or the SQL
Nullable statement that is currently running. The statement text will be
truncated if it is longer than the column.
Contains the null value if no SQL statement has been run.
SQL_STATEMENT_START_ SQL_TIME TIMESTAMP The timestamp of the execution start for an active SQL
TIMESTAMP Nullable statement.
Contains the null value if there is no active SQL statement.
RDB_NAME RDB_NAME VARCHAR(18) The name that is assigned to the database that this ASP defines.
Nullable Contains the null value if ASP_TYPE is not PRIMARY or
SECONDARY.
Example
List all the jobs that are active for IASP33.
ASP_VARY_INFO view
The ASP_VARY_INFO view returns one row for each step associated with a vary on or vary off operation for
all independent ASP devices.
The values returned for the columns in the view are similar to the values returned by the Display ASP
Status (DSPASPSTS) CL command.
Authorization: The caller must have *USE authority to the independent ASP device description.
The following table describes the columns in the view. The system name is VARY_INFO. The schema is
QSYS2.
Table 246. ASP_VARY_INFO view
VARY OFF
VARY ON
START_TIMESTAMP START TIMESTAMP The timestamp for the start of this operation step.
END_TIMESTAMP END TIMESTAMP The timestamp for the end of this operation step.
Nullable Contains the null value if the operation step has
not completed or may never complete.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name that initiated this vary
Nullable operation.
Contains the null value if the job name is not
available.
IASP_NUMBER IASPNUM INTEGER The number associated with the ASP device.
Example
• Return the steps from available vary on operations, listed from most expensive to least expensive.
• Create a table to retain vary on historical data. Populate it with the current available values.
• Update the table that contains vary on historical data with any new rows.
CHANGE_DEVICE_LOCKING_POLICY (
policy-password ,
POLICY_PASSWORD =>
new-policy-password ,
NEW_POLICY_PASSWORD =>
)
fixup
FIXUP =>
policy- A character string that contains the current device policy password used to unlock the
password device.
If policy-password is specified, new-policy-password must also be provided.
new-policy- A character string that contains the new policy password used to unlock the device and for
password changing the locking policy configuration.
It must be at least 8 characters long and cannot exceed 32 characters.
If new-policy-password is specified, policy-password must also be provided.
fixup A character string that indicates whether the NVMe device is to be resynchronized with the
password stored in Platform KeyStore (PKS).
The NVMe device must be under the locking policy.
This option should only be used when the PASSWORD_FIXUP_REQUIRED column in the
QSYS2.LOCKING_POLICY_INFO view has a value of YES.
YES The NVMe device is to be resynchronized with the password stored in PKS.
If fixup is YES, new-policy-password and policy-password must not be specified.
Example
• Change a locking policy password for the current device.
CHANGE_DISK_PATHS procedure
The CHANGE_DISK_PATHS procedure enables or disables all paths matching the parameters provided.
The last path to a disk will not be disabled unless explicitly requested. This procedure is only supported
for some external SCSI devices.
Any combination of resource-name, host-wwpn, remote-wwpn, and adapter-name can be specified. The
specified operation will be applied to all the paths that match the provided parameters. A disable
operation must leave at least one remaining active path to all resources unless the force parameter with a
value of YES is specified. If no paths match the provided parameters, no action is taken.
CHANGE_DISK_PATHS ( operation
OPERATION =>
, resource-name
RESOURCE_NAME =>
, host-wwpn
HOST_WWPN =>
, remote-wwpn
REMOTE_WWPN =>
, force
FORCE =>
)
, adapter-name
ADAPTER_NAME =>
resource- A character string that contains the resource name of the path to be changed. If resource-
name name is omitted or the null value, the operation will be applied to all the paths that match
the world wide port name or adapter parameters that are provided.
host-wwpn A 16 character hexadecimal string representing the world wide port name for the host side
of the paths to be enabled or disabled. If resource-name, remote-wwpn, or adapter-name
is specified, this parameter can be omitted or have the null value.
If this parameter is not specified, the default is the null value, meaning that host-wwpn is
not part of the request.
remote- A 16 character hexadecimal string representing the world wide port name for the remote
wwpn side of the paths to be enabled or disabled. If resource-name, host-wwpn, or adapter-
name is specified, this parameter can be omitted or have the null value.
If this parameter is not specified, the default is the null value, meaning that remote-wwpn
is not part of the request.
force A character string that indicates whether the last path to a disk can be disabled by this
procedure.
NO The last path to a disk will never be disabled. This is the default.
YES The last path to a disk can be disabled, overriding normal safely checks.
v
• Enable a path.
• Disable a path.
• Disable a path, forcing the disk to be disabled if it is the last path to the disk.
CREATE_LOCKING_POLICY procedure
The CREATE_LOCKING_POLICY procedure creates a password policy.
Prior to creating a password policy, the Platform KeyStore must be enabled through the HMC’s Partition
Properties -> Advanced Settings -> Platform KeyStore Size value must be set to a non-zero value.
Before creating the NVMe password protection policy on the partition, it is recommended that all of the
system and user data be saved using GO SAVE: Option 21 (saving the entire system).
All NVMe devices supported by IBM i are Self-Encrypting Drives (SED). This means the data is encrypted
at rest. However, the key used to encrypt and decrypt the data is not protected. By creating a password
policy and adding NVMe devices to it, the devices can protect the confidentiality of stored user data
against unauthorized access once the device leaves the owner’s control. This feature uses the Trusted
Computer Group (TCG) Opal Security Subsystem Class (SSC) specification for storage. Each NVMe device
that supports the Opal SSC is registered in a list of devices on which the administrator can establish a
locking policy. Once the device is added to the locking policy the NVMe device will lock itself when Main
Power loss or PCIe cold resets occur.
The NVMe device will be locked when:
• DLPAR Remove operation is performed on the device
• Concurrent Maintenance Power Off is performed on the device
• The partition is IPLed
• When the NVMe device is reset
Once the device is locked, reads and writes issued to the drive will fail. While the NVMe device remains
in the partition, restoring power to the device will cause it to automatically unlock itself, using the policy
password stored in the Platform KeyStore.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
CREATE_LOCKING_POLICY ( policy-password )
POLICY_PASSWORD =>
policy- A character string that contains the initial policy password that will be used to unlock
password the device(s) and for changing the locking policy configuration.
It must be at least 8 characters long and cannot exceed 32 characters.
Example
• Create a locking policy and add all configured NVMe devices to the policy.
DELETE_LOCKING_POLICY procedure
The DELETE_LOCKING_POLICY procedure deletes the password policy for all NVMe devices.
The password policy will be removed from all NVMe devices that are currently part of the policy. It will
also remove the policy itself.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
Example
• Delete the password policy for all NVMe devices.
FACTORY_RESET_DEVICE procedure
The FACTORY_RESET_DEVICE procedure resets an NVMe device to its factory settings. The device will
lose all data when this procedure is called. The PSID value printed on the physical NVMe device label is
needed to perform the reset.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
FACTORY_RESET_DEVICE ( psid-password ,
PSID_PASSWORD =>
resource-name )
RESOURCE_NAME =>
psid-password A character string that contains the PSID value printed on the physical device label.
resource-name A character string that contains the resource name of the device to be reset.
Example
• Reset an NVMe device back to its initial settings.
LOCKING_POLICY_INFO view
The LOCKING_POLICY_INFO view returns a list of the NVMe devices under the partition with their locking
capabilities and state.
One row is returned for each device.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
The following table describes the columns in the view. The system name is LOCK_POL. The schema is
QSYS2.
Table 247. LOCKING_POLICY_INFO view
YES The NVMe device supports TCG Opal and has the correct
firmware allowing it to be locked.
ELIGIBLE_POLICY ELIGIBLE VARCHAR(3) Whether the device is eligible to be added to the NVMe locking
policy.
UNDER_POLICY IN_POLICY VARCHAR(3) Whether the device is currently under the NVMe locking policy.
LOCK_STATE LOCK_STATE VARCHAR(3) Whether device is locked. When a device is locked, it is read/
write protected.
UNLOCK_ATTEMPTS_EXHAUSTED ATTEMPTS VARCHAR(3) Whether the user has exhausted their attempts to unlock the
NVMe device.
Example
• List information about all NVMe devices, including whether they are eligible to be included in a locking
policy and whether a locking policy is in effect.
NVME_INFO view
The NVME_INFO view contains information about Non-Volatile Memory Express (NVMe) devices.
Authorization: None required.
The following table describes the columns in the view. The system name is NVME_INFO. The schema is
QSYS2.
Table 248. NVME_INFO view
DEVICE_MODEL DEV_MODEL VARCHAR(4) The model of the NVMe device assigned by IBM.
SERIAL_NUMBER SERIAL VARCHAR(15) The serial number of the NVMe device assigned by IBM.
HARDWARE_MODEL_NUMBER HDW_MODEL VARCHAR(40) The model number assigned by the device manufacturer.
HARDWARE_SERIAL_NUMBER HDW_SERIAL VARCHAR(20) The serial number assigned by the device manufacturer.
FIRMWARE_LEVEL FIRMWARE VARCHAR(8) The level of code running in the NVMe device.
BUS_NUMBER BUS_NUMBER INTEGER The bus number that the NVMe device is attached to.
PAGES_AVAILABLE PG_AVAIL BIGINT The quantity of pages on the NVMe device which remain
available to be allocated to namespaces.
PAGES_USED PG_USED BIGINT The quantity of pages on the NVMe device which have
been allocated to namespaces.
PAGES_MAXIMUM PG_MAX BIGINT The total quantity of pages which exist on the NVMe
device.
NAMESPACES_CONFIGURED NS_CONFIG INTEGER The quantity of namespaces on the NVMe Device which
represent disk units that are configured into an Auxiliary
Storage Pool (ASP).
OVERWRITE OVERWRITE VARCHAR(3) NVMe device supports the Overwrite sanitize operation.
SECURE_ERASE SECURE_E VARCHAR(3) NVMe device supports the User Data Secure Erase sanitize
operation.
BLOCK_ERASE BLOCK_E VARCHAR(3) NVMe device supports the Block Erase sanitize operation.
CRYPTO_ERASE CRYPTO_E VARCHAR(3) NVMe device supports the Crypto Erase sanitize operation.
SPARE_CAPACITY CAP_AVAIL INTEGER The percentage (0 to 100) of the remaining spare capacity
available for this NVMe device.
SPARE_CAPACITY_THRESHOLD CAP_THRESH INTEGER The threshold percentage (0 to 100) for the spare capacity
for this NVMe device.
MEMORY_BACKUP_DEVICE_FAILED BACKUPFAIL VARCHAR(3) Whether the volatile memory backup device has failed.
PMR_READ_ONLY PMR_RO VARCHAR(3) Whether the persistent memory region has become read-
only.
READ_ONLY DEV_RO VARCHAR(3) Whether the NVMe device is in a mode that only allows
read operations.
DEGRADED DEGRADED VARCHAR(3) Whether the NVMe reliability has been degraded.
TEMPERATURE_THRESHOLD HOT VARCHAR(3) Whether the temperature of the NVMe device has
exceeded the threshold.
DATA_READ DATA_READ BIGINT The number of 512-byte data units that have been read
from the NVMe device. This value is reported in thousands
(a value of 1 corresponds to 1000 units of 512 bytes read).
This value is never reset. It is for the life of the device.
DATA_WRITTEN DATA_WRITE BIGINT The number of 512-byte data units that have been written
to the NVMe device. This value is reported in thousands (a
value of 1 corresponds to 1000 units of 512 byes written).
This value is never reset. It is for the life of the device.
HOST_READ_COMMANDS READ_CMDS BIGINT The number of read commands sent to the NVMe device
by the host system.
This value is never reset. It is for the life of the device.
HOST_WRITE_COMMANDS WRITE_CMDS BIGINT The number of write commands sent to the NVMe device
by the host system.
This value is never reset. It is for the life of the device.
CONTROLLER_BUSY_TIME BUSY_TIME BIGINT The time, in minutes, that the controller was busy
servicing I/O commands.
This value is never reset. It is for the life of the device.
POWER_CYCLES POWER_CYC BIGINT The number of times the NVMe device has been powered
on and off.
This value is never reset. It is for the life of the device.
POWER_ON_HOURS POWER_HOUR BIGINT The number of hours the NVMe device has been powered
on.
This value is never reset. It is for the life of the device.
UNSAFE_SHUTDOWNS POWER_LOSS BIGINT The number of times a power loss happened without a
shutdown notification being sent.
This value is never reset. It is for the life of the device.
MEDIA_ERRORS MEDIAERROR BIGINT The number of occurrences where the controller detected
an unrecovered data integrity error.
This value is never reset. It is for the life of the device.
ERROR_LOGS ERROR_LOGS BIGINT The number of error information log entries over the life of
the NVMe device.
This value is never reset. It is for the life of the device.
TEMPERATURE_WARNING_TIME TEMP_WARN INTEGER The amount of time, in minutes, that the NVMe
controller is operational and the composite temperature
is greater than or equal to the warning composite
temperature threshold and less than the critical composite
temperature.
This value is never reset. It is for the life of the device.
TEMPERATURE_CRITICAL_TIME TEMP_CRIT INTEGER The amount of time, in minutes, that the NVMe controller
is operational and the composite temperature is greater
than the critical composite temperature threshold.
This value is never reset. It is for the life of the device.
SOFT_THERMAL_TRANSITIONS SOFT_TRANS INTEGER The number of times the controller transitioned to lower
power active power states or performed manufacturer
specific thermal management actions while minimizing
the impact on performance in an attempt to reduce the
composite temperature.
HARD_THERMAL_TRANSITIONS HARD_TRANS INTEGER The number of times the controller transitioned to lower
power active power states or performed manufacturer
specific thermal management actions regardless of the
impact on performance in an attempt to reduce the
composite temperature.
SOFT_THERMAL_TIME SOFT_TIME INTEGER The number of seconds that the controller has transitioned
to lower power active power states or performed
manufacturer specific thermal management actions while
minimizing the impact on performance in order to attempt
to reduce the composite temperature.
HARD_THERMAL_TIME HARD_TIME INTEGER The number of seconds that the controller has transitioned
to lower power active power states or performed
manufacturer specific thermal management actions
regardless of the impact on performance in order to
attempt to reduce the composite temperature.
Examples
• Return information for NVMe devices.
REMOVE_DEVICE_LOCKING_POLICY procedure
The REMOVE_DEVICE_LOCKING_POLICY procedure removes an NVMe device from the password policy.
If the specified device is under the locking policy, the password will be removed from the device and the
device will no longer be under the locking policy. If the device isn’t under the locking policy, the password
will be used to remove the password from the device.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
REMOVE_DEVICE_LOCKING_POLICY (
POLICY_PASSWORD =>
policy-password , resource-name )
RESOURCE_NAME =>
Example
• Remove a device from the locking policy.
SYSDISKSTAT ( )
reset-statistics
RESET_STATISTICS =>
reset- A character or graphic string expression that contains a value of YES or NO.
statistics
If this parameter has a value of YES, statistics are reset such that the time of this query
execution is used as the new baseline. The columns that contain this statistical data have
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 249. SYSDISKSTAT table function
ASP_NUMBER SMALLINT Specifies the independent auxiliary storage pool (IASP) number.
DEGRADED The disk unit is part of a disk unit subsystem that has
RAID-5 device parity protection. A decrease in performance
has occurred because a component that is not critical has
failed.
FAILED The disk unit is part of a disk unit subsystem that has device
parity protection. This unit has failed. If another unit in the
disk unit subsystem fails, data could be lost.
NOT READY The disk unit is not ready to perform read or write
operations.
PARITY REBUILD The disk unit is part of a disk unit subsystem that has device
parity protection. The data on this unit is being rebuilt from
other units in the disk unit subsystem. If two more disk units
in the disk unit subsystem fail, data could be lost.
POWER LOSS The disk unit cannot communicate with its I/O adapter.
READ WRITE The disk unit is unable to perform read or write operations.
PROTECTED
UNPROTECTED The disk unit is part of a disk unit subsystem that has device
parity protection. This unit is operational. However, another
unit in the disk unit subsystem has failed. If another unit in
the disk unit subsystem fails, data could be lost.
IS_ZERO VARCHAR(3) Indicates whether all the pages on the disk unit are zero.
HOST_WWPN CHAR(16) A hexadecimal string representing the resource’s host world wide port name.
Contains the null value if no host world wide port name is available for this device.
REMOTE_WWPN CHAR(16) A hexadecimal string representing the resource’s remote world wide port name.
Contains the null value if no remote world wide port name is available for this device.
MULTIPLE_PATH_UNIT VARCHAR(3) A disk unit may have multiple resource names. Each resource name represents a
unique connection to the disk unit. All active connections are used to communicate
with the disk unit. This attribute indicates whether the disk unit has more than one
connection.
0 Not NVMe
1 NVMe
UNIT_STORAGE_CAPACITY BIGINT Unit storage capacity has the same value as the unit media capacity for configured
disk units. This value is 0 for non-configured units.
UNIT_SPACE_AVAILABLE BIGINT Space (in bytes) available on the unit for use.
UNIT_SPACE_AVAILABLE_GB BIGINT Space, in billions of bytes, available on the unit for use.
PERCENT_USED DECIMAL(7,3) The percentage that the disk unit has been consumed.
STORAGE_FOR_SYSTEM BIGINT The amount of auxiliary storage on the disk unit, in millions of bytes, reserved for use
by the system.
STORAGE_ALLOCATION_ALLOWED VARCHAR(3) An indicator of whether new storage allocations are allowed on the disk unit.
PROTECTION_TYPE VARCHAR(8) The type of protection that has been assigned to this disk unit.
MIRRORED The ASP is under system mirrored protection provided by the system
software.
Contains the null value if no storage protection has been set up for this disk unit.
PROTECTION_STATUS VARCHAR(21) The disk protection status for the disk unit, when the unit is under device parity
protection or the ASP is under mirrored protection.
HARDWARE FAILURE There is a hardware failure within the disk subsystem that
does not affect the function or performance of the disk
unit.
UNPROTECTED Some other disk unit in the disk subsystem has failed.
RAID_TYPE VARCHAR(6) The type of RAID protection that has been assigned to this disk unit.
RAID5 This disk unit has been set up with RAID 5 protection.
RAID6 This disk unit has been set up with RAID 6 protection.
RAID10 This disk unit has been set up with RAID 10 protection.
MIRRORED_SUBUNIT CHAR(1) Whether the disk unit is for subunit A or B of a mirrored pair.
Contains the null value if the unit is not a mirrored pair or if the information is not
available.
1 Indicates that this mirrored unit of a mirrored pair is active (online with current
data).
Nullable Contains the null value if this disk is not a mainstream SSD or if the information
is not available. See Mainstream solid-state drives for a description of mainstream
solid-state drives.
Nullable Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
SSD_POWER_ON_DAYS BIGINT The number of days that the SSD device has been active in a system.
Nullable Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
SSD_LIFE_REMAINING INTEGER The percentage of the lifetime remaining for the SSD device. This estimates the
percentage of usable function remaining for the drive before it should be replaced.
Nullable Calculations for this percentage include more than just the number of bytes written
and supported.
Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
SSD_BYTES_WRITTEN DECIMAL(20,0) The lifetime number of bytes, in gigabytes, that have been physically written to the
NAND memory in this particular SSD disk unit. This is strongly related to bytes written
Nullable by the applications using the drive, but will not match.
Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
SSD_SUPPORTED_BYTES_WRITTEN DECIMAL(20,0) The lifetime number of bytes, in gigabytes, that the SSD is expected to be able to
physically write at a minimum. Additional writes beyond this number may start to fail
Nullable due to the limited write endurance of a Read Intensive drive.
Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
SSD_PFA_WARNING VARCHAR(3) Whether the Predictive Failure Analysis warning has been logged.
Nullable NO The Predictive Failure Analysis warning has not been logged.
Contains the null value if this disk is not a mainstream SSD or if the information is not
available.
TOTAL_SAMPLE_COUNT BIGINT The number of times the disk queue was checked to determine whether or not the
queue is empty.
TOTAL_NOT_BUSY_COUNT BIGINT The number of times the disk queue was empty during the same time period
that the sample count was taken. The busy count can be calculated as
TOTAL_SAMPLE_COUNT - TOTAL_NOT_BUSY_COUNT.
TOTAL_READ_REQUESTS BIGINT The number of input data transfer requests processed for the disk unit since the last
IPL. This value is not directly related to the number of blocks transferred for the disk
unit because the number of blocks to be transferred for a given transfer request can
vary greatly. This value will wrap back to 1 when 2,147,483,647 is reached.
TOTAL_WRITE_REQUESTS BIGINT The number of output data transfer requests processed for the disk unit since the last
IPL. This value is not directly related to the number of blocks transferred for the disk
unit because the number of blocks to be transferred for a given transfer request can
vary greatly. This value will wrap back to 1 when 2,147,483,647 is reached.
TOTAL_BLOCKS_READ BIGINT The number of 512-byte blocks transferred from the disk unit since the last IPL. This
value will wrap back to 1 when 2,147,483,647 is reached.
TOTAL_BLOCKS_WRITTEN BIGINT The number of 512-byte blocks transferred to the disk unit since the last IPL. This
value will wrap back to 1 when 2,147,483,647 is reached.
TOTAL_PERMANENT_BLOCKS_WRITTE BIGINT The number of 512-byte blocks of permanent storage transferred to the disk unit
N since the last IPL. This value will wrap back to 1 when 2,147,483,647 is reached.
TOTAL_PERMANENT_WRITE_REQUEST BIGINT The number of output permanent data transfer requests processed for the disk
S unit since the last IPL. This value is not directly related to the permanent blocks
transferred from main storage for the disk unit because the number of blocks
transferred for a given transfer request can vary greatly. This value will wrap back
to 1 when 2,147,483,647 is reached.
ELAPSED_TIME INTEGER The time that has elapsed, in seconds, between the measurement start time and the
current system time.
ELAPSED_IO_REQUESTS DECIMAL(6,1) The average number of I/O requests for read and write operations that occurred per
second during the elapsed time.
ELAPSED_REQUEST_SIZE DECIMAL(6,1) The average size of an I/O request in KB during the elapsed time.
ELAPSED_READ_REQUESTS DECIMAL(6,1) The average number of requests per second to transfer data from the disk unit during
the elapsed time.
ELAPSED_WRITE_REQUESTS DECIMAL(6,1) The average number of requests per second to transfer data to the disk unit during
the elapsed time.
ELAPSED_DATA_READ DECIMAL(6,1) The average amount of data, in KB, transferred from the disk unit, per request, during
the elapsed time.
ELAPSED_DATA_WRITTEN DECIMAL(6,1) The average amount of data, in KB, transferred to the disk unit, per request, during
the elapsed time.
ELAPSED_PERCENT_BUSY DECIMAL(4,1) The estimated percentage of time the disk unit is being used during the elapsed time.
Example
• Return information about all disks, resetting the statistical information shown for the current job.
SYSDISKSTAT view
The SYSDISKSTAT view contains information about spinning disk and solid-state drives (SSD).
The information returned is similar to the detail seen from the Work with Disk Status (WRKDSKSTS)
command and from the Open List of ASPs (QYASPOL) API.
The view contains one or more rows for every disk unit on the system, including non-configured
(unallocated) disk units. For non-configured units, the UNIT_NUMBER is 0. For a disk which has multiple
paths to the disk unit, there will be a row for each unique path to the disk unit. For such disks, the
MULTIPLE_PATH_UNIT column will be YES and each RESOURCE_NAME column will identify a different
path to the disk unit.
Authorization: None required.
The following table describes the columns in the view. The system name is SYSDISKS. The schema is
QSYS2.
Table 250. SYSDISKSTAT view
RESOURCE_NAME RESOURCE VARCHAR(10) The unique system-assigned name of the disk unit.
HARDWARE_STATUS HDW_STATUS VARCHAR(21) The hardware status for the disk unit.
IS_ZERO IS_ZERO VARCHAR(3) Indicates whether all the pages on the disk unit are zero.
MULTIPLE_PATH_UNIT MULTI_PATH VARCHAR(3) A disk unit may have multiple resource names. Each
resource name represents a unique connection to the disk
unit. All active connections are used to communicate with
the disk unit. This attribute indicates whether the disk unit
has more than one connection.
0 Not NVMe
1 NVMe
UNIT_STORAGE_CAPACITY UNITSCAP BIGINT Unit storage capacity has the same value as the unit media
capacity for configured disk units. This value is 0 for non-
configured units.
UNIT_SPACE_AVAILABLE UNITSPACE BIGINT Space (in bytes) available on the unit for use.
UNIT_SPACE_AVAILABLE_GB UNITSPCGB BIGINT Space, in billions of bytes, available on the unit for use.
PERCENT_USED PERCENTUSE DECIMAL(7,3) The percentage that the disk unit has been consumed.
Nullable
STORAGE_FOR_SYSTEM STORAGESYS BIGINT The amount of auxiliary storage on the disk unit, in millions
of bytes, reserved for use by the system.
PROTECTION_TYPE PROTECTION VARCHAR(8) The type of protection that has been assigned to this disk
unit.
Nullable
MIRRORED The ASP is under system mirrored
protection provided by the system
software.
PROTECTION_STATUS STATUS VARCHAR(21) The disk protection status for the disk unit, when the
unit is under device parity protection or the ASP is under
Nullable mirrored protection.
RAID_TYPE RAID_TYPE VARCHAR(6) The type of RAID protection that has been assigned to this
disk unit.
Nullable
RAID5 This disk unit has been set up with RAID 5
protection.
MIRRORED_SUBUNIT SUBUNIT CHAR(1) Whether the disk unit is for subunit A or B of a mirrored
pair.
Nullable
A This entry is for subunit A.
AVAILABILITY_PARITY_SET_UNIT PARITY VARCHAR(3) Whether the disk unit is in a parity set which is optimized
for availability.
FIRMWARE_LEVEL FIRMWARE VARCHAR(8) The level of code running in the SSD device.
Nullable Contains the null value if this disk is not a mainstream SSD
or if the information is not available. See Mainstream solid-
state drives for a description of mainstream solid-state
drives.
SSD_PART_NUMBER SSD_PART VARCHAR(12) The part number as reported by the SSD device.
Nullable Contains the null value if this disk is not a mainstream SSD
or if the information is not available.
SSD_POWER_ON_DAYS SSD_DAYS BIGINT The number of days that the SSD device has been active in
a system.
Nullable
Contains the null value if this disk is not a mainstream SSD
or if the information is not available.
SSD_LIFE_REMAINING SSD_LIFE INTEGER The percentage of the lifetime remaining for the SSD
device. This estimates the percentage of usable function
Nullable remaining for the drive before it should be replaced.
Calculations for this percentage include more than just the
number of bytes written and supported.
Contains the null value if this disk is not a mainstream SSD
or if the information is not available.
SSD_BYTES_WRITTEN SSD_WRITE DECIMAL(20,0) The lifetime number of bytes, in gigabytes, that have been
physically written to the NAND memory in this particular
Nullable SSD disk unit. This is strongly related to bytes written by
the applications using the drive, but will not match.
Contains the null value if this disk is not a mainstream SSD
or if the information is not available.
SSD_SUPPORTED_BYTES_WRITTEN SSD_MAX_W DECIMAL(20,0) The lifetime number of bytes, in gigabytes, that the SSD
is expected to be able to physically write at a minimum.
Nullable Additional writes beyond this number may start to fail due
to the limited write endurance of a Read Intensive drive.
Contains the null value if this disk is not a mainstream SSD
or if the information is not available.
SSD_PFA_WARNING SSD_PFA VARCHAR(3) Whether the Predictive Failure Analysis warning has been
logged.
Nullable
NO The Predictive Failure Analysis warning has not
been logged.
TOTAL_SAMPLE_COUNT SAMPLED BIGINT The number of times the disk queue was checked to
determine whether or not the queue is empty.
TOTAL_NOT_BUSY_COUNT NOT_BUSY BIGINT The number of times the disk queue was empty during the
same time period that the sample count was taken. The
busy count can be calculated as TOTAL_SAMPLE_COUNT -
TOTAL_NOT_BUSY_COUNT.
TOTAL_READ_REQUESTS REQ_IN BIGINT The number of input data transfer requests processed for
the disk unit since the last IPL. This value is not directly
related to the number of blocks transferred for the disk
unit because the number of blocks to be transferred for
a given transfer request can vary greatly. This value will
wrap back to 1 when 2,147,483,647 is reached.
TOTAL_WRITE_REQUESTS REQ_OUT BIGINT The number of output data transfer requests processed for
the disk unit since the last IPL. This value is not directly
related to the number of blocks transferred for the disk
unit because the number of blocks to be transferred for
a given transfer request can vary greatly. This value will
wrap back to 1 when 2,147,483,647 is reached.
TOTAL_BLOCKS_READ BLOCK_IN BIGINT The number of 512-byte blocks transferred from the disk
unit since the last IPL. This value will wrap back to 1 when
2,147,483,647 is reached.
TOTAL_BLOCKS_WRITTEN BLOCK_OUT BIGINT The number of 512-byte blocks transferred to the disk unit
since the last IPL. This value will wrap back to 1 when
2,147,483,647 is reached.
TOTAL_PERMANENT_WRITE_REQUESTS REQ_PERM BIGINT The number of output permanent data transfer requests
processed for the disk unit since the last IPL. This
value is not directly related to the permanent blocks
transferred from main storage for the disk unit because
the number of blocks transferred for a given transfer
request can vary greatly. This value will wrap back to 1
when 2,147,483,647 is reached.
ELAPSED_TIME ELAP_TIME INTEGER The time that has elapsed, in seconds, between the
measurement start time and the current system time.
ELAPSED_IO_REQUESTS ELAP_IO DECIMAL(6,1) The average number of I/O requests for read and write
operations that occurred per second during the elapsed
Nullable time.
ELAPSED_REQUEST_SIZE ELAP_SIZE DECIMAL(6,1) The average size of an I/O request in KB during the
elapsed time.
Nullable
ELAPSED_READ_REQUESTS ELAP_REQ_R DECIMAL(6,1) The average number of requests per second to transfer
data from the disk unit during the elapsed time.
Nullable
ELAPSED_WRITE_REQUESTS ELAP_REQ_W DECIMAL(6,1) The average number of requests per second to transfer
data to the disk unit during the elapsed time.
Nullable
ELAPSED_DATA_READ ELAP_DTA_R DECIMAL(6,1) The average amount of data, in KB, transferred from the
disk unit, per request, during the elapsed time.
Nullable
ELAPSED_DATA_WRITTEN ELAP_DTA_W DECIMAL(6,1) The average amount of data, in KB, transferred to the disk
unit, per request, during the elapsed time.
Nullable
ELAPSED_PERCENT_BUSY ELAP_BUSY DECIMAL(4,1) The estimated percentage of time the disk unit is being
used during the elapsed time.
Nullable
Notes
The values in the ELAPSED_ columns are based on the TOTAL_ columns. When an ELAPSED calculation
notices that the ending value is less than the value at the start of the time interval, it adds 2,147,483,647
to the ending value for an accurate result. When this happens, a warning SQLSTATE '01687' is issued.
It is recommended that the statistics get reset using the QSYS2.SYSDISKSTAT table function before the
counters can wrap more than once. The frequency needed for this action depends on the size and activity
of the disk units.
The ELAPSED_ column information is derived from the values reported in the TOTAL_ columns as shown
in the following table. These formulas can be used to calculate identical statistics if you want to save
historical disk statistics in a permanent table.
For clarity, the values prefixed by delta_ indicate the difference between two rows in the corresponding
TOTAL_ columns. For example, delta_READ_REQUESTS means TOTAL_READ_REQUESTS(time2) -
TOTAL_READ_REQUESTS(time1). The delta_time value means the time in seconds between time1 and
time2.
Examples
• Return information about all disks.
SYSTMPSTG view
The SYSTMPSTG view contains one row for every temporary storage bucket that is tracking some amount
of temporary storage across the system.
Temporary storage is application working storage that does not persist across a restart of the operating
system. Accounting for all the temporary storage being used on the system is implemented using the
concept of temporary storage buckets.
There are two types of temporary storage buckets:
• global buckets that are used to track temporary storage that is scoped to all jobs on the system.
• job buckets that are used to track temporary storage that is scoped to a single job.
Each bucket has a bucket number. Global buckets managed by the licensed internal code have bucket
numbers from 1 to 4095. Global buckets managed by IBM i Work Management have bucket numbers from
4096 to 65535. Job buckets have numbers greater than 65535.
A job temporary storage bucket is assigned when the job starts and does not change for the life of the
job. A job temporary storage bucket will normally be empty after the associated job ends and all working
storage for the job is deleted or freed. If the job temporary storage bucket is empty after the job ends,
the bucket becomes available to be associated with a new job. If the job associated with the job buckets
ends and some temporary objects tracked to that job are not deleted, the job bucket will show a status
of *ENDED as well as the date and time that the job ended. These job buckets identify jobs that are not
deleting all of their temporary storage when the job ends.
Statistics for each job bucket indicate the current amount of storage (in bytes) used for temporary storage
tracked by the bucket, the storage limit (in bytes) for storage used for temporary storage tracked by the
bucket, and the peak amount of storage (in bytes) used for temporary storage tracked by the bucket. A job
bucket does not include any temporary storage used for SQL query execution. For job buckets, the storage
limit will reflect the MAXTMPSTG value of the class (*CLS) object specified when the job was submitted; a
null value is returned if the job has a MAXTMPSTG value of *NOMAX.
BUCKET_NUMBER BKTNBR INTEGER Number that uniquely identifies the temporary storage bucket.
GLOBAL_BUCKET_NAME GLBBKTNAME VARCHAR(30) For global buckets, the name of the bucket.
Nullable For job buckets, contains the null value.
JOB_USER_NAME JOBUSRNAME VARCHAR(10) For job buckets, the user profile under which the job is run.
Nullable For global buckets, contains the null value.
JOB_NUMBER JOBNBR CHAR(6) For job buckets, the job number assigned by the system.
Nullable For global buckets, contains the null value.
BUCKET_CURRENT_SIZE BKTCURSIZ DECIMAL(23,0) The current number of bytes of storage for this temporary
storage bucket.
BUCKET_LIMIT_SIZE BKTLMTSIZ DECIMAL(23,0) The current limit, in bytes, for the amount of storage for this
Nullable temporary storage bucket. If the temporary storage bucket has
no limit, contains the null value.
BUCKET_PEAK_SIZE BKTPEAKSIZ DECIMAL(23,0) The largest number of bytes of storage for this temporary storage
bucket. For global buckets, this is the peak amount of storage
since the last restart of the operating system. For job buckets,
this is the peak amount of storage since the job was started.
JOB_STATUS JOBSTS VARCHAR(7) For job buckets, indicates whether the bucket is associated with
Nullable an active job or a job that ended without deleting all temporary
objects associated with the job.
*ENDED The job associated with this job bucket has ended.
JOB_ENDED_TIME JOBENDTIM TIMESTAMP For job buckets associated with jobs that have ended, indicates
Nullable the timestamp of when the associated job ended.
Contains the null value for global buckets and job buckets
associated with active jobs.
UNLOCK_DEVICE procedure
The UNLOCK_DEVICE procedure attempts to unlock an NVMe device.
Authorization: The caller must have *IOSYSCFG and *SERVICE special authorities.
UNLOCK_DEVICE ( policy-password ,
POLICY_PASSWORD =>
resource-name )
RESOURCE_NAME =>
Example
• Unlock an NVMe device.
USER_STORAGE view
The USER_STORAGE view contains details about storage by user profile.
The user storage consumption detail is determined by using Retrieve User Information (QSYRUSRI) API.
You must have *OBJOPR and *READ authority to a *USRPRF or it will not be returned. To see information
for independent ASPs (iASPs), the iASP must be varied on.
User storage is broken down by SYSBAS and iASPs.
Authorization: The caller must have *OBJOPR and *READ authorities to the *USRPRF.
The following table describes the columns in the view. The system name is USER_STG. The schema is
QSYS2.
Table 253. USER_STORAGE view
Nullable
Nullable
MAXIMUM_STORAGE_ALLOWED MAXSTG BIGINT The maximum amount of auxiliary storage (in kilobytes) that
can be assigned to store permanent objects owned by the user.
Nullable Contains null if the user does not have a maximum amount of
allowed storage.
STORAGE_USED STGUSED BIGINT The amount of auxiliary storage (in kilobytes) occupied by the
user's owned objects for this ASPGRP.
Nullable
Example
Determine how much storage user SCOTTF has consumed.
You can redefine any of the global variable values to change the alerting percent on your system. The
change will take effect the next time the altering levels are checked.
Use IBM i Access Client Solutions (ACS) to generate SQL for the global variable and use the OR REPLACE
option to recreate it with a different default. For example, to send an alert when a file reaches 70% of its
maximum size, use the following SQL statement:
SYSLIMTBL table
The SYSLIMTBL table contains information about limits as they are being consumed. It is maintained by
Db2 for i.
This table is not authorized or managed like a typical Db2 for i catalog. By default, all users have authority
to view this table. If this table is removed or incompatibly altered, the IBM i operating system will
automatically recreate it. The SYSLIMTBL table is designed to have as small a footprint as possible.
You can add AFTER INSERT or AFTER DELETE triggers to this table. This allows you to perform an action
such as sending a notification when a limit is being logged to the table.
The following table describes the columns in the table. The schema is QSYS2.
Table 259. SYSLIMTBL table
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP The timestamp when this row was last changed.
0 Database
1 Journal
2 Security
3 Miscellaneous
4 Work management
5 File system
6 Save/restore
7 Cluster
8 Communication
1 Object
2 Job
3 System
4 ASP
LIMIT_ID LIMIT_ID INTEGER Unique identifier for this limit. Values are maintained in the
SIZING_ID column in the QSYS2.SQL_SIZING table.
JOB_NAME JOB_NAME VARCHAR(28) The name of the job that reported the current value.
USER_NAME CURUSER VARCHAR(10) The name of the user in effect when the current value was
updated.
SYSTEM_SCHEMA_NAME SYS_NAME VARCHAR(10) The library name for the object. If no library name, contains the
null value.
Nullable
SYSTEM_OBJECT_NAME SYS_ONAME VARCHAR(30) The object name for this row. If no object name, contains the null
value.
Nullable
SYSTEM_TABLE_MEMBER SYS_MNAME VARCHAR(10) The member name for an object limit specific to database
members. Contains the null value if this row is not for a member
Nullable limit.
OBJECT_TYPE OBJTYPE VARCHAR(7) The IBM i object type when an object name has been logged
in the SYSTEM_SCHEMA_NAME and SYSTEM_OBJECT_NAME
Nullable columns. Contains the null value when no object name is
specified.
ASP_NUMBER ASPNUM SMALLINT Contains the ASP number related to this row. Contains the null
value if there is no ASP number.
Nullable
IFS_PATH_NAME PATHNAME DBCLOB(5000) IFS path for the object. Contains the null value if there is no path.
CCSID 1200
Nullable
Example
Add a trigger to QSYS2.SYSLIMTBL to send a message when any table is approaching the maximum size.
The trigger will be fired when any row is inserted into SYSLIMTBL. Within the trigger, it checks for the
LIMIT_ID indicating the maximum number of rows in a partition (15000) and the value when you want to
be notified.
SYSLIMITS view
The SYSLIMITS view contains information about limits. This view is built on the QSYS.SYSLIMTBL table
along with other system information. If a job is still active, the view contains information about the job
that logged the limit.
Authorization: For rows where the job is still active, the caller's user profile must be the same as the job
user identity of the job for which the information is being returned, or must have *JOBCTL user special
authority, or QIBM_DB_SQLADM or QIBM_DB_SYSMON function usage authority. If the caller does not
have sufficient authority, partial information is returned along with an SQL warning of '01548'.
For rows where LIMIT_TYPE = 'OBJECT', additional authorization is required:
• If the user has *EXECUTE authority to the library, and both *OBJOPR and *READ authority to an object,
full details are returned.
• Otherwise, partial information is returned along with an SQL warning of '01548'.
The following table describes the columns in the view. The schema is QSYS2.
Table 260. SYSLIMITS view
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP The timestamp when this row was last changed.
Nullable
USER_NAME CURUSER VARCHAR(10) The name of the user in effect when this row was logged.
Nullable
JOB_NAME JOB_NAME VARCHAR(28) The name of the job when this row was logged.
Contains the null value if the job is no longer active.
ACTIVE_JOB_STATUS AJSTATUS CHAR(4) The active status of the initial thread of the job.
RUN_PRIORITY RUNPRI INTEGER The highest run priority allowed for any thread within this job.
CPU_USED CPU_USED BIGINT The amount of CPU time (in milliseconds) that has been currently
used by this job.
Nullable
Contains the null value if the job is no longer active.
TEMP_STORAGE_USED_MB TEMPSTG INTEGER The amount of auxiliary storage (in megabytes) that is currently
allocated to this job.
Nullable
Contains the null value if the job is no longer active.
AUX_IO_REQUESTED AUXIO BIGINT The number of auxiliary I/O requests performed by the job
across all routing steps. This includes both database and
Nullable nondatabase paging.
Contains the null value if the job is no longer active.
PAGE_FAULTS PAGEFAULT BIGINT The number of times an active program referenced an address
that was not in main storage during the current routing step of
Nullable the specified job.
Contains the null value if the job is no longer active.
SQL_STATEMENT_TEXT SQLSTMT VARCHAR(10000) Statement text of the last SQL statement to run or the SQL
statement that is currently running.
Nullable
Contains the null value if the job is no longer active.
SCHEMA_NAME OBJ_SCHEMA VARCHAR(128) The SQL schema name for this object.
SYSTEM_TABLE_MEMBER SYS_MNAME VARCHAR(10) The member name for an object limit specific to database
members.
Nullable
Contains the null value if this row is not for a member limit.
OBJECT_TYPE OBJTYPE VARCHAR(7) The IBM i object type when an object name has been logged
in the SYSTEM_SCHEMA_NAME and SYSTEM_OBJECT_NAME
Nullable columns.
Contains the null value when no object name is specified.
SQL_OBJECT_TYPE SQLOBJTYPE VARCHAR(9) The SQL type of the object when an object name has been logged
in the SYSTEM_SCHEMA_NAME and SYSTEM_OBJECT_NAME
Nullable columns. Values are:
• ALIAS
• FUNCTION
• INDEX
• PACKAGE
• PROCEDURE
• ROUTINE
• SEQUENCE
• TABLE
• TRIGGER
• TYPE
• VARIABLE
• VIEW
• XSR
Contains the null value if the object is not an SQL object or when
no object name is specified.
ASP_NUMBER ASPNUM SMALLINT Contains the ASP number related to this row.
LIMIT_ID LIMIT_ID INTEGER Unique identifier for this limit. Values are maintained in the
SIZING_ID column in the QSYS2.SQL_SIZING table.
Examples
• Find the 50 largest IFS stream files. Remove any duplicates from the result. Note that only stream files
that have reached the documented floor and increment values will appear in SYSLIMITS.
• Review the consumption of the 'Total number of jobs', relative to the QMAXJOB system value.
WITH TT(JOB_MAXIMUM)
AS (SELECT CURRENT_NUMERIC_VALUE
FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QMAXJOB')
SELECT LAST_CHANGE_TIMESTAMP AS INCREMENT_TIME, CURRENT_VALUE AS JOB_COUNT,
TT.JOB_MAXIMUM,
DEC(DEC(CURRENT_VALUE,19,2) / DEC(TT.JOB_MAXIMUM,19,2) * 100,19,2)
SYSLIMITS_BASIC view
The SYSLIMITS_BASIC view contains information about limits. This view is built on the QSYS.SYSLIMTBL
table along with other system information. It does not return information about the job that logged the
limit. This view returns less information than the SYSLIMITS view, but it requires less authorization and
typically performs significantly better.
Authorization: None required.
The following table describes the columns in the view. The system name is SYSLIMIT_B. The schema is
QSYS2.
Table 261. SYSLIMITS_BASIC view
LAST_CHANGE_TIMESTAMP LASTCHG TIMESTAMP The timestamp when this row was last changed.
Nullable
USER_NAME CURUSER VARCHAR(10) The name of the user in effect when this row was logged.
Nullable
JOB_NAME JOB_NAME VARCHAR(28) The name of the job when this row was logged.
Contains the null value if the job is no longer active.
SYSTEM_TABLE_MEMBER SYS_MNAME VARCHAR(10) The member name for an object limit specific to database
members.
Nullable
Contains the null value if this row is not for a member limit.
OBJECT_TYPE OBJTYPE VARCHAR(7) The IBM i object type when an object name has been logged
in the SYSTEM_SCHEMA_NAME and SYSTEM_OBJECT_NAME
Nullable columns.
Contains the null value when no object name is specified.
ASP_NUMBER ASPNUM SMALLINT Contains the ASP number related to this row.
LIMIT_ID LIMIT_ID INTEGER Unique identifier for this limit. Values are maintained in the
SIZING_ID column in the QSYS2.SQL_SIZING table.
Examples
• Review the consumption of the 'Total number of jobs', relative to the QMAXJOB system value.
WITH TT(JOB_MAXIMUM)
AS (SELECT CURRENT_NUMERIC_VALUE
FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QMAXJOB')
SELECT LAST_CHANGE_TIMESTAMP AS INCREMENT_TIME, CURRENT_VALUE AS JOB_COUNT,
TT.JOB_MAXIMUM,
DEC(DEC(CURRENT_VALUE,19,2) / DEC(TT.JOB_MAXIMUM,19,2) * 100,19,2)
AS PERCENT_CONSUMED
FROM QSYS2.SYSLIMITS_BASIC, TT
WHERE LIMIT_ID = 19000 ORDER BY CURRENT_VALUE DESC;
PROCESS_SYSTEM_LIMITS_ALERTS procedure
The QSYS2.PROCESS_SYSTEM_LIMITS_ALERTS procedure can be called directly to look for any tracked
limits that have exceeded their alerting level in the last 24 hours. If any are identified, an alert will be
signaled. Calling it repeatedly can send duplicate alerts.
This procedure performs the same checks that are done by the system processing of the alerts. If a limit
has reached its alerting level, message SQL7062 is sent to the QSYSOPR message queue. See “System
limit alerts” on page 1000 for details.
This procedure can be submitted in a job to be run at a user-determined time to look for runaway
situations.
Authorization: This procedure, implemented by the QSYS2/LIM_ALERTS program, is shipped with
*PUBLIC *EXCLUDE authority.
To call this procedure the user must have *EXECUTE authority to the QSYS2/LIM_ALERTS program.
PROCESS_SYSTEM_LIMITS_ALERTS ( )
Example
To schedule a job that will run every weekday at noon to report system limits that have reached their
reporting threshold values in the last 24 hours, the following CL command can be run.
ADDJOBSCDE JOB(chkalert)
CMD(RUNSQL SQL('CALL QSYS2.PROCESS_SYSTEM_LIMITS_ALERTS()') COMMIT(*NONE) )
FRQ(*WEEKLY) SCDDATE(*NONE)
SCDDAY(*MON *TUE *WED *THU *FRI ) SCDTIME('12:00:00')
The second control for automatic deletion of rows is by the number of rows for a type of limit. For each
type of limit, there are two global variables. The pruning variable is used to choose how many of the most
recently logged entries should be retained. The high point variable is used to choose how many of the
highest consumption value entries should be retained.
The following are the names of the global variables and the limit that is shipped for each one. The schema
is SYSIBMADM.
You can adjust any of the global variable values to establish a custom behavior for the automatic deletion
of system limits rows. The Db2 for i supplied global variables use the default value to guide an automatic
row deletion process that runs nightly when Collection Services is recycled, which normally occurs just
past midnight.
Authorization: To create or replace a global variable the caller must have:
• *OBJMGT authority on the service program for the variable, and
• All authorities needed to DROP the variable, and
• *READ authority on the SYSVARIABLES catalog table.
, subsystem-list-filter
SUBSYSTEM_LIST_FILTER =>
, job-name-filter
JOB_NAME_FILTER =>
, current-user-list-filter
CURRENT_USER_LIST_FILTER =>
)
, detailed-info
DETAILED_INFO =>
reset- A character or graphic string expression that contains a value of YES or NO.
statistics
If this parameter has a value of YES, statistics are reset such that the time of this query
execution is used as the new baseline. Future invocations of ACTIVE_JOB_INFO within
this connection will return statistical detail relative to the new baseline. If this parameter
has a value of NO, statistics are not reset for the invocation unless the subsystem-list-filter
or job-name-filter parameter values are different than the previous invocation. Changing
the filter values will always cause statistics to be reset. If this parameter is not specified,
the default is NO.
The first invocation of ACTIVE_JOB_INFO within a connection will always perform an
implicit reset, regardless of whether a reset was explicitly requested.
subsystem- A character or graphic string expression that contains a list of up to 25 subsystem names
list-filter separated by exactly one comma. The filter determines which subsystems to use to
return job information.
If this parameter is not specified, is an empty string, or is the null value, information for
all subsystems is returned.
job-name- A character or graphic string expression that contains an unqualified job name that
filter determines the job information to be returned. The name can be a generic name.
The string can be one of the following special values:
current-user- A character or graphic string expression that contains a list of up to 10 user profile names
list-filter separated by exactly one comma. The filter determines which current user values to use
to return job information.
If this parameter is not specified, is an empty string, or is the null value, information for
all users is returned.
detailed-info A character or graphic string expression that indicates the type of information to be
returned.
NONE Only the general information is returned for active jobs. This is the information
in the columns prior to the JOB_DESCRIPTION_LIBRARY column. This is the
default.
WORK In addition to the general information for active jobs, additional work
management information is returned.
QTEMP In addition to the general information for active jobs, the QTEMP_SIZE column
is returned.
ALL Information for all the columns is returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
The DETAILED_INFO option column indicates which of the DETAILED_INFO parameter values can return
a non-null value for the corresponding result column.
Table 262. ACTIVE_JOB_INFO table function
DETAILED_INFO
Column Name Data Type option Description
JOB_USER VARCHAR(10) NONE The user profile that started the job.
WORK
QTEMP
ALL
SUBSYSTEM VARCHAR(10) NONE The name of the subsystem where the job is running.
WORK Contains the null value if the job is a system job.
QTEMP
ALL
DETAILED_INFO
Column Name Data Type option Description
AUTHORIZATION_NAME VARCHAR(10) NONE The user profile under which the initial thread is running at this
WORK time. For jobs that swap user profiles, this user profile name and
QTEMP the user profile that initiated the job can be different.
ALL
INT Interactive
PJ Prestart job
SYS System
DETAILED_INFO
Column Name Data Type option Description
FUNCTION_TYPE VARCHAR(3) NONE The type of function described in the FUNCTION column.
WORK
QTEMP CMD The FUNCTION column contains the name of the
ALL command being run.
DETAILED_INFO
Column Name Data Type option Description
FUNCTION VARCHAR(10) NONE The last high-level function initiated by the initial thread.
WORK If FUNCTION_TYPE is not null, contains a value as defined by
QTEMP the FUNCTION_TYPE column. Otherwise, can contain one of the
ALL following values:
DETAILED_INFO
Column Name Data Type option Description
JOB_STATUS VARCHAR(4) NONE The status of the initial thread of the job. The following list
WORK contains some of the most common values. For a complete list
QTEMP of values, see Work Management API Attribute Descriptions in
ALL Application Programming Interfaces
END The job has been ended with the *IMMED option, or
its delay time has ended with the *CNTRLD option.
EOJ Ending for a reason other than running the End Job
(ENDJOB) or End Subsystem (ENDSBS) command.
MEMORY_POOL VARCHAR(9) NONE The identifier of the system-related pool from which the job's
WORK main storage is allocated. This is the pool that the threads in the
QTEMP job start in.
ALL
RUN_PRIORITY INTEGER NONE The priority at which the job competes for the processing unit
WORK relative to other jobs that are active at the same time. The run
QTEMP priority ranges from 1 (highest priority) to 99 (lowest priority).
ALL
CPU_TIME DECIMAL(20,0) NONE The total processing unit time used by the job, in milliseconds.
WORK
QTEMP
ALL
TOTAL_DISK_IO_COUNT DECIMAL(20,0) NONE The total number of disk I/O operations performed by the job
WORK across all routing steps. This is the sum of the asynchronous and
QTEMP synchronous disk I/O.
ALL
DETAILED_INFO
Column Name Data Type option Description
ELAPSED_INTERACTION_COUNT INTEGER NONE The number of interactions. This is the number of operator
WORK interactions during the measurement time interval.
QTEMP Contains the null value if the job is not interactive.
ALL
ELAPSED_TOTAL_RESPONSE_TIME INTEGER NONE The total response time over the measurement time interval, in
WORK seconds.
QTEMP Contains the null value if the job is not interactive.
ALL
ELAPSED_TOTAL_DISK_IO_COUNT DECIMAL(20,0) NONE The number of disk I/O operations performed by the job
WORK during the measurement time interval. This is the sum of the
QTEMP asynchronous and synchronous disk I/O.
ALL
ELAPSED_ASYNC_DISK_IO_COUNT DECIMAL(20,0) NONE The number of asynchronous (physical) disk I/O operations
WORK performed by the job during the measurement time interval.
QTEMP This value is the sum of the asynchronous database and
ALL nondatabase reads and writes.
ELAPSED_SYNC_DISK_IO_COUNT DECIMAL(20,0) NONE The number of synchronous (physical) disk I/O operations
WORK performed by the job during the measurement time interval.
QTEMP This value is the sum of the synchronous database and
ALL nondatabase reads and writes.
ELAPSED_CPU_PERCENTAGE DECIMAL(10,2) NONE The percent of processing unit time attributed to this job during
WORK the measurement time interval.
QTEMP
ALL
ELAPSED_CPU_TIME DECIMAL(20,0) NONE The total CPU time spent during the measurement time interval,
WORK in milliseconds.
QTEMP
ALL
ELAPSED_PAGE_FAULT_COUNT DECIMAL(20,0) NONE The number of times an active program referenced an address
WORK that is not in main storage for the specified job during the
QTEMP measurement time interval.
ALL
JOB_END_REASON VARCHAR(60) NONE Reason the job is ending. Contains one of the following values:
WORK • JOB ENDED DUE TO A DEVICE ERROR
QTEMP
ALL • JOB ENDED DUE TO A SIGNAL
• JOB ENDED DUE TO AN UNHANDLED ERROR
• JOB ENDED DUE TO THE CPU LIMIT BEING EXCEEDED
• JOB ENDED DUE TO THE DISCONNECT TIME INTERVAL
BEING EXCEEDED
• JOB ENDED DUE TO THE INACTIVITY TIME INTERVAL BEING
EXCEEDED
• JOB ENDED DUE TO THE MESSAGE SEVERITY LEVEL BEING
EXCEEDED
• JOB ENDED DUE TO THE STORAGE LIMIT BEING EXCEEDED
• JOB ENDED WHILE IT WAS STILL ON A JOB QUEUE
• JOB ENDING ABNORMALLY
• JOB ENDING IMMEDIATELY
• JOB ENDING IN NORMAL MANNER
• JOB ENDING NORMALLY AFTER A CONTROLLED END WAS
REQUESTED
• SYSTEM ENDED ABNORMALLY
Contains the null value if job is not currently ending.
SERVER_TYPE VARCHAR(30) NONE The type of server represented by the job. See Server table for a
WORK list of server type values.
QTEMP Contains the null value if the job is not part of a server.
ALL
DETAILED_INFO
Column Name Data Type option Description
ELAPSED_TIME DECIMAL(20,3) NONE The time that has elapsed, in seconds, between the
WORK measurement start time and the current system time.
QTEMP
ALL
JOB_DESCRIPTION_LIBRARY VARCHAR(10) WORK The name of the library containing the job description.
ALL Contains the null value if the job has no job description.
JOB_DESCRIPTION VARCHAR(10) WORK The name of the job description used for this job.
ALL Contains the null value if the job has no job description.
JOB_QUEUE_LIBRARY VARCHAR(10) WORK The name of the library containing the job queue.
ALL Contains the null value if the job is not a batch job that was
started from a job queue.
JOB_QUEUE VARCHAR(10) WORK The name of the job queue that the job was on.
ALL Contains the null value if the job is not a batch job that was
started from a job queue.
OUTPUT_QUEUE_LIBRARY VARCHAR(10) WORK The name of the library that contains the default output queue.
ALL Contains the null value if the job has no default output queue.
OUTPUT_QUEUE VARCHAR(10) WORK The name of the default output queue that is used for spooled
ALL output produced by this job. The default output queue is only
used by spooled printer files that specify *JOB for the output
queue.
Contains the null value if the job has no default output queue.
WORKLOAD_GROUP VARCHAR(10) WORK The name of the workload group to which the job belongs.
ALL Contains the null value if the job is not part of a workload group.
CCSID INTEGER WORK The coded character set identifier (CCSID) used for this job.
ALL
DEFAULT_CCSID INTEGER WORK The default coded character set identifier used for this job.
ALL
SORT_SEQUENCE_LIBRARY VARCHAR(10) WORK The name of the library that contains the sort sequence table.
ALL Contains the null value if no sort sequence table is defined for
this job or if SORT_SEQUENCE is a special value.
SORT_SEQUENCE VARCHAR(10) WORK The name of the sort sequence table associated with this job.
ALL Contains the null value if no sort sequence table is defined for
this job.
LANGUAGE_ID CHAR(3) WORK The language identifier associated with this job.
ALL
DATE_FORMAT CHAR(4) WORK The date format used for this job.
ALL
*DMY Day, month, year format.
DATE_SEPARATOR CHAR(1) WORK The date separator used for this job.
ALL
TIME_SEPARATOR CHAR(1) WORK The time separator used for this job.
ALL
DETAILED_INFO
Column Name Data Type option Description
DECIMAL_FORMAT VARCHAR(6) WORK The decimal format used for this job.
ALL
*BLANK Uses a period for a decimal point, a comma for
a 3-digit grouping character, and zero-suppress to
the left of the decimal point.
TIMEZONE_DESCRIPTION VARCHAR(10) ALL The name of the time zone description that is used to calculate
local job time.
TIMEZONE_CURRENT_OFFSET INTEGER ALL The offset, in minutes, used to calculate local job time. This
value has been adjusted for Daylight Saving Time, if necessary.
TIMEZONE_FULL_NAME VARCHAR(50) ALL The full, or long, name for the time zone. This column returns
either the standard or Daylight Saving Time full name depending
on whether or not Daylight Saving Time is in effect.
Contains the null value if the time zone description uses a
message to specify the current full name and the message
cannot be retrieved.
TIMEZONE_ABBREVIATED_NAME VARCHAR(10) ALL The abbreviated, or short, name for the time zone. This column
returns either the standard or Daylight Saving Time abbreviated
name depending on whether or not Daylight Saving Time is in
effect.
Contains the null value if the time zone description uses a
message to specify the current abbreviated name and the
message cannot be retrieved.
DETAILED_INFO
Column Name Data Type option Description
JOB_TYPE_ENHANCED VARCHAR(28) WORK The combined job type and job subtype values.
ALL
ALTERNATE_SPOOL_USER Batch - alternate
spool user
COMM_PROCEDURE_START_REQUEST Communications
job - procedure
start request job
PRESTART_COMM Prestart
communications job
JOB_ENTERED_SYSTEM_TIME TIMESTAMP(0) WORK The timestamp for when the job was placed on the system.
ALL
JOB_ACTIVE_TIME TIMESTAMP(0) WORK The timestamp for when the job began to run on the system.
ALL
CLIENT_IP_ADDRESS VARCHAR(45) ALL Client IP address, in IPv4 format, being used by the job.
Contains the null value when no client IP address exists or the
job is using IPv6.
DETAILED_INFO
Column Name Data Type option Description
JOB_USER_IDENTITY_SETTING VARCHAR(11) ALL The method by which the job user identity was set.
JOB_USER_IDENTITY VARCHAR(10) ALL The user profile name by which the job is known to other jobs
on the system. The job user identity is used for authorization
checks when other jobs on the system attempt to operate
against the job.
Contains the null value if the user profile no longer exists.
SIGNAL_STATUS VARCHAR(3) ALL Whether the job is enabled to receive signals from another job
or the system.
YES The job is enabled for signals. This job can receive
signals from another job or the system.
MESSAGE_REPLY VARCHAR(3) ALL Whether the job is waiting for a reply to a specific message.
Contains the null value if the job is not in message wait status.
CANCEL_KEY VARCHAR(3) ALL Whether the user pressed the cancel key.
EXIT_KEY VARCHAR(3) ALL Whether the user pressed the exit key.
MAXIMUM_ACTIVE_THREADS INTEGER ALL The maximum number of threads that a job can run with at
any time. If multiple threads are initiated simultaneously, this
value may be exceeded. If this maximum value is exceeded,
the excess threads will be allowed to run to their normal
completion. Initiation of additional threads will be inhibited until
the maximum number of threads in the job drops below this
maximum value.
Contains the null value if there is no maximum.
DETAILED_INFO
Column Name Data Type option Description
SYSTEM_POOL_ID INTEGER ALL The identifier of the system-related pool from which main
storage is currently being allocated for the job's initial thread.
These identifiers are not the same as those specified in the
subsystem description, but are the same as the system pool
identifiers shown on the system status display. If a thread
reaches its time-slice end, the pool the thread is running in can
be switched based on the job's time-slice end pool value. The
current system pool identifier returned will be the actual pool in
which the initial thread of the job is running.
Contains the null value if the value is not available.
POOL_NAME VARCHAR(10) ALL The name of the memory pool in which the job started running.
The name may be a number, in which case it is a private pool
associated with a subsystem. Can contain one of the following
special values:
PEAK_TEMPORARY_STORAGE INTEGER ALL The maximum amount of auxiliary storage, in megabytes, that
the job has used.
DEFAULT_WAIT INTEGER ALL The default maximum time, in seconds, that a thread in the job
waits for a system instruction, such as a LOCK machine interface
(MI) instruction, to acquire a resource.
Contains the null value if there is no maximum or if the value is
not available.
MAXIMUM_PROCESSING_TIME_ INTEGER ALL The maximum processing unit time, in milliseconds, that the job
ALLOWED can use. If the job consists of multiple routing steps, this is the
maximum processing unit time that the current routing step can
use. If the maximum time is exceeded, the job is held.
Contains the null value if no maximum amount of processing
unit time has been defined.
MAXIMUM_TEMPORARY_STORAGE_ INTEGER ALL The maximum amount of auxiliary storage, in megabytes, that
ALLOWED the job can use. If the job consists of multiple routing steps,
this is the maximum temporary storage that the routing step can
use. This temporary storage is used for storage required by the
program itself and by implicitly created internal system objects
used to support the routing step. (It does not include storage
for objects in the QTEMP library.) If the maximum temporary
storage is exceeded, the job is held. This does not apply to the
use of permanent storage, which is controlled through the user
profile.
Contains the null value if no maximum amount of temporary
storage has been defined.
DETAILED_INFO
Column Name Data Type option Description
TIME_SLICE INTEGER ALL The maximum amount of processor time, in milliseconds, given
to each thread in this job before other threads in this job and
in other jobs are given the opportunity to run. The time slice
establishes the amount of time needed by a thread in this job
to accomplish a meaningful amount of processing. At the end of
the time slice, the thread might be put in an inactive state so
that other threads can become active in the storage pool. Values
range from 8 through 9999999.
Contains the null value if the value is not available.
PAGE_FAULTS BIGINT ALL The number of times an active program referenced an address
that was not in main storage during the current routing step of
the specified job.
TOTAL_RESPONSE_TIME BIGINT ALL The total amount of response time for the initial thread, in
milliseconds. This value does not include the time used by the
machine, by the attached input/output (I/O) hardware, and by
the transmission lines for sending and receiving data. Returns
zero for jobs that have no interactions. A value of -1 is returned
if the field is not large enough to hold the actual result.
INTERACTIVE_TRANSACTIONS INTEGER ALL The count of operator interactions, such as pressing the Enter
key or a function key. Returns zero for jobs that have no
interactions.
DATABASE_LOCK_WAITS INTEGER ALL The number of times that the initial thread had to wait to obtain
a database lock.
NON_DATABASE_LOCK_WAITS INTEGER ALL The number of times that the initial thread had to wait to obtain
a nondatabase lock.
INTERNAL_MACHINE_ INTEGER ALL The number of times that the initial thread had to wait to obtain
LOCK_WAITS an internal machine lock.
DATABASE_LOCK_WAIT_TIME INTEGER ALL The cumulative amount of time, in milliseconds, that the initial
thread has had to wait to obtain database locks.
NON_DATABASE_LOCK_WAIT_TIME INTEGER ALL The cumulative amount of time, in milliseconds, that the initial
thread has had to wait to obtain nondatabase locks.
INTERNAL_MACHINE_LOCK_ INTEGER ALL The cumulative amount of time, in milliseconds, that the initial
WAIT_TIME thread has had to wait to obtain internal machine locks.
SQL_STATEMENT_TEXT VARCHAR(10000) ALL Statement text of the last SQL statement to run or the SQL
statement that is currently running. The statement text will be
truncated if it is longer than the column.
Contains the null value if no SQL statement has been run.
SQL_STATEMENT_START_TIMESTAMP TIMESTAMP ALL The timestamp of the execution start for an active SQL
statement.
Contains the null value if there is no active SQL statement.
SQL_STATEMENT_LIBRARY_NAME VARCHAR(10) ALL The library name for the SQL statement object.
Contains the null value when the SQL statement name is null
or when the SQL statement does not exist within a permanent
object.
DETAILED_INFO
Column Name Data Type option Description
SQL_STATEMENT_OBJECT_NAME VARCHAR(10) ALL The name of the object which contains the last SQL statement
executed in the job. When the current SQL statement belongs to
an SQL function or an SQL procedure, the object name will be
the external program name.
Contains the null value when the SQL statement name is null
or when the SQL statement does not exist within a permanent
object.
SQL_STATEMENT_OBJECT_TYPE VARCHAR(7) ALL The type of object containing the current SQL statement.
Contains the null value when the SQL statement object name is
null.
QUERY_OPTIONS_LIBRARY_NAME VARCHAR(10) ALL The name of the QAQQINI options library in use for this job.
SQL_ACTIVATION_GROUP_COUNT INTEGER ALL The number of activation groups, current and ended, that have
executed SQL statements for the job.
Contains the null value if no SQL statement has been run.
SQL_DESCRIPTOR_COUNT BIGINT ALL The number of SQL descriptors that are active for the job.
Contains the null value if no SQL descriptors are active for the
job.
SQL_LOB_LOCATOR_COUNT INTEGER ALL The number of LOB locators that are active for the job.
Contains the null value if no LOB locators are active for the job.
CLI_HANDLE_COUNT BIGINT ALL The number of SQL Call Level Interface (CLI) handles that are
active for the job. This count includes CLI statement handles,
descriptor handles, environment handles, and connection
handles.
Contains the null value if no CLI handles are active for the job.
SQL_SERVER_MODE VARCHAR(3) ALL Indicates whether the job is configured to use SQL Server Mode.
CLIENT_ACCTNG VARCHAR(255) ALL Value of the SQL CURRENT CLIENT_ACCTNG special register.
The value can be null. For more information, see CURRENT
CLIENT_ACCTNG.
CLIENT_APPLNAME VARCHAR(255) ALL Value of the SQL CURRENT CLIENT_APPLNAME special register.
The value can be null. For more information, see CURRENT
CLIENT_APPLNAME.
CLIENT_USERID VARCHAR(255) ALL Value of the SQL CURRENT CLIENT_USERID special register.
The value can be null. For more information, see CURRENT
CLIENT_USERID.
ROUTINE_TYPE CHAR(1) ALL For a routine defined using SQL, the type of the currently
executing routine.
F Function
P Procedure
DETAILED_INFO
Column Name Data Type option Description
ROUTINE_SCHEMA VARCHAR(128) ALL For a routine defined using SQL, the schema name of the
currently executing routine.
Contains the null value if there is no SQL routine currently
executing.
ROUTINE_SPECIFIC_NAME VARCHAR(128) ALL For a routine defined using SQL, the name of the currently
executing routine.
Contains the null value if there is no SQL routine currently
executing.
CLIENT_PORT INTEGER ALL The port number used by the current client to communicate
with the server.
Contains the null value if the target job does not correspond to a
connection formed using the TCP/IP protocol.
CLIENT_HOST VARCHAR(255) ALL The host name used by the current client to communicate with
the server.
Contains the null value if the target job does not correspond to a
connection formed using the TCP/IP protocol.
INTERFACE_LEVEL VARCHAR(63) ALL The client database interface level in the following form:
"VVRRMMFP". VV - Version RR - Release MM - Modification level
FP - Fix pack level (only applicable for certain interfaces).
Contains the null value if there is no client database interface
level.
SERVER_MODE_CONNECTING_JOB VARCHAR(28) ALL The qualified job name of the job that established the SQL
Server Mode connection. If the job name is QSQSRVR, then the
qualified job name of the connecting job is returned.
Contains the null value if the job name is not QSQSRVR or
JOB_STATUS is PSRW.
SERVER_MODE_CONNECTING_THREAD BIGINT ALL If the job name is QSQSRVR and the server mode job is in use,
the thread identifier of the last thread to use this connection
is returned. When SQL_STATEMENT_STATUS is COMPLETE, this
application thread identifier might no longer exist.
Contains the null value if the job name is not QSQSRVR or
JOB_STATUS is PSRW.
PRESTART_JOB_REUSE_COUNT INTEGER ALL The number of times the prestart job has been used. The
prestart job reuse count is incremented when a disconnect is
processed for a prestart job. When the prestart job reuse count
exceeds the prestart job maximum number of uses, the job is
ended.
Contains the null value if the job is not a prestart job.
PRESTART_JOB_MAX_USE_COUNT INTEGER ALL The maximum number of times the prestart job can be used
before it is ended. A value of -1 is returned for *NOMAX.
Contains the null value if the job is not a prestart job.
AVAILABLE_RESULT_SETS INTEGER ALL The current count of unconsumed SQL result sets for the job.
Contains the null value if the job has no unconsumed SQL result
sets.
UNCONSUMED_RESULT_SETS INTEGER ALL The cumulative count of unconsumed SQL result sets that were
discarded for the job.
Contains the null value if the job has no unconsumed SQL result
sets that have been discarded.
OPEN_CURSOR_COUNT INTEGER ALL The number of SQL cursors that are currently open for the job.
Contains the null value if no SQL cursors are currently open for
the job.
DETAILED_INFO
Column Name Data Type option Description
FULL_OPEN_CURSOR_COUNT BIGINT ALL The total number of SQL cursors that have been full opened for
the life of the job.
Contains the null value if no SQL cursors have been full opened
during the life of the job.
PSEUDO_OPEN_CURSOR_COUNT BIGINT ALL The total number of SQL cursors that have been pseudo opened
for the life of the job. Pseudo opens are also known as reused
SQL cursors.
Contains the null value if no SQL cursors have been pseudo
opened during the life of the job.
PSEUDO_CLOSED_CURSOR_COUNT INTEGER ALL The active number of pseudo closed SQL cursors within the
job. Pseudo closed cursors are cursors that have been closed
by the application, but remain open within the database. A
pseudo closed cursor may be reused when the same query is
executed many times, resulting in a performance improvement
on the open. Conversely, accumulating too many pseudo closed
cursors within the job can have a negative impact on the storage
footprint of the job.
Contains the null value if no SQL cursors are pseudo closed.
CQE_CURSOR_COUNT INTEGER ALL The number of cursors using CQE for this job. This includes SQL
cursors (both fully opened and pseudo closed) and cursors used
to implement native database queries.
Contains the null value if no cursors have used CQE for this job.
CQE_CURSOR_STORAGE INTEGER ALL The amount of storage, in megabytes, used by cursors using
CQE for this job.
Contains the null value if no cursors have used CQE for this job.
SQE_CURSOR_COUNT INTEGER ALL The number of cursors using SQE for this job. This includes SQL
cursors (both fully opened and pseudo closed) and cursors used
to implement native database queries.
Contains the null value if no cursors have used SQE for this job.
SQE_CURSOR_STORAGE INTEGER ALL The amount of storage, in megabytes, used by cursors using
SQE for this job.
Contains the null value if no cursors have used SQE for this job.
LARGEST_QUERY_SIZE INTEGER ALL The amount of storage, in megabytes, used by the SQE
cursor that used the most storage for this job. This
could be for a different query than the one listed in the
SQL_STATEMENT_TEXT column.
Contains the null value if no cursors have used SQE for this job.
QRO_HASH VARCHAR(8) ALL An internally generated identifier for the SQE query
referred to in the LARGEST_QUERY_SIZE column. This
could be for a different query than the one listed in the
SQL_STATEMENT_TEXT column. The QRO hash surfaces within
Visual Explain and from Show Statements exploration of the
SQL Plan Cache and SQL Plan Cache Snapshots.
Contains the null value if no cursors have used SQE for this job.
OPEN_FILES INTEGER ALL The number of open files (*FILE objects) for this job. For
details about the types of files and their usage, use the
QSYS2.OPEN_FILES table function.
Example
• Example 1: Looking at only QZDASOINIT jobs, find the top 10 consumers of Elapsed I/O.
ADD_TRACKED_JOB_QUEUE procedure
The ADD_TRACKED_JOB_QUEUE procedure registers a job queue to be tracked by adding it to the tracked
job queue list.
For a subsystem to track jobs, there must be at least one tracked job queue registered to the Submitted
Job Tracker when that subsystem starts.
For more information about the Submitted Job Tracker, see “Submitted Job Tracker” on page 1027.
Authorization: The caller must have *JOBCTL special authority.
ADD_TRACKED_JOB_QUEUE ( iasp-name ,
IASP_NAME =>
job-queue-library ,
JOB_QUEUE_LIBRARY =>
job-queue
JOB_QUEUE =>
, job-retention-period
JOB_RETENTION_PERIOD =>
)
, tracking-file-iasp
TRACKING_FILE_IASP =>
iasp-name A character string that contains the name of the ASP where job-queue-library is located.
The ASP does not need to exist. Can contain the following special value:
*SYSBAS The job queue library is located in the system ASP (ASP 1) or any basic user
ASPs (ASPs 2-32).
job-queue- A character string that contains the name of the library containing job-queue. The library
library does not need to exist.
job-queue A character string that contains the name of the job queue to be tracked. A job queue
can be registered even if it does not exist.
Job queues in libraries QSYS and QGPL that start with Q are not eligible to be added.
job-retention- An integer value that specifies the number of minutes job tracking information will be
period retained in the tracking file after the job has ended. The default is 0, which indicates that
the job tracking information is immediately eligible for removal when the job ends.
Example
• Add job queue APPLIB/APPJOBQ to the list of tracked job queues.
3 For an IASP, the QAMRDJTS job tracking file exists in library QSJTnnnnn.
Job starts When a tracked job starts, the job tracking file is updated to indicate the job start
time.
Job ends When a tracked job ends, the job tracking file is updated to indicate the job end
time and other completion details.
If a job is ended while it is on a tracked job queue that is not allocated to a
subsystem, the job tracking file remains unchanged until the job queue is no longer
tracked or the job tracking file is cleared.
Job schedule Jobs that are scheduled to run at a future date or time using the Add Job
entries Schedule Entry (ADDJOBSCDE) or Work with Job Schedule Entries (WRKJOBSCDE)
commands are not tracked.
The job tracking file is updated asynchronously while tracked jobs encounter lifecycle events. Tracking
information is gathered, processed, and stored in a job tracking file asynchronously by the Submitted Job
Tracker job (QMRDBJNFY). Subsequently, tracking information in the job tracking file will always lag the
real lifecycle event. The lag time should be small in most cases, but it is not zero. This means:
• A job that is queued at the time of a node failure may not appear in the job tracking file.
• A job that has started running at the time of node failure may not appear in the job tracking file or may
be described in the job track file as still queued.
• A job that has ended at the time of node failure may be described in the job tracking file as still queued
or running.
Removing Job queues are removed from being tracked using the
tracked job “REMOVE_TRACKED_JOB_QUEUE procedure” on page 1090.
queues
Displaying Tracked jobs and their details are displayed using the “TRACKED_JOB_INFO table
tracked jobs function” on page 1126.
Clearing Tracked job information is eligible to be automatically removed from a job tracking
tracked jobs file after the job has ended, the job tracking file has been updated with a job end
details time value, and the job retention period has elapsed. The job retention period is
specified when a job queue is registered with the JQL. The Submitted Job Tracker
Restoring The JQL, which is a database file named QSYS/QAMRDJQL, can be restored from save
Submitted media. This will replace the existing list of tracked job queues with the list of tracked job
Job Tracker queues from the save media. When the QAMRDJQL file is restored, each job queue on the
data restored list of tracked job queues is ensured to be properly registered with Submitted
Job Tracker. If the restore causes a job queue to no longer be tracked, then the job
tracking file will be cleared of entries for that job queue.
The job tracking file, which is a database file named QSBMJOBTRK/QAMRDJTS4, cannot
be restored from save media. If an attempt is made to restore this system object, it will
not be restored and the existing object is left unchanged. If other objects are included in
the restore request, they will be processed normally.
AUTOSTART_JOB_INFO view
The AUTOSTART_JOB_INFO view returns information about autostart jobs.
The values returned for the columns in the view are closely related to the values returned by the
Display Autostart Job Entries panel accessed through the DSPSBSD (Display Subsystem Description) CL
command and by the List Subsystem Entries (QWDLSBSE) API.
4 For an IASP, the QAMRDJTS job tracking file exists in library QSJTnnnnn.
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
AUTOSTART_JOB_NAME AJ_NAME VARCHAR(10) The simple name of the job that is automatically
started when the associated subsystem is started.
JOB_DESCRIPTION_LIBRARY JOBDLIB VARCHAR(10) The name of the library in which the job
description for the autostart job entry resides.
JOB_DESCRIPTION JOBD VARCHAR(10) The name of the job description for the autostart
job entry.
Example
• List all the autostart job entries in the QUSRWRK subsystem.
CLEAR_TRACKED_JOB_INFO procedure
The CLEAR_TRACKED_JOB_INFO procedure removes entries from the job tracking file that exists on the
specified ASP group.
Many filters are provided to restrict the entries that are removed from job tracking files by this procedure.
The filters are additive, with each one further limiting the entries to be removed. If none of the filter
parameters are specified, all entries are removed from the job tracking file.
Authorization: The caller must have *JOBCTL special authority.
, node-name
NODE_NAME =>
, job-queue-library
JOB_QUEUE_LIBRARY =>
, job-queue
JOB_QUEUE =>
, internal-job-identifier
INTERNAL_JOB_IDENTIFIER =>
)
, routing-step
ROUTING_STEP =>
iasp-name A character string that contains the name of the IASP where the job tracking file to be
cleared is located. Can contain the following special value:
*SYSBAS The job tracking file is located in the system ASP (ASP 1) or any basic user
ASPs (ASPs 2-32).
node-name A character string that contains a node name. Entries in a job tracking file for this node are
removed. Can contain the following special value:
If this parameter is omitted, the node name is not used to limit entries to be removed.
job-queue- A character string that contains a job queue library name. Entries in a job tracking file for a
library job queue in this library are removed.
If this parameter is omitted, the job queue library name is not used to limit entries to be
removed.
job-queue A character string that contains a job queue name. Entries in a job tracking file for a job
queue with this name are removed.
If this parameter is omitted, the job queue name is not used to limit entries to be
removed.
internal- A binary string that contains an internal job identifier. Entries in a job tracking file with this
job- internal job identifier on node-name are removed.
identifier When internal-job-identifier is specified, node-name must be specified. job-queue-library
and job-queue must not be specified.
If this parameter is omitted, the internal job identifier is not used to limit entries to be
removed.
routing-step An integer that contains a routing step number. Entries in a job tracking file with this
routing step and internal-job-identifier on node-name are removed.
Examples
• Clear all tracked job information from the job tracking file in *SYSBAS.
• Clear tracked job information for all jobs submitted to any job queue in library MYLIB on any node.
• Clear tracked job information for all jobs submitted to any job queue named MYJOBQ in any library on
any node.
• Clear tracked job information for all jobs submitted to job queue MYJOBQ in library MYLIB on the local
node.
• Clear tracked job information for a specific job on the local node.
• Clear tracked job information for routing step 2 of a specific job on the local node.
COMMUNICATIONS_ENTRY_INFO view
The COMMUNICATIONS_ENTRY_INFO view returns information about subsystem communications
entries.
The values returned for the columns in the view are closely related to the values returned by the
Display Communications Entries and Display Remote Location Name Entries panels accessed through the
DSPSBSD (Display Subsystem Description) CL command and by the List Subsystem Entries (QWDLSBSE)
API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the subsystem description, and
• *USE authority to the subsystem description.
The following table describes the columns in the view. The system name is COMM_INFO. The schema is
QSYS2.
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
DEVICE DEVICE VARCHAR(10) The name of the device description or the type of
the device being used with this communications
Nullable entry. Can contain the following special values:
REMOTE_LOCATION RMT_LOC VARCHAR(8) The name of the remote location for this entry.
JOB_DESCRIPTION JOBD VARCHAR(10) The name of the job description used when
a job is started as a result of receiving a
program start request and processed through this
communications entry. Can contain the following
special value:
DEFAULT_USER DFT_USER VARCHAR(10) The name of the default user profile used for
evoke requests that enter the subsystem through
Nullable this entry and contain no security information.
Can contain the following special value:
MAXIMUM_ACTIVE_JOBS MAX_ACTIVE INTEGER The maximum number of jobs that can be active
at the same time through this entry.
Nullable
Contains the null value if the entry specifies
*NOMAX, indicating that there is no maximum.
Example
• List all the communications entries defined for the QCMN subsystem.
SELECT *
FROM QSYS2.COMMUNICATIONS_ENTRY_INFO
WHERE SUBSYSTEM_DESCRIPTION_LIBRARY = 'QSYS' AND
SUBSYSTEM_DESCRIPTION = 'QCMN';
ENDED_JOB_INFO (
start-time
START_TIME =>
)
, end-time
END_TIME =>
start-time A timestamp expression that indicates the starting timestamp to use for returning ended job
information.
If this parameter is omitted, the default of CURRENT DATE - 1 DAY is used.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 265. ENDED_JOB_INFO table function
MESSAGE_TIMESTAMP TIMESTAMP The timestamp when the CPF1164 message was sent.
FROM_USER VARCHAR(10) The user name of the job from which the CPF1164 message was sent.
FROM_JOB VARCHAR(28) The qualified job name from which the CPF1164 message was sent.
FROM_JOB_NAME VARCHAR(10) The name of the job from which the CPF1164 message was sent.
FROM_JOB_USER VARCHAR(10) The user profile that started the job from which the CPF1164
message was sent.
FROM_JOB_NUMBER VARCHAR(6) The job number of the job from which the CPF1164 message was
sent.
JOB_INTERFACE VARCHAR(22) The interface used by the job reported by the CPF1164 message.
• CENTRAL SERVER
• CLI DB CONNECTION
• DATA QUEUE SERVER
• DB2 MIRROR
• DRDA DDM SERVER TCP/IP
• FILE SERVER
• FTP
• NETSERVER FILE SHARE
• ODBC OR FILE TXFR
• OTHER
• PRINT SERVER
• REMOTE COMMAND
• REXEC
• SIGNON SERVER
• SNDNETXXX
• SSH CONNECTION
• TELNET/5250
CPU_TIME DECIMAL(15,3) The total amount of processing used by the job, in seconds.
90 The job was forced to end after the time limit ended
(ENDJOBABN command)
INTERACTIVE_TRANSACTIONS INTEGER The total number of operator interactions, such as pressing the Enter
key, for the job.
SYNC_AUX_IO_COUNT INTEGER The number of synchronous (physical) disk I/O operations performed
by the job. This value is the sum of the synchronous database and
non-database reads and writes.
PEAK_TEMPORARY_STORAGE INTEGER The maximum temporary storage, in megabytes, used by the job.
Note
This function is provided in the SYSTOOLS schema as an example of how to extract information from
message substitution variables. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source
can be extracted and used as a model for building similar helper functions, or to create a customized
version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
List the 10 jobs from yesterday and today that were the top consumers of temporary storage.
GET_JOB_INFO ( job-name
V_JOB_NAME =>
)
, ignore-errors
V_IGNORE_ERRORS =>
job-name A character or graphic string expression that identifies the name of a job. Two forms of a job
name are supported.
1. A fully qualified job name in the form job-number/job-user/job-name.
2. The first 10 characters are the job name, the second 10 characters are the user name,
and the last 6 characters are the job number.
The special value of '*' indicates the current job.
ignore- A character or graphic string expression that identifies what to do when an error is
errors encountered.
The result of the function is a table containing a single row with the format shown in the following table.
All the columns are nullable.
Table 266. GET_JOB_INFO table function
*OUTQ Job has completed running but has output on an output queue or
the job log has not yet been written.
V_ACTIVE_JOB _STATUS CHAR(4) The active status of the initial thread of the job.
For the list of values see Work Management API Attribute Descriptions in
Application Programming Interfaces and search on "Active job status".
Returns null if the job is in transition or is not active.
ASJ Autostart
BCH Batch
INT Interactive
PJ Prestart job
SYS System
Returns null if the job type is not available for jobs that are no longer active.
V_RUN_PRIORITY INTEGER The priority at which the job competes for the processing unit relative to other
jobs that are active at the same time. The run priority ranges from 1 (highest
priority) to 99 (lowest priority).
V_AUTHORIZATION_NAME VARCHAR(10) The user profile under which the initial thread is running at this time. For jobs
that swap user profiles, this user profile name and the user profile that initiated
the job can be different.
V_CPU_USED BIGINT The amount of CPU time (in milliseconds) that has been currently used by this
job.
V_TEMP_STORAGE_USED_MB INTEGER The amount of auxiliary storage (in megabytes) that is currently allocated to this
job.
V_AUX_IO_REQUESTED BIGINT The number of auxiliary I/O requests performed by the job across all routing
steps. This includes both database and nondatabase paging.
V_PAGE_FAULTS BIGINT The number of times an active program referenced an address that was not in
main storage during the current routing step of the specified job.
V_SQL_STATEMENT_TEXT VARCHAR(10000) Statement text of the last SQL statement to run or the SQL statement that is
currently running.
Returns null if the job is not active.
COMPLETE At least one SQL statement has run and has completed
V_SQL_STMT_START_TIMESTAMP TIMESTAMP The timestamp of the execution start for an active SQL statement. If there is no
active SQL statement, the null value is returned.
V_QUERY_OPTIONS_LIB_NAME CHAR(10) The name of the QAQQINI options library in use for this job.
V_PJ_REUSE_COUNT INTEGER The number of times the prestart job has been used. The prestart job reuse
count is incremented when a disconnect is processed for a prestart job. When
the prestart job reuse count exceeds the prestart job maximum number of uses,
the job is ended.
Returns null if the job is not active or if the job is not a prestart job.
V_PJ_MAXUSE_COUNT INTEGER The maximum number of times the prestart job can be used before it is ended. A
value of -1 is returned for *NOMAX.
Returns null if the job is not active or if the job is not a prestart job.
Example
Return information about job 347117/QUSER/QZDASOINIT.
JOB_DESCRIPTION_INFO view
The JOB_DESCRIPTION_INFO view returns information about job descriptions.
The values returned for the columns in the view are closely related to the values returned by the Display
Job Description (DSPJOBD) CL command and the Retrieve Job Description Information (QWDRJOBD) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the job description, and
• *OBJOPR and *READ authorities to the job description.
The following table describes the columns in the view. The system name is JOBD_INFO. The schema is
QSYS2.
Table 267. JOB_DESCRIPTION_INFO view
JOB_DESCRIPTION_LIBRARY JOBDLIB VARCHAR(10) The name of the library in which the job description resides.
JOB_DESCRIPTION JOBD VARCHAR(10) The name of the job description about which information is being
returned.
AUTHORIZATION_NAME USER_NAME VARCHAR(10) The name of the user profile associated with this job description.
Can contain the following special value:
JOB_DATE JOB_DATE DATE The date that will be assigned to jobs using this job description
Nullable when they are started.
Contains the null value if this job will use the QDATE system
value.
ACCOUNTING_CODE ACGCDE VARCHAR(15) An identifier assigned to jobs that use this job description. This
code is used to collect system resource use information. Can
contain the following special value:
*USRPRF The accounting code used for jobs using this job
description is obtained from the job's user profile.
ROUTING_DATA RTGDTA VARCHAR(80) The routing data that is used with this job description to start
jobs. Can contain one of the following special values:
REQUEST_DATA RQSDTA VARCHAR(256) The request data that is placed as the last entry in the job's
Nullable message queue for jobs that use this job description. Can
contain the following special value:
LIBRARY_LIST_COUNT LIBL_COUNT INTEGER The number of libraries in the user portion of the initial library
list.
LIBRARY_LIST LIBL VARCHAR(2750) The initial library list that is used for jobs that use this job
Nullable description. Only the libraries in the user portion of the library
list are included. The list is an array of 11 character entries. Each
entry contains a ten character name followed by one blank. Can
contain the following special value:
*SYSVAL The jobs using this job description will use the
library list specified by the QUSRLIBL system value.
JOB_SWITCHES SWITCHES CHAR(8) The initial settings for a group of eight job switches used by jobs
that use this job description. These switches can be set or tested
in a program and used to control a program's flow. The possible
values are '0' (off) and '1' (on).
TEXT_DESCRIPTION TEXT VARCHAR(50) The user text, if any, used to briefly describe the job description.
Nullable Contains the null value is there is no descriptive text.
JOB_QUEUE_LIBRARY JOBQLIB VARCHAR(10) The library of the job queue into which batch jobs using this job
description are placed.
JOB_QUEUE JOBQ VARCHAR(10) The name of the job queue into which batch jobs using this job
description are placed.
JOB_QUEUE_PRIORITY JOBQ_PRI SMALLINT The scheduling priority of each job that uses this job description.
The highest priority is 1 and the lowest priority is 9.
HOLD_ON_JOB_QUEUE JOBQ_HOLD VARCHAR(4) Whether jobs using this job description are put on the job queue
with a status of held.
*NO Jobs using this job description are not put on the job
queue as held.
*YES Jobs using this job description are put on the job queue
as held.
OUTPUT_QUEUE_LIBRARY OUTQLIB VARCHAR(10) The name of the library in which the output queue resides.
Nullable Contains the null value if OUTPUT_QUEUE is a special value.
OUTPUT_QUEUE OUTQ VARCHAR(10) The name of the default output queue that is used for spooled
output produced by jobs that use this job description. Can
contain one of the following special values:
*USRPRF The output queue name for jobs using this job
description is obtained from the user profile of the
job at the time the job is started.
OUTPUT_QUEUE_PRIORITY OUTQ_PRI SMALLINT The output priority for spooled files that are produced by jobs
using this job description. The highest priority is 1, and the
lowest priority is 9.
SPOOLED_FILE_ACTION SPOOL_ACT VARCHAR(7) Specifies whether spooled files can be accessed through job
interfaces once a job has completed its normal activity.
*DETACH Spooled files are detached from the job when the
job completes its activity.
*SYSVAL The jobs using this job description will take the
spooled file action specified by the QSPLFACN
system value.
PRINTER_DEVICE DEV_NAME VARCHAR(10) The name of the printer device that is used for all spooled files
created by jobs that use this job description. Can contain one of
the following special values:
PRINT_TEXT PRINT_TEXT VARCHAR(30) The line of text that is printed at the bottom of each page of
Nullable printed output for jobs using this job description. Can contain the
following special value:
JOB_MESSAGE_QUEUE MSGQ_MAX SMALLINT The maximum size (in megabytes) of the job message queue.
_MAXIMUM_SIZE Nullable The possible values are 2 to 64.
Contains the null value if the maximum size is set by system
value QJOBMSGQMX at the time the job is started.
JOB_MESSAGE_QUEUE_FULL MSGQ_FULL VARCHAR(8) The action taken when the job message queue becomes full.
_ACTION
*NOWRAP When the message queue becomes full, do not
wrap. This action will cause the job to end.
SYNTAX_CHECK_SEVERITY SYNTAX SMALLINT Whether requests placed on the job's message queue are
Nullable checked for syntax as CL commands, and the message severity
that causes a syntax error to end processing of a job. The
possible values are:
Contains the null value if the request data is not checked for
syntax as CL commands. This is equivalent to *NOCHK.
JOB_END_SEVERITY JOB_ENDSEV SMALLINT The message severity level of escape messages that can cause a
batch job to end. The batch job ends when a request in the batch
input stream sends an escape message whose severity is equal
to or greater than this value to the request processing program.
The possible values are from 0 through 99.
JOBLOG_OUTPUT JOBLOG_OUT VARCHAR(10) How the job log will be produced when the job completes. This
does not affect job logs produced when the message queue is
full and the job message queue full action specifies *PRTWRAP.
Messages in the job message queue are written to a spooled file,
from which the job log can be printed, unless the Control Job Log
Output (QMHCTLJL) API was used in the job to specify that the
messages in the job log are to be written to a database file.
The job log output value can be changed at any time until the
job log has been produced or removed. To change the job log
output value for a job, use the Change Job (QWTCHGJB) API or
the Change Job (CHGJOB) command.
The job log can be displayed at any time until the job log has
been produced or removed. To display the job log, use the
Display Job Log (DSPJOBLOG) command.
The job log can be removed when the job has completed and the
job log has not yet been produced or removed. To remove the job
log, use the Remove Pending Job Log (QWTRMVJL) API or the
End Job (ENDJOB) command.
The possible values are:
*PND The job log will not be produced. The job log
remains pending until removed.
INQUIRY_MESSAGE_REPLY INQ_REPLY VARCHAR(8) How inquiry messages are answered for jobs that use this job
description.
MESSAGE_LOGGING_SEVERITY LOG_SEV SMALLINT The severity level that is used in conjunction with the logging
level to determine which error messages are logged in the job
log. The possible values are from 0 through 99.
MESSAGE_LOGGING_TEXT LOG_TEXT VARCHAR(7) The level of message text that is written in the job log when
a message is logged according to the logging level and logging
severity.
LOG_CL_PROGRAM_COMMANDS LOG_CL VARCHAR(4) Whether or not commands are logged for CL programs that are
run.
DEVICE_RECOVERY_ACTION DEVRECOVER VARCHAR(13) The action to take when an I/O error occurs for the interactive
job's requesting program device.
TIME_SLICE_END_POOL TIME_SLICE VARCHAR(7) Whether interactive jobs using this job description should be
moved to another main storage pool when they reach time-slice
end.
ALLOW_MULTIPLE_THREADS ALWMLTTHD VARCHAR(4) Whether or not the job is allowed to run with multiple user
threads. This attribute does not prevent the operating system
from creating system threads in the job. This attribute is not
allowed to be changed once a job starts. This attribute applies
to autostart jobs, prestart jobs, batch jobs submitted from job
schedule entries, and jobs started by using the Submit Job
(SBMJOB) and Batch Job (BCHJOB) commands. This attribute
is ignored when starting all other types of jobs. This attribute
should be set to *YES only in job descriptions that are used
exclusively with functions that create multiple user threads.
WORKLOAD_GROUP WRK_GROUP VARCHAR(10) The name of the workload group that is used for jobs that use
Nullable this job description. Can contain the following special value:
Contains the null value if jobs using this job description do not
have a defined workload group.
ASPGRP ASPGRP VARCHAR(10) The name of the ASP group. This is the name of the primary
Nullable ASP device in an ASP group or the name of an ASP device
description. This specifies the initial ASP group setting for jobs
using this job description.
Contains the null value if jobs using this job description do not
have an initial ASP group.
DDM_CONVERSATION DDM_CONV VARCHAR(5) Whether the Distributed Data Management conversations are
kept or dropped when they are not being used. The possible
values are:
Examples
• Review information about the job queues associated with each job description.
• Find the job descriptions that have APPLIB1 in their library list
Now this function can be used to return the list of library names.
JOB_INFO (
job-status-filter
JOB_STATUS_FILTER =>
, job-type-filter
JOB_TYPE_FILTER =>
, job-subsystem-filter
JOB_SUBSYSTEM_FILTER =>
, job-user-filter
JOB_USER_FILTER =>
)
, job-submitter-filter
JOB_SUBMITTER_FILTER =>
job-status- A character or graphic string expression that specifies the value to use as the job status
filter filtering criteria. The string must be one of the following special values:
*ALL Jobs of any status including jobs on job queues, active jobs, and jobs on an
output queue.
*ACTIVE Jobs that are active. You can use the QSYS2.ACTIVE_JOB_INFO table
function to get additional details for these jobs.
*JOBQ Jobs that are not active because they are waiting on a job queue.
*OUTQ Jobs that have completed execution and have output on an output queue.
job-type-filter A character or graphic string expression that specifies the value to use as the job type
filtering criteria. The string must be one of the following special values:
*ALL All types of user jobs, including interactive jobs and batch jobs.
*BATCH Only batch user jobs, including prestart jobs, batch immediate jobs, and
autostart jobs.
*INTERACT Only interactive user jobs.
*ALL All jobs in all subsystems, including jobs that are on job queues and on output
queues.
job-user-filter The USER special register or a character or graphic string expression that specifies the
user profile name to use as the job user filtering criteria.
The string can be a user name or one of the following special values:
The USER special register is specified as a non-string value. It represents the current
user of the job invoking the function.
If this parameter is not provided, the value of the USER special register is used.
job- A character or graphic string expression that specifies the type of submitted jobs to
submitter- return. The string must be one of the following values:
filter
*ALL All submitted jobs.
*JOB Jobs that were submitted from the same job that is invoking this function.
*USER Jobs that were submitted from a job having the same user profile as the job
invoking this function.
*WRKSTN Jobs that were submitted from the same work station as the job invoking
this function.
Restrictions:
• Only one of these filters can have a value other than *ALL: job-subsystem-filter and job-submitter-filter.
• If a value other than *ALL is specified for job-submitter-filter, you must specify *ALL for job-user-filter.
Notes:
• Jobs submitted with *NO specified for the Allow display by WRKSBMJOB (DSPSBMJOB) parameter of
the SBMJOB command are not returned by this table function.
For each of the WRKSBMJOB, WRKSBSJOB, and WRKUSRJOB CL commands shown below, the
corresponding invocation of JOB_INFO will return the same list of jobs. Note that to get exact
equivalence, predicates must be added to some queries to achieve equivalent results:
• For equivalence with WRKUSRJOB, a query must always include the predicate WHERE JOB_TYPE NOT
IN ('SBS','SYS','RDR','WTR')
• For equivalence with WRKSBSJOB SBS(*OUTQ) or WRKSBSJOB SBS(*ALL), a query must always include
the predicate WHERE JOB_TYPE NOT IN ('SBS','SYS')
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 269. JOB_INFO table function
When this value is NO, all columns other than JOB_NAME return the
null value.
ACTIVE The job has started, and it can use system resources
(processing unit, main storage, and so on). This does not
guarantee that the job is currently running, however. For
example, an active job may be in one of the following
states where it is not in a position to use system
resources:
• The Hold Job (HLDJOB) command holds the job; the
Release Job (RLSJOB) command allows the job to run
again.
• The Transfer Group Job (TFRGRPJOB) or Transfer
Secondary Job (TFRSECJOB) command suspends the
job. When control returns to the job, the job can run
again.
• The job is disconnected using the Disconnect Job
(DSCJOB) command. When the interactive user signs
back on, thereby connecting back into the job, the job
can run again.
• The job is waiting for any reason. For example, when
the job receives the reply for an inquiry message, the
job can start running again.
JOBQ The job is currently on a job queue. The job possibly was
previously active and was placed back on the job queue
because of the Transfer Job (TFRJOB) or Transfer Batch
Job (TFRBCHJOB) command, or the job was never active
because it was just submitted.
OUTQ The job has completed running and has spooled output
that has not yet printed or the job's job log has not yet
been written.
ASJ Autostart
BCH Batch
INT Interactive
PJ Prestart job
SYS System
JOB_TYPE_ENHANCED VARCHAR(28) The combined job type and job subtype values.
JOB_DATE VARCHAR(10) The date that is assigned to the job, in *ISO format. The job date
remains the same for the duration of the job unless it is changed by
the user. Can also contain the following special value:
JOB_DESCRIPTION_LIBRARY VARCHAR(10) The name of the library containing the job description.
Contains the null value if JOB_DESCRIPTION is null.
JOB_DESCRIPTION VARCHAR(10) The name of the job description used for this job.
Contains the null value if the job has no job description.
JOB_ACCOUNTING_CODE VARCHAR(15) An identifier assigned to the job by the system to collect resource use
information for the job when job accounting is active.
Contains the null value if the job has no accounting code.
SUBMITTER_MESSAGE_QUEUE_LIBRARY VARCHAR(10) The name of the library containing the message queue.
Contains the null value if the job has no submitter.
SUBMITTER_MESSAGE_QUEUE VARCHAR(10) The name of the message queue where the system sends a
completion message when a batch job ends.
Contains the null value if the job has no submitter.
SERVER_TYPE VARCHAR(30) The type of server represented by the job. See Server table for a list of
server type values.
Contains the null value if the job is not part of a server.
JOB_ENTERED_SYSTEM_TIME TIMESTAMP(0) The timestamp for when the job was placed on the system.
JOB_SCHEDULED_TIME TIMESTAMP(0) The timestamp for when the job is scheduled to become active.
Contains the null value if this is not a scheduled job.
JOB_ACTIVE_TIME TIMESTAMP(0) The time the job began to run on the system.
Contains the null value if the job did not become active.
JOB_END_TIME TIMESTAMP(0) The timestamp for when the job completed running on the system.
Contains the null value if the job has not ended.
JOB_END_SEVERITY SMALLINT The message severity level of escape messages that can cause a
batch job to end. The batch job ends when a request in the batch
input stream sends an escape message, whose severity is equal to or
greater than this value, to the request processing program.
Contains the null value if this the job has not completed.
JOB_END_REASON VARCHAR(60) The most recent action that caused the job to end. Contains one of the
following values:
• JOB ENDED DUE TO A DEVICE ERROR
• JOB ENDED DUE TO A SIGNAL
• JOB ENDED DUE TO AN UNHANDLED ERROR
• JOB ENDED DUE TO THE CPU LIMIT BEING EXCEEDED
• JOB ENDED DUE TO THE DISCONNECT TIME INTERVAL BEING
EXCEEDED
• JOB ENDED DUE TO THE INACTIVITY TIME INTERVAL BEING
EXCEEDED
• JOB ENDED DUE TO THE MESSAGE SEVERITY LEVEL BEING
EXCEEDED
• JOB ENDED DUE TO THE STORAGE LIMIT BEING EXCEEDED
• JOB ENDED WHILE IT WAS STILL ON A JOB QUEUE
• JOB ENDING ABNORMALLY
• JOB ENDING IMMEDIATELY
• JOB ENDING IN NORMAL MANNER
• JOB ENDING NORMALLY AFTER A CONTROLLED END WAS
REQUESTED
• SYSTEM ENDED ABNORMALLY
Contains the null value if job is not currently ending.
JOB_QUEUE_LIBRARY VARCHAR(10) The name of the library containing the job queue.
Contains the null value if JOB_STATUS is OUTQ or if job is not on a job
queue and the job is not a batch job that was started from a job queue.
JOB_QUEUE_NAME VARCHAR(10) The name of the job queue that the job is currently on, or that the job
was on if it is currently active.
Contains the null value if JOB_STATUS is OUTQ or if job is not on a job
queue and the job is not a batch job that was started from a job queue.
JOB_QUEUE_PRIORITY SMALLINT The scheduling priority of the job compared to other jobs on the same
job queue. The highest priority is 0 and the lowest is 9.
Contains the null value if JOB_STATUS is not JOBQ.
JOB_QUEUE_TIME TIMESTAMP(0) The timestamp when the job was put on the job queue.
Contains the null value if this the job is not on a job queue.
JOB_MESSAGE_QUEUE_MAXIMUM_SIZE SMALLINT The maximum size, in megabytes, that the job message queue can
become. The range is 2 to 64.
Contains the null value if JOB_QUEUE_NAME is null.
JOB_MESSAGE_QUEUE_FULL_ACTION VARCHAR(8) The action to take when the message queue is full.
*NOWRAP When the job message queue is full, do not wrap. This
action causes the job to end.
ALLOW_MULTIPLE_THREADS VARCHAR(3) Indicates whether this job allows multiple user threads. This attribute
does not prevent the operating system from creating system threads
in the job.
PEAK_TEMPORARY_STORAGE INTEGER The maximum amount of auxiliary storage, in megabytes, that the job
has used.
Contains the null value if JOB_STATUS is OUTQ or for a job on a job
queue if a value has not been set for the job.
DEFAULT_WAIT INTEGER The default maximum time, in seconds, that a thread in the job
waits for a system instruction, such as a LOCK machine interface (MI)
instruction, to acquire a resource.
Contains the null value if there is no maximum, if JOB_STATUS is
OUTQ, or for a job on a job queue if a value has not been set for the
job.
MAXIMUM_PROCESSING_TIME_ INTEGER The maximum processing unit time, in milliseconds, that the job can
ALLOWED use. If the job consists of multiple routing steps, this is the maximum
processing unit time that the current routing step can use. If the
maximum time is exceeded, the job is held.
Contains the null value if JOB_STATUS is OUTQ or if no maximum
amount of processing unit time has been defined.
MAXIMUM_TEMPORARY_STORAGE_ INTEGER The maximum amount of auxiliary storage, in megabytes, that the
ALLOWED job can use. If the job consists of multiple routing steps, this is
the maximum temporary storage that the routing step can use. This
temporary storage is used for storage required by the program itself
and by implicitly created internal system objects used to support the
routing step. (It does not include storage for objects in the QTEMP
library.) If the maximum temporary storage is exceeded, the job is
held. This does not apply to the use of permanent storage, which is
controlled through the user profile.
Contains the null value if JOB_STATUS is OUTQ or if no maximum
amount of temporary storage has been defined.
JOB_SWITCHES CHAR(8) The current setting of the job switches used by this job.
Contains the null value no job switches are set.
ROUTING_DATA VARCHAR(80) The routing data that is used to determine the routing entry that
identifies the program to start for the routing step.
Contains the null value if there is no routing data for this job.
CCSID INTEGER The coded character set identifier (CCSID) used for this job.
Contains the null value if no CCSID is defined for this job.
CHARACTER_IDENTIFIER_CONTROL VARCHAR(9) The character identifier control for the job. This attribute controls the
type of CCSID conversion that occurs for display files, printer files,
and panel groups. The *CHRIDCTL special value must be specified on
the CHRID command parameter on the create, change, or override
command for display files, printer files, and panel groups before this
attribute will be used.
SORT_SEQUENCE_LIBRARY VARCHAR(10) The name or the library that contains the sort sequence table.
Contains the null value if no sort sequence table is defined for this job
or if SORT_SEQUENCE_NAME is a special value.
SORT_SEQUENCE_NAME VARCHAR(10) The name of the sort sequence table associated with this job.
Contains the null value if no sort sequence table is defined for this job.
COUNTRY_ID CHAR(2) The country or region identifier associated with this job.
TIME_ZONE_DESCRIPTION_NAME VARCHAR(10) The name of the time zone description that is used to calculate local
job time.
MESSAGE_LOGGING_SEVERITY SMALLINT The severity level that is used in conjunction with the logging level to
determine which error messages are logged in the job log. The values
range from 0 through 99.
MESSAGE_LOGGING_TEXT VARCHAR(7) The level of message text that is written in the job log when a message
is logged according to the logging level and logging severity.
*NOLIST If the job ends normally, no job log is produced. If the job
ends abnormally (the job end code is 20 or higher), a job
log is produced. The messages that appear in the job log
contain both the message text and the message help.
*SECLVL Both the message text and the message help (cause and
recovery) of the error message are written to the job log.
LOG_CL_PROGRAM_COMMANDS VARCHAR(4) Specifies whether or not commands are logged for CL programs that
are run.
STATUS_MESSAGE VARCHAR(7) Specifies whether status messages are displayed for this job.
JOB_LOG_OUTPUT VARCHAR(10) Specifies how the job log will be produced when the job completes.
*JOBEND The job log will be produced by the job itself. If the
job cannot produce its own job log, the job log will
be produced by a job log server. For example, a job
does not produce its own job log when the system
is processing a Power Down System (PWRDWNSYS)
command.
*JOBLOGSVR The job log will be produced by a job log server. For
more information about job log servers, refer to the
Start Job Log Server (STRLOGSVR) command.
*PND The job log will not be produced. The job log
remains pending until removed.
JOB_LOG_PENDING VARCHAR(3) Specifies whether there is a job log that has not yet been written. The
writing of the job log may become pending based on the value of the
job log output job attribute when the job completes its activity.
OUTPUT_QUEUE_PRIORITY SMALLINT The output priority for spooled output files that this job produces. The
highest priority is 0, and the lowest is 9.
OUTPUT_QUEUE_LIBRARY VARCHAR(10) The name of the library that contains the default output queue.
OUTPUT_QUEUE_NAME VARCHAR(10) The name of the default output queue that is used for spooled output
produced by this job and the name of the library that contains the
output queue. The default output queue is only for spooled printer
files that specify *JOB for the output queue.
SPOOLED_FILE_ACTION VARCHAR(7) Specifies whether spooled files are accessed through job interfaces
after the job has completed is normal activity.
*DETACH The spooled files are detached from the job when the
job completes its activity.
PRINTER_DEVICE_NAME VARCHAR(10) The printer device used for printing output from this job.
PRINT_KEY_FORMAT VARCHAR(7) Specifies whether border and header information is provided when the
Print key is pressed.
PRINT_TEXT VARCHAR(30) The line of text that is printed at the bottom of each page of printed
output for the job.
Contains the null value if there is no text defined to print at the bottom
of each page.
DEVICE_NAME VARCHAR(10) The name of the device as identified to the system. For an interactive
job it is the device where the job started.
Contains the null value if this is not an interactive job.
DEVICE_RECOVERY_ACTION VARCHAR(13) The action taken for interactive jobs when an I/O error occurs for the
job's requesting program device.
*KEEP The system keeps DDM connections active when there are
no users, except for the following:
• The routing step ends on the source system. The routing
step ends when the job ends or when the job is rerouted
to another routing step.
• The Reclaim Distributed Data Management Conversation
(RCLDDMCNV) command or the Reclaim Resources
(RCLRSC) command runs.
• A communications failure or an internal failure occurs.
• A DRDA connection to an application server not running
on the system ends.
Contains the null value if the job is not using advanced program-to-
program communications (APPC).
UNIT_OF_WORK_ID CHAR(24) The unit of work ID is used to track jobs across multiple systems.
Contains the null value if the job is not associated with a source or
target system using advanced program-to-program communications
(APPC).
Examples
• Find all interactive jobs.
, internal-objects
INTERNAL_OBJECTS =>
)
, ignore-errors
IGNORE_ERRORS =>
job-name A character or graphic string expression that identifies the qualified name of a job. The
special value of '*' indicates the current job.
internal- A character or graphic string expression that indicates whether rows are returned for
objects internal objects.
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 270. JOB_LOCK_INFO table function
LOCK_CATEGORY VARCHAR(23) The type of entity to which this row of lock information applies.
OBJECT_LIBRARY VARCHAR(10) The name of the library containing the locked object.
Contains the null value if LOCK_CATEGORY is INTERNAL or INTERNAL
SPACE LOCATION or if the library name cannot be determined.
OBJECT_TYPE VARCHAR(7) The object type. If the lock is on a database member the object type will be
*FILE.
OBJECT_ATTRIBUTE VARCHAR(10) The extended attribute value for this object's type.
Contains the null value if there is no extended attribute associated with the
object type.
LOCK_STATE VARCHAR(7) The lock condition for the lock request. Lower level locks are returned and
can occur when a member of a file is locked but the file itself is not locked.
Contains the null value if the object is not locked but there are locks on
lower level objects.
Contains the null value if the object is not locked but there are locks on
lower level objects.
LOCK_SCOPE VARCHAR(10) The scope of the lock. Lower level locks are returned and can occur when a
member of a file is locked but the file itself is not locked.
Contains the null value if the object is not locked but there are locks on
lower level objects.
MEMBER_NAME VARCHAR(10) The name of the member that has a lock held or waiting on it. Contains *N if
the member name cannot be determined.
Contains the null value if LOCK_CATEGORY is not MEMBER.
SPACE_LOCATION_LOCK_OFFSET BIGINT A value in bytes to the location in the space that is locked.
Contains the null value if LOCK_CATEGORY is not EXTERNAL SPACE
LOCATION or INTERNAL SPACE LOCATION.
LOCK_SPACE_ID BINARY(20) The identifier of the lock space for which the lock is being waited on.
Contains the null value if LOCK_SCOPE is not LOCK SPACE.
THREAD_ID BIGINT A value which uniquely identifies a thread within a job holding a thread
scope lock or the thread waiting for a lock.
Contain the null value if this lock is not thread scoped.
THREAD_HANDLE INTEGER A value which addresses a particular thread within a job holding a thread
scope lock or the thread waiting for a lock.
Contain the null value if this lock is not thread scoped.
ASP_NAME VARCHAR(10) The name of the Auxiliary Storage Pool (ASP) that contains the object that is
locked.
Contains the null value if the name of the ASP device cannot be determined.
ASP_NUMBER INTEGER The numeric identifier of the ASP containing the locked object.
Contains the null value if the name of the ASP device cannot be determined.
OBJECT_LOCK_HANDLE BINARY(64) An identifier that can be input to Retrieve Lock Information (QWCRLCKI) API
to find additional information about other holders of locks on this object.
Contains the null value if additional information cannot be retrieved.
LOCK_REQUEST_HANDLE BINARY(64) A handle to lock request information. Using the Retrieve Lock Request
Information (QWCRLRQI) API and passing in this handle you can retrieve
additional information about the program that requested this lock.
Contains the null value if additional information cannot be retrieved.
Example
• Retrieve information about locks for the current job.
JOB_QUEUE_ENTRIES view
The JOB_QUEUE_ENTRIES view returns one row for each entry in a job queue.
Authorization: See Note below.
The following table describes the columns in the view. The system name is JOBQ_ENT. The schema is
SYSTOOLS.
Table 271. JOB_QUEUE_ENTRIES view
JOB_QUEUE_LIBRARY JOBQ_LIB VARCHAR(10) The name of the library containing the job queue.
JOB_QUEUE_NAME JOBQ VARCHAR(10) The name of the job queue that the job is currently
on.
JOB_QUEUE_STATUS STATUS VARCHAR(9) The status of this job on the job queue.
JOB_USER JOB_USER VARCHAR(10) The user profile that started the job.
ASJ Autostart
BCH Batch
INT Interactive
PJ Prestart job
SYS System
JOB_TYPE_ENHANCED JOBT_ENH VARCHAR(28) The combined job type and job subtype values.
BATCH_IMMEDIATE Batch
immediate job
BATCH_MRT Batch -
System/36
multiple
requester
terminal (MRT)
job
COMM_PROCEDURE_START_REQUEST Communications
job - procedure
start request job
PRESTART_COMM Prestart
communications
job
JOB_DATE JOB_DATE VARCHAR(10) The date that is assigned to the job, in *ISO format.
The job date remains the same for the duration of
the job unless it is changed by the user. Can also
contain the following special value:
JOB_DESCRIPTION_LIBRARY JOBDLIB VARCHAR(10) The name of the library containing the job
description.
Nullable
Contains the null value if JOB_DESCRIPTION is null.
JOB_DESCRIPTION JOBD VARCHAR(10) The name of the job description used for this job.
SUBMITTER_JOB_NAME SBMJOBNAME VARCHAR(28) The qualified job name of the submitter's job.
SUBMITTER_MESSAGE_QUEUE_LIBRARY SBMMSGQLIB VARCHAR(10) The name of the library containing the message
queue.
Nullable
Contains the null value if the job has no submitter.
SUBMITTER_MESSAGE_QUEUE SBMMSGQ VARCHAR(10) The name of the message queue where the system
sends a completion message when a batch job ends.
Nullable
Contains the null value if the job has no submitter.
SERVER_TYPE SERVERTYPE VARCHAR(30) The type of server represented by the job. See
Server table for a list of server type values.
Nullable
Contains the null value if the job is not part of a
server.
JOB_ENTERED_SYSTEM_TIME ENTER_TIME TIMESTAMP(0) The timestamp for when the job was placed on the
system.
JOB_SCHEDULED_TIME JOB_SCHEDT TIMESTAMP(0) The timestamp for when the job is scheduled to
become active.
Nullable
Contains the null value if this is not a scheduled job.
JOB_END_SEVERITY JOB_ENDSEV INTEGER The message severity level of escape messages that
can cause a batch job to end. The batch job ends
when a request in the batch input stream sends
an escape message, whose severity is equal to or
greater than this value, to the request processing
program.
JOB_QUEUE_PRIORITY JOBQ_PRI INTEGER The scheduling priority of the job compared to other
jobs on the same job queue. The highest priority is 0
and the lowest is 9.
JOB_QUEUE_TIME JOBQ_TIME TIMESTAMP(0) The timestamp when the job was put on the job
queue.
JOB_MESSAGE_QUEUE_MAXIMUM_SIZE MSGQ_MAX INTEGER The maximum size, in megabytes, that the job
message queue can become. The range is 2 to 64.
JOB_MESSAGE_QUEUE_FULL_ACTION MSGQ_FULL VARCHAR(8) The action to take when the message queue is full.
ALLOW_MULTIPLE_THREADS ALWMLTTHD VARCHAR(3) Indicates whether this job allows multiple user
threads. This attribute does not prevent the
operating system from creating system threads in
the job.
JOB_SWITCHES SWITCHES CHAR(8) The current setting of the job switches used by this
job.
Nullable
Contains the null value no job switches are set.
ROUTING_DATA RTGDTA VARCHAR(80) The routing data that is used to determine the
routing entry that identifies the program to start for
Nullable the routing step.
Contains the null value if there is no routing data for
this job.
CCSID CCSID INTEGER The coded character set identifier (CCSID) used for
this job.
Nullable
Contains the null value if no CCSID is defined for this
job.
CHARACTER_IDENTIFIER_CONTROL CHRIDCTL VARCHAR(9) The character identifier control for the job. This
attribute controls the type of CCSID conversion
that occurs for display files, printer files, and panel
groups. The *CHRIDCTL special value must be
specified on the CHRID command parameter on the
create, change, or override command for display
files, printer files, and panel groups before this
attribute will be used.
SORT_SEQUENCE_LIBRARY SRTSEQ_LIB VARCHAR(10) The name or the library that contains the sort
sequence table.
Nullable
Contains the null value if no sort sequence table is
defined for this job or if SORT_SEQUENCE_NAME is
a special value.
SORT_SEQUENCE_NAME SRTSEQ VARCHAR(10) The name of the sort sequence table associated
with this job.
Nullable
Contains the null value if no sort sequence table is
defined for this job.
LANGUAGE_ID LANGID CHAR(3) The language identifier associated with this job.
COUNTRY_ID COUNTRY_ID CHAR(2) The country or region identifier associated with this
job.
DATE_FORMAT DATFMT CHAR(4) The date format used for this job.
DATE_SEPARATOR DATSEP CHAR(1) The date separator used for this job.
TIME_SEPARATOR TIMSEP CHAR(1) The time separator used for this job.
DECIMAL_FORMAT DECFMT VARCHAR(6) The decimal format used for this job.
TIME_ZONE_DESCRIPTION_NAME TIME_ZONE VARCHAR(10) The name of the time zone description that is used
to calculate local job time.
MESSAGE_LOGGING_SEVERITY LOG_SEV INTEGER The severity level that is used in conjunction with
the logging level to determine which error messages
are logged in the job log. The values range from 0
through 99.
MESSAGE_LOGGING_TEXT LOG_TEXT VARCHAR(7) The level of message text that is written in the
job log when a message is logged according to the
logging level and logging severity.
LOG_CL_PROGRAM_COMMANDS LOG_CL VARCHAR(4) Specifies whether or not commands are logged for
CL programs that are run.
STATUS_MESSAGE STATUS_MSG VARCHAR(7) Specifies whether status messages are displayed for
this job.
INQUIRY_MESSAGE_REPLY INQ_REPLY VARCHAR(8) Specifies how the job answers inquiry messages.
BREAK_MESSAGE BREAK_MSG VARCHAR(7) Specifies how this job handles break messages.
JOB_LOG_OUTPUT JOBLOG_OUT VARCHAR(10) Specifies how the job log will be produced when the
job completes.
OUTPUT_QUEUE_PRIORITY OUTQ_PRI INTEGER The output priority for spooled output files that
this job produces. The highest priority is 0, and the
lowest is 9.
OUTPUT_QUEUE_LIBRARY OUTQLIB VARCHAR(10) The name of the library that contains the default
output queue.
OUTPUT_QUEUE_NAME OUTQ VARCHAR(10) The name of the default output queue that is used
for spooled output produced by this job and the
name of the library that contains the output queue.
The default output queue is only for spooled printer
files that specify *JOB for the output queue.
PRINTER_DEVICE_NAME DEV_NAME VARCHAR(10) The printer device used for printing output from this
job.
PRINT_TEXT PRINT_TEXT VARCHAR(30) The line of text that is printed at the bottom of each
page of printed output for the job.
Nullable
Contains the null value if there is no text defined to
print at the bottom of each page.
UNIT_OF_WORK_ID UWID CHAR(24) The unit of work ID is used to track jobs across
multiple systems.
Nullable
Contains the null value if the job is not associated
with a source or target system using advanced
program-to-program communications (APPC).
Note
This function is provided in the SYSTOOLS schema as an example of how to create a view based on
information from a table function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL
source can be extracted and used as a model for building similar helper functions, or to create a
customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces
used to implement the service. To understand the authority requirements, extract the SQL for the service
and examine the implementation.
Example
List all the jobs on the APP1/BATCHJQ job queue.
JOB_QUEUE_LIBRARY JOBQ_LIB VARCHAR(10) The name of the library that contains the job
queue.
SUBSYSTEM_NAME SUB_NAME VARCHAR(10) The name of the subsystem that can receive jobs
Nullable from this job queue.
Contains the null value if this job queue is not
associated with an active subsystem.
SEQUENCE_NUMBER SEQNO INTEGER The job queue entry sequence number. The
Nullable subsystem uses this number to determine the
order in which job queues are processed. Jobs
from the queue with the lowest sequence number
are processed first.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS MAX_JOBS INTEGER The maximum number of jobs that can be active
Nullable at the same time through this job queue entry.
A value of -1 indicates *NOMAX, no maximum
number of jobs is defined.
Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS ACT_JOBS INTEGER The current number of jobs that are active that
Nullable came through this job queue entry.
Contains the null value if this job queue is not
associated with an active subsystem.
OPERATOR_CONTROLLED OPR_CTRL VARCHAR(4) Whether users with job control authority are
allowed to control this job queue and manage
the jobs on the queue. Users have job control
authority if SPCAUT(*JOBCTL) is specified in their
user profile.
AUTHORITY_TO_CHECK ALL_AUTH VARCHAR(7) Whether the user must be the owner of the
queue in order to control the queue by holding or
releasing the queue.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM1 INTEGER The maximum number of priority 1 jobs that can
PRIORITY_1 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM2 INTEGER The maximum number of priority 2 jobs that can
PRIORITY_2 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM3 INTEGER The maximum number of priority 3 jobs that can
PRIORITY_3 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM4 INTEGER The maximum number of priority 4 jobs that can
PRIORITY_4 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM5 INTEGER The maximum number of priority 5 jobs that can
PRIORITY_5 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM6 INTEGER The maximum number of priority 6 jobs that can
PRIORITY_6 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM7 INTEGER The maximum number of priority 7 jobs that can
PRIORITY_7 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM8 INTEGER The maximum number of priority 8 jobs that can
PRIORITY_8 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
MAXIMUM_ACTIVE_JOBS_ MAXIMUM9 INTEGER The maximum number of priority 9 jobs that can
PRIORITY_9 Nullable be active at the same time. A value of -1 indicates
*NOMAX, no maximum number of jobs.
Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_0 ACTIVE0 INTEGER The number of priority 0 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_1 ACTIVE1 INTEGER The number of priority 1 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_2 ACTIVE2 INTEGER The number of priority 2 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_3 ACTIVE3 INTEGER The number of priority 3 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_4 ACTIVE4 INTEGER The number of priority 4 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_5 ACTIVE5 INTEGER The number of priority 5 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_6 ACTIVE6 INTEGER The number of priority 6 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_7 ACTIVE7 INTEGER The number of priority 7 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_8 ACTIVE8 INTEGER The number of priority 8 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
ACTIVE_JOBS_PRIORITY_9 ACTIVE9 INTEGER The number of priority 9 jobs that are active.
Nullable Contains the null value if this job queue is not
associated with an active subsystem.
Example
• Examine the job queues with the largest number of active jobs
MEMORY_POOL ( )
reset_statistics
RESET_STATISTICS =>
reset_statistics A character or graphic string expression that contains a value of YES or NO.
If this parameter has a value of YES, statistics are reset such that the time of this query
execution is used as the new baseline. The columns that contain this statistical data
have names that are prefixed with ELAPSED_. Future invocations of MEMORY_POOL
within this connection will return statistical detail relative to the new baseline. If this
parameter has a value of NO, statistics are not reset for the invocation. If this parameter
is not specified, the default is NO.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 273. MEMORY_POOL table function
SYSTEM_POOL_ID INTEGER The system-related pool identifier for each of the system storage
pools that currently has main storage allocated to it.
POOL_NAME VARCHAR(10) The name of this storage pool. The name may be a number, in which
case it is a private pool associated with a subsystem, or one of the
following special values.
RESERVED_SIZE DECIMAL(10,2) The amount of storage, in megabytes, in the pool reserved for system
use (for example, for save/restore operations).
DEFINED_SIZE DECIMAL(20,2) The size of the pool, in megabytes, as defined in the shared pool,
subsystem description, or system value QMCHPOOL. Contains the null
value for a pool without a defined size.
MAXIMUM_ACTIVE_THREADS INTEGER The maximum number of threads that can be active in the pool at any
one time.
SUBSYSTEM_LIBRARY_NAME VARCHAR(10) The library containing the subsystem name. Contains the null value for
shared pools.
SUBSYSTEM_NAME VARCHAR(10) The subsystem with which this storage pool is associated. Contains
the null value for shared pools.
DESCRIPTION VARCHAR(50) The description of the shared pool. Contains the null value for private
pools or if a description does not exist for a shared pool.
PAGING_OPTION VARCHAR(10) Whether the system will dynamically adjust the paging characteristics
of the storage pool for optimum performance.
ELAPSED_TIME INTEGER The time, in seconds, since the measurement start time.
ELAPSED_DATABASE_FAULTS DECIMAL(10,1) The rate, in page faults per second, of database page faults against
pages containing either database access paths or data.
ELAPSED_NON_DATABASE_FAULTS DECIMAL(10,1) The rate, in page faults per second, of nondatabase page faults
against pages other than those designated as database pages.
ELAPSED_TOTAL_FAULTS DECIMAL(10,1) The rate, in page faults per second, of database faults and non-
database faults.
ELAPSED_DATABASE_PAGES DECIMAL(10,1) The rate, in pages per second, at which database pages are brought
into the storage pool.
ELAPSED_NON_DATABASE_PAGES DECIMAL(10,1) The rate in pages per second at which nondatabase pages are brought
into the storage pool.
ELAPSED_ACTIVE_TO_WAIT DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads from an
active condition to a waiting condition.
ELAPSED_WAIT_TO_INELIGIBLE DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads from a
waiting condition to an ineligible condition.
ELAPSED_ACTIVE_TO_INELIGIBLE DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads from an
active condition to an ineligible condition.
TUNING_PRIORITY INTEGER The priority of the shared storage pool used by the system when
making automatic performance adjustments. Contains the null value
for private pools defined in subsystem descriptions.
TUNING_MINIMUM_SIZE DECIMAL(10,2) The minimum amount of storage to allocate to the shared storage pool
(as a percentage of total main storage). Contains the null value for
private pools defined in subsystem descriptions.
TUNING_MAXIMUM_SIZE DECIMAL(10,2) The maximum amount of storage to allocate to the shared storage
pool (as a percentage of total main storage). Contains the null value
for private pools defined in subsystem descriptions.
TUNING_MINIMUM_FAULTS DECIMAL(10,2) The maximum page faults per second to use as a guideline for the
shared storage pool. Contains the null value for private pools defined
in subsystem descriptions.
TUNING_MAXIMUM_FAULTS DECIMAL(10,2) The minimum page faults per second to use as a guideline for the
shared storage pool. Contains the null value for private pools defined
in subsystem descriptions.
TUNING_THREAD_FAULTS DECIMAL(10,2) The page faults per second for each active thread to use as a guideline
for the shared storage pool. Contains the null value for private pools
defined in subsystem descriptions.
TUNING_MINIMUM_ACTIVITY DECIMAL(10,2) The minimum value that the shared pool's activity level can be set to
by the performance adjuster when the QPFRADJ system value is set to
2 or 3. Contains the null value for private pools defined in subsystem
descriptions.
TUNING_MAXIMUM_ACTIVITY DECIMAL(10,2) The maximum value that the shared pool's activity level can be set to
by the performance adjuster when the QPFRADJ system value is set to
2 or 3. Contains the null value for private pools defined in subsystem
descriptions.
Example
MEMORY_POOL_INFO view
The MEMORY_POOL_INFO view returns one row for every active pool.
The information returned is similar to the detail seen from the Work System Status (WRKSYSSTS)
command. It does not reset the statistical columns; to do this, use the associated table function,
MEMORY_POOL.
Authorization: None required.
The following table describes the columns in the view. The system name is POOL_INFO. The schema is
QSYS2.
Table 274. MEMORY_POOL_INFO view
SYSTEM_POOL_ID POOL_ID INTEGER The system-related pool identifier for each of the system
storage pools that currently has main storage allocated to it.
POOL_NAME POOL_NAME VARCHAR(10) The name of this storage pool. The name may be a number, in
which case it is a private pool associated with a subsystem, or
one of the following special values.
CURRENT_SIZE CURR_SIZE DECIMAL(20,2) The amount of main storage, in megabytes, in the pool.
RESERVED_SIZE RSVD_SIZE DECIMAL(10,2) The amount of storage, in megabytes, in the pool reserved for
system use (for example, for save/restore operations).
DEFINED_SIZE DFND_SIZE DECIMAL(20,2) The size of the pool, in megabytes, as defined in the shared
pool, subsystem description, or system value QMCHPOOL.
Contains the null value for a pool without a defined size.
MAXIMUM_ACTIVE_THREADS MAX_THREAD INTEGER The maximum number of threads that can be active in the pool
at any one time.
CURRENT_THREADS CURR_THRD INTEGER The number of threads currently using the pool.
SUBSYSTEM_LIBRARY_NAME SUBLIB_NAM VARCHAR(10) The library containing the subsystem name. Contains the null
value for shared pools.
Nullable
SUBSYSTEM_NAME SUB_NAME VARCHAR(10) The subsystem with which this storage pool is associated.
Contains the null value for shared pools.
Nullable
DESCRIPTION DESC VARCHAR(50) The description of the shared pool. Contains the null value for
private pools or if a description does not exist for a shared pool.
Nullable
PAGING_OPTION PAGE_OPT VARCHAR(10) Whether the system will dynamically adjust the paging
characteristics of the storage pool for optimum performance.
ELAPSED_TIME ELAP_TIME INTEGER The time, in seconds, since the measurement start time.
ELAPSED_DATABASE_FAULTS ELAP_DBF DECIMAL(10,1) The rate, in page faults per second, of database page faults
against pages containing either database access paths or data.
ELAPSED_NON_DATABASE_FAULTS ELAP_NDBF DECIMAL(10,1) The rate, in page faults per second, of nondatabase page faults
against pages other than those designated as database pages.
ELAPSED_TOTAL_FAULTS ELAP_TOTF DECIMAL(10,1) The rate, in page faults per second, of database faults and
non-database faults.
ELAPSED_DATABASE_PAGES ELAP_DBP DECIMAL(10,1) The rate, in pages per second, at which database pages are
brought into the storage pool.
ELAPSED_NON_DATABASE_PAGES ELAP_NDBP DECIMAL(10,1) The rate in pages per second at which nondatabase pages are
brought into the storage pool.
ELAPSED_ACTIVE_TO_WAIT ELAP_ATW DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads
from an active condition to a waiting condition.
ELAPSED_WAIT_TO_INELIGIBLE ELAP_WTI DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads
from a waiting condition to an ineligible condition.
ELAPSED_ACTIVE_TO_INELIGIBLE ELAP_ATI DECIMAL(10,1) The rate, in transitions per minute, of transitions of threads
from an active condition to an ineligible condition.
TUNING_PRIORITY TUN_PRIOR INTEGER The priority of the shared storage pool used by the system
when making automatic performance adjustments. Contains
Nullable the null value for private pools defined in subsystem
descriptions.
TUNING_MINIMUM_SIZE TUN_MIN_SZ DECIMAL(10,2) The minimum amount of storage to allocate to the shared
storage pool (as a percentage of total main storage). Contains
Nullable the null value for private pools defined in subsystem
descriptions.
TUNING_MAXIMUM_SIZE TUN_MAX_SZ DECIMAL(10,2) The maximum amount of storage to allocate to the shared
storage pool (as a percentage of total main storage). Contains
Nullable the null value for private pools defined in subsystem
descriptions.
TUNING_MINIMUM_FAULTS TUN_MIN_FT DECIMAL(10,2) The maximum page faults per second to use as a guideline
for the shared storage pool. Contains the null value for private
Nullable pools defined in subsystem descriptions.
TUNING_MAXIMUM_FAULTS TUN_MAX_FT DECIMAL(10,2) The minimum page faults per second to use as a guideline
for the shared storage pool. Contains the null value for private
Nullable pools defined in subsystem descriptions.
TUNING_THREAD_FAULTS TUN_THR_FT DECIMAL(10,2) The page faults per second for each active thread to use as a
guideline for the shared storage pool. Contains the null value
Nullable for private pools defined in subsystem descriptions.
TUNING_MINIMUM_ACTIVITY TUN_MIN_AC DECIMAL(10,2) The minimum value that the shared pool's activity level can be
set to by the performance adjuster when the QPFRADJ system
Nullable value is set to 2 or 3. Contains the null value for private pools
defined in subsystem descriptions.
TUNING_MAXIMUM_ACTIVITY TUN_MAX_AC DECIMAL(10,2) The maximum value that the shared pool's activity level can be
set to by the performance adjuster when the QPFRADJ system
Nullable value is set to 2 or 3. Contains the null value for private pools
defined in subsystem descriptions.
Example
OBJECT_LOCK_INFO view
The OBJECT_LOCK_INFO view returns one row for every lock held for every object on the partition in
*SYSBAS and in the current thread's ASP group.
The values returned for the columns in the view are closely related to the values returned by Retrieve
Lock Information API and Retrieve Lock Request Information API. Refer to the APIs for more detailed
information.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the object, and
• *OBJOPR and *READ authority to the database file
The following table describes the columns in the view. The system name is OBJ_LOCK. The schema is
QSYS2.
Table 275. OBJECT_LOCK_INFO view
OBJECT_SCHEMA OSCHEMA VARCHAR(128) The name of the schema containing the object.
SYSTEM_TABLE_MEMBER SYS_MNAME VARCHAR(10) The name of the member that is locked in the file.
Nullable Contains the null value if the lock information is not for a
member.
OBJECT_TYPE OBJTYPE VARCHAR(8) The system object type of the locked object.
SQL_OBJECT_TYPE SQLTYPE VARCHAR(9) The SQL type of the object. Values are:
Nullable • ALIAS
• FUNCTION
• INDEX
• PACKAGE
• PROCEDURE
• ROUTINE
• SEQUENCE
• TABLE
• TRIGGER
• TYPE
• VARIABLE
• VIEW
• XSR
Contains the null value if the object is not an SQL object.
ASP_NUMBER ASPNUM INTEGER The numeric identifier of the ASP containing the object that is
locked. A value of 0 is returned for *SYSBAS.
ASPGRP ASPGRP VARCHAR(10) The name of the ASP device containing the object that is locked.
Can contain the special value of *SYSBAS.
LOCK_STATE LOCK_STATE VARCHAR(7) The lock condition for the object or member.
Nullable Contains the null value when the LOCK_SCOPE column value is
LOCK SPACE.
THREAD_ID THREAD_ID BIGINT The thread that is associated with the lock.
Nullable • If a held lock is job scoped, returns the null value. If a held
lock is thread scoped, contains the identifier for the thread
holding the lock.
• If the scope of the lock is to the lock space and the lock is not
held, contains the identifier of the thread requesting the lock.
• If the lock is requested but not yet available, contains the
identifier of the thread requesting the lock.
LOCK_SPACE_ID LOCKID BINARY(20) When the LOCK_SCOPE column value is LOCK SPACE and the
lock is held, contains the lock space ID value of the lock space
Nullable that holds the lock. If the lock is being waited on by a thread,
contains the lock space ID value for which the lock is being
waited on.
Otherwise, contains the null value.
PROGRAM_LIBRARY_NAME PROGLIB VARCHAR(10) The name of the library containing the program or service
program.
Nullable
Contains the null value if the lock holder information is not
available.
PROGRAM_NAME PROGNAME VARCHAR(10) The name of the program holding the lock. This can be any type
of program object, including objects of type *PGM and *SRVPGM.
Nullable
Contains the null value if the lock holder information is not
available.
Nullable Contains the null value if the lock holder information is not
available or if the program is not an ILE program.
Nullable Contains the null value if the lock holder information is not
available or if the program is not an ILE program.
Nullable Contains the null value if the lock holder information is not
available.
STATEMENT_ID STMTID CHAR(10) The high-level language statement identifier. For a character
representation of a number, the number is right-adjusted and
Nullable padded on the left with zeros (for example, '0000000246').
Contains the null value if the lock holder information is not
available.
MACHINE_INSTRUCTION INSTRUCT INTEGER The current machine instruction number in the program.
Nullable Contains the null value if the lock holder information is not
available or if it is an ILE procedure.
Example
Find all the jobs holding object locks over the SALES table:
OPEN_FILES ( job-name )
JOB_NAME =>
job-name A character or graphic string expression that identifies the qualified name of a job. The
special value of '*' indicates the current job.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 276. OPEN_FILES table function
LIBRARY_NAME VARCHAR(10) The name of the library that contains the open file.
Contains the null value if the file is an inline data file.
FILE_NAME VARCHAR(10) The name of the file that is open. For an unnamed inline data file, contains
the value QINLINE.
LF Logical file
PF Physical file
MEMBER_NAME VARCHAR(10) If FILE_TYPE is physical (PF) or logical (LF), the name of the database
member. If multiple member processing is being performed, the value is
*ALL.
Contains the null value for a DDM file, an inline data file, and a device file.
DEVICE_NAME VARCHAR(10) The name of the last program device used for an I/O operation if FILE_TYPE
is a device file (BSCF, CMNF, DKTF, DSPF, ICFF, MXDF, PRTF, SAVF, or TAPF).
If the file is a spooled file, the value is *SPOOL.
Contains the null value for a device file when no I/O operation has been
performed, a database physical or logical file, a DDM file, and an inline data
file.
RECORD_FORMAT VARCHAR(10) The name of the last record format that was used for an I/O operation to the
file.
Contains the null value if no record format name was used or no I/O
operations have been performed.
ACTIVATION_GROUP_NAME VARCHAR(10) The name of the activation group to which the open file is scoped.
Contains the null value for a file scoped to the job, not a specific activation
group.
ACTIVATION_GROUP_NUMBER INTEGER The number of the activation group to which the open file is scoped.
Contains the null value for a file scoped to the job, not a specific activation
group.
THREAD_ID BIGINT The thread handle assigned by the system which identifies the thread in
which the file was opened.
ALL The file was opened for all operations (input, output, update,
and delete).
SHARED_OPENS BIGINT The number of times the file was opened for shared processing.
Contains the null value for open operations that are not shared.
WRITE_COUNT BIGINT The number of successful write operations. If record blocking is not in effect
for the file, this is the number of records. If record blocking is in effect for
the file, this is the number of record blocks.
READ_COUNT BIGINT Number of successful read operations. If record blocking is not in effect for
the file, this is the number of records. If record blocking is in effect for the
file, this is the number of record blocks.
RELATIVE_RECORD_NUMBER BIGINT Relative record number of the last record referred to by an I/O or open
operation for database files.
Contains the null value for nondatabase files and database files on which no
I/O operations have been performed.
IASP_NAME VARCHAR(10) The auxiliary storage pool (ASP) device name where the library is stored.
If the library is in the system ASP or one of the basic user ASPs, contains
*SYSBAS.
Contains the null value if the file is an inline data file or if the name of the
ASP device cannot be determined.
IASP_NUMBER INTEGER The number of the auxiliary storage pool (ASP) from which the system
allocates storage for the library.
Contains the null value if the file is an inline data file or if the number of the
ASP device cannot be determined.
Example
• List all the database files that are open for job 429467/QUSER/QZDASOINIT.
PRESTART_JOB_INFO view
The PRESTART_JOB_INFO view returns information about prestart jobs.
The values returned for the columns in the view are closely related to the values returned by the Display
Prestart Job Entries panel accessed through the DSPSBSD (Display Subsystem Description) CL command
and by the List Subsystem Entries (QWDLSBSE) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the subsystem description, and
• *USE authority to the subsystem description.
The following table describes the columns in the view. The system name is PREJ_INFO. The schema is
QSYS2.
Table 277. PRESTART_JOB_INFO view
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
PRESTART_JOB_PROGRAM_LIBRARY PJ_PGM_LIB VARCHAR(10) The name of the library in which the prestart job
program resides.
SUBSYSTEM_ACTIVE SBS_ACTIVE VARCHAR(3) Whether the subsystem for this prestart job is
active.
USER_PROFILE USRPRF VARCHAR(10) The name of the user profile under which the
prestart job runs.
JOB_DESCRIPTION_LIBRARY JOBDLIB VARCHAR(10) The name of the library in which the job
description for the prestart job entry resides.
Nullable
Contains the null value if JOB_DESCRIPTION is
*USRPRF.
JOB_DESCRIPTION JOBD VARCHAR(10) The name of the job description that is used for
the prestart job entry. Can contain the following
special value:
START_JOBS START_JOBS VARCHAR(3) Whether the prestart jobs are started at the time
the subsystem is started.
INITIAL_JOBS INIT_JOBS INTEGER The initial number of prestart jobs that are started
when the subsystem is started.
THRESHOLD THRESHOLD INTEGER The number at which additional prestart jobs are
started. When the pool of available jobs (jobs
available to service a program start request) is
reduced below this number, more jobs (specified
by ADDITIONAL_JOBS) are started and added to
the available pool. This number is checked after
a prestart job is attached to a procedure start
request.
ADDITIONAL_JOBS ADD_JOBS INTEGER The additional number of prestart jobs that are
started when the number of prestart jobs drops
below the value of THRESHOLD.
MAXIMUM_JOBS MAX_JOBS INTEGER The maximum number of prestart jobs that can be
active at the same time for this prestart job entry.
A value of -1 indicates *NOMAX.
POOL_ID POOL_ID INTEGER The subsystem pool in which the prestart jobs will
run.
CLASS_LIBRARY CLASS1_LIB VARCHAR(10) The name of the library in which the first class
resides.
CLASS CLASS1 VARCHAR(10) The name of the first class that the prestart jobs
run under. Jobs start by using the first class that
is specified until the number of jobs specified for
the first class is reached. After the number of jobs
that are specified for the first class is reached,
then jobs are started by using the second class.
CLASS_JOBS CLASS1_JOB INTEGER The maximum number of jobs to run using the
first class. Can contain the following special
values:
CLASS2_LIBRARY CLASS2_LIB VARCHAR(10) The name of the library in which the second class
resides.
Nullable
Contains the null value if only one class is used.
CLASS2 CLASS2 VARCHAR(10) The second class that the prestart jobs run under.
CLASS2_JOBS CLASS2_JOB INTEGER The maximum number of jobs to run using the
second class. Can contain the following special
Nullable values:
RESOURCES_AFFINITY_GROUP RAG VARCHAR(3) Specifies whether the prestart jobs started by this
entry are grouped together having affinity to the
same set of processors and memory.
Example
• List all the prestart job entries in the QUSRWRK subsystem.
SELECT *
FROM QSYS2.PRESTART_JOB_INFO
WHERE SUBSYSTEM_DESCRIPTION_LIBRARY = 'QSYS' AND
SUBSYSTEM_DESCRIPTION = 'QUSRWRK';
prestart-job-program-library ,
PRESTART_JOB_PROGRAM_LIBRARY =>
prestart-job-program
PRESTART_JOB_PROGRAM =>
, reset-statistics
RESET_STATISTICS =>
)
, ignore-errors
IGNORE_ERRORS =>
subsystem- A character or graphic string expression that contains the name of the active
name subsystem that contains the prestart job entry.
prestart-job- A character or graphic string expression that contains the name of the library where
program-library prestart-job-program is located. Can contain the following special values:
prestart-job- A character or graphic string expression that contains the name of the program that
program identifies the active prestart job entry.
reset-statistics A character or graphic string expression that contains a value of YES or NO to indicate
whether the statistical information should be reset. If this parameter is not specified,
the default is NO.
If the value is YES, the statistics are reset after the information is gathered. The
reset applies to the statistics shown by the Display Active Prestart Jobs (DSPACTPJ)
command as well.
ignore-errors A character or graphic string expression that identifies what to do when an error is
encountered.
NO An error is returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 278. PRESTART_JOB_STATISTICS view
SUBSYSTEM_NAME VARCHAR(10) The name of the active subsystem that contains the prestart job entry.
PRESTART_JOB_PROGRAM_LIBRARY VARCHAR(10) The library where the prestart job program is located.
PRESTART_JOB_PROGRAM VARCHAR(10) The program that identifies the active prestart job entry.
STATUS_TIMESTAMP TIMESTAMP The date and time this active prestart jobs status information was collected.
ELAPSED_TIME INTEGER The time that has elapsed, in seconds, since the last reset date/time.
The value will not reflect elapsed time beyond 10,000 hours. A value of 0
might mean that the elapsed time could not be calculated.
CURRENT_JOBS INTEGER The current number of active jobs associated with the prestart job entry.
AVERAGE_JOBS DECIMAL(10,1) The average number of jobs that have been active since the reset date/time.
This value is based on calculations involving time intervals and is inaccurate if
the system clock was changed while information is being collected.
This value will be recalculated after statistics are reset.
PEAK_JOBS INTEGER The maximum number of jobs that have been active since the reset date/
time.
This value will be recalculated after statistics are reset.
AVERAGE_INUSE_JOBS DECIMAL(10,1) The average number of jobs in use since the reset date/time. This value is
based on calculations involving time intervals and is inaccurate if the system
clock was changed while information is being collected.
This value will be recalculated after statistics are reset.
PEAK_INUSE_JOBS INTEGER The maximum number of jobs in use since the reset date/time.
This value will be recalculated after statistics are reset.
CURRENT_WAIT_REQUESTS INTEGER The number of requests that are waiting for a prestart job.
AVERAGE_WAIT_REQUESTS DECIMAL(10,1) The average number of requests that have waited for a prestart job since the
reset date/time. This value is based on calculations involving time intervals
and is inaccurate if the system clock was changed while information is being
collected.
This value will be recalculated after statistics are reset.
PEAK_WAIT_REQUESTS INTEGER The maximum number of requests that have waited at one time for an
available prestart job since the reset date/time.
This value will be recalculated after statistics are reset.
AVERAGE_WAIT_TIME DECIMAL(10,1) The average time, in seconds, that requests have waited to be attached to a
prestart job since the reset date/time. This includes requests that wait and
requests that do not wait. This value is based on calculations involving time
intervals and is inaccurate if the system clock was changed while information
is being collected.
This value will be recalculated after statistics are reset.
ACCEPTED_REQUESTS INTEGER The total number of accepted requests since the reset date/time. An
accepted request is one that is either attached immediately to a prestart
job, or is queued because a prestart job is not available.
This value will be recalculated after statistics are reset.
REJECTED_REQUESTS INTEGER The total number of rejected requests since the reset date/time. A request is
rejected if
• *NO is specified for the WAIT parameter on the prestart job entry and
there are no jobs currently available to handle the request.
• *YES is specified for the WAIT parameter and there are more program
start requests than the maximum jobs allowed.
This value will be recalculated after statistics are reset.
Example
List the current statistics for all prestart jobs in the QUSRWRK subsystem. A warning will be issued for
each prestart job returned from PRESTART_JOB_INFO that is not active.
RECORD_LOCK_INFO view
The RECORD_LOCK_INFO view returns one row for every record lock for the partition.
The values returned for the columns in the view are closely related to the values returned by Retrieve
Record Locks API. Refer to the APIs for more detailed information.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the database file, and
• *OBJOPR and *READ authority to the database file
The following table describes the columns in the view. The system name is RCD_LOCK. The schema is
QSYS2.
Table 279. RECORD_LOCK_INFO view
TABLE_PARTITION TABPART VARCHAR(128) Name of the table partition or member that contains the locked
record.
SYSTEM_TABLE_MEMBER SYS_MNAME VARCHAR(10) The name of the member that contains the locked record.
RELATIVE_RECORD_NUMBER RRN BIGINT The relative record number (RRN) of the record that is locked.
THREAD_ID THREAD_ID BIGINT The thread that is associated with the lock.
Nullable • If a held lock is job scoped, returns the null value. If a held
lock is thread scoped, contains the identifier for the thread
holding the lock.
• If the scope of the lock is to the lock space and the lock is not
held, contains the identifier of the thread requesting the lock.
• If the lock is requested but not yet available, contains the
identifier of the thread requesting the lock.
LOCK_SPACE_ID LOCKID BINARY(20) When the LOCK_SCOPE column value is LOCK SPACE and the
lock is being waited on by a thread, contains the lock space ID
Nullable value for which the lock is being waited on.
Otherwise, contains the null value.
Example
Review the jobs that are updating the SALES table:
REMOVE_TRACKED_JOB_QUEUE procedure
The REMOVE_TRACKED_JOB_QUEUE procedure removes a job queue from the tracked job queue list.
All information associated with the specified job queue is removed from the job tracking file.
Unless ignore-errors is YES, the tracking file's IASP must be in the caller's namespace or it must
be the name of an IASP that does not exist. The IASP for the tracking file was specified on the
QSYS2.ADD_TRACKED_JOB_QUEUE procedure with the tracking-file-iasp parameter. It is returned in the
TRACKING_FILE_IASP column of the QSYS2.TRACKED_JOB_QUEUES view.
Authorization: The caller must have *JOBCTL special authority.
REMOVE_TRACKED_JOB_QUEUE ( iasp-name ,
IASP_NAME =>
job-queue-library ,
JOB_QUEUE_LIBRARY =>
job-queue
JOB_QUEUE =>
)
, ignore-errors
IGNORE_ERRORS =>
iasp-name A character string that contains the name of the ASP where job-queue-library is located.
Can contain the following special value:
*SYSBAS The job queue library is located in the system ASP (ASP 1) or any basic user
ASPs (ASPs 2-32).
NO An error is returned, and the job queue is not removed from tracking. This is the
default.
YES A warning is returned.
The job queue will be removed from tracking without removing associated
information from the job tracking file.
Example
• Remove job queue APPLIB/APPJOBQ from the list of tracked job queues.
ROUTING_ENTRY_INFO view
The ROUTING_ENTRY_INFO view returns information about routing entries.
The values returned for the columns in the view are closely related to the values returned by the Display
Routing Entries panel accessed through the DSPSBSD (Display Subsystem Description) CL command and
by the List Subsystem Entries (QWDLSBSE) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the subsystem description, and
• *USE authority to the subsystem description.
The following table describes the columns in the view. The system name is RTG_INFO. The schema is
QSYS2.
Table 280. ROUTING_ENTRY_INFO view
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
PROGRAM_LIBRARY PGM_LIB VARCHAR(10) The name of the library in which the routing entry
program resides.
Nullable
Contains the null value if PROGRAM_NAME is
*RTGDTA.
PROGRAM_NAME PGM_NAME VARCHAR(10) The name of the program that is started when a
routing step is started through this routing entry.
Can contain the following special value:
CLASS_LIBRARY CLASS_LIB VARCHAR(10) The name of the library in which the routing entry
class resides.
CLASS CLASS VARCHAR(10) The name of the class that is used when a routing
step is started through this routing entry.
POOL_ID POOL_ID INTEGER The pool identifier of the storage pool in which the
routing entry program is run.
COMPARISON_DATA COMPDATA VARCHAR(80) A value that is compared with the routing data to
determine whether this is the routing entry that is
used for starting a routing step. Can contain the
following special value:
COMPARISON_START COMP_START INTEGER The starting position for the routing data
comparison. The comparison between the
Nullable compare value and the routing data begins with
this position in the routing data character string,
and the last character position compared must be
less than or equal to the length of the routing data
used in the comparison.
Contains the null value when COMPARISON_DATA
is *ANY.
RESOURCES_AFFINITY_GROUP RAG VARCHAR(3) Specifies whether jobs using this routing entry are
grouped together having affinity to the same set
of processors and memory.
Example
• List all the routing entries defined for the QBATCH subsystem.
SELECT *
FROM QSYS2.ROUTING_ENTRY_INFO
WHERE SUBSYSTEM_DESCRIPTION_LIBRARY = 'QSYS' AND
SUBSYSTEM_DESCRIPTION = 'QBATCH';
SCHEDULED_JOB_INFO view
The SCHEDULED_JOB_INFO view returns information that can also be seen through the Work with Job
Schedule Entries (WRKJOBSCDE) command interface. Each job schedule entry contains the information
to automatically submit a batch job once or at regularly scheduled intervals.
Authorization: No authority is required to access scheduled job rows. Some columns return the null value
if the caller does not have the required authority. The caller must have *JOBCTL special authority or be
the user profile listed in the SCHEDULED_BY column to see the data in all columns.
The following table describes the columns in the view. The system name is SCHED_JOB. The schema is
QSYS2.
Table 281. SCHEDULED_JOB_INFO view
System Column
Column Name Name Data Type Description
SCHEDULED_JOB_ENTRY_NUMBER ENTRYNO INTEGER The number assigned to the job schedule entry when the entry is
added to the job schedule.
System Column
Column Name Name Data Type Description
SCHEDULED_DATE_VALUE SCDDATEV VARCHAR(14) Indicates the date on which the job is scheduled to be submitted.
SCHEDULED_DATE SCDDATE DATE The date on which the job is scheduled to be submitted.
SCHEDULED_TIME SCDTIME TIME The time when the job is scheduled to be submitted on the
scheduled date.
SCHEDULED_DAYS SCDDAYS VARCHAR(34) The days on which the job is submitted if a specific date is not
specified.
Nullable
The value is a comma separated string with any or all of the values:
*MON *TUE *WED *THU *FRI *SAT *SUN. The single value of *ALL
can be returned to represent all seven values.
Contains the null value if SCHEDULED_DATE_VALUE is not
SCHEDULED_DAYS.
RELATIVE_DAYS_OF_MONTH RELDAYSMON VARCHAR(13) Specifies which occurrence during the month (for the days listed in
the SCHEDULED_DAYS column) the job is scheduled to be run. The
Nullable value is a comma separated string with up to five of the following
values:
*LAST The job is scheduled for the last occurrence of the day or
days of the month.
Contains the null value if the FREQUENCY column does not have a
value of MONTHLY or SCHEDULED_DAYS is null.
RECOVERY_ACTION RECOVERY VARCHAR(7) The recovery action taken when the system is powered down or in
the restricted state at the time a job is scheduled to be submitted.
System Column
Column Name Name Data Type Description
NEXT_SUBMISSION_DATE NXTSUBDATE DATE The next date that the job scheduling process is scheduled to submit
this job.
Nullable
Contains the null value if the job is not scheduled to be submitted
again.
JOB_QUEUE_NAME JOBQ VARCHAR(10) The job queue to which the job is scheduled to be
submitted. Can contain the special value of *JOBD, meaning
that the job is submitted to the job queue specified in the
job description listed in the JOB_DESCRIPTION_NAME and
JOB_DESCRIPTION_LIBRARY_NAME columns.
Nullable HLD The job queue is held, but not attached to an active
subsystem.
DATES_OMITTED OMITDATES VARCHAR(219) A comma separated string with up to 20 dates in *ISO format
indicating dates when the job will not be scheduled to run.
Nullable
Contains the null value if no dates were specified to omit or if the
information is not available.
SCHEDULED_BY CREATEDBY VARCHAR(10) The user profile of the job which added the entry to the job schedule.
DESCRIPTION TEXT VARCHAR(50) The descriptive text for the job schedule entry.
Nullable Contains the null value if the job schedule entry has no description.
COMMAND_STRING COMMAND VARCHAR(512) The command that is run in the submitted job.
USER_PROFILE_FOR_SUBMITTED_JOB SBMJOBUSR VARCHAR(10) The user profile to be used when the job is submitted. Can contain
the special value *JOBD to indicate that the user profile from the job
Nullable description is used.
Contains the null value if the information is not available.
JOB_DESCRIPTION_NAME JOBD VARCHAR(10) The job description used when the job is submitted. Can contain
the special value of *USRPRF to indicate that the job description
Nullable specified in the user profile under which the submitted job runs is
used.
Contains the null value if the information is not available.
System Column
Column Name Name Data Type Description
MESSAGE_QUEUE_NAME MSGQ VARCHAR(10) The name of the message queue where the messages for this job
schedule entry are sent. Can contain the special value *USRPRF to
Nullable indicate that the message queue specified in the user profile under
which the submitted job runs is used.
Contains the null value is no specific message queue is associated
with this job schedule entry or if the information is not available.
LAST_SUCCESSFUL_SUBMISSION_ SBMTIMSTMP TIMESTAMP(0) The timestamp when a batch job was last successfully submitted for
TIMESTAMP the job schedule entry.
Nullable
Contains the null value if the job schedule entry has not been used
to submit a job.
LAST_SUCCESSFUL_SUBMISSION_JOB LASTSBMJOB VARCHAR(28) The qualified job name used when this scheduled job was last
submitted.
Nullable
Contains the null value if the scheduled job has never been
submitted or if the information is not available.
LAST_ATTEMPTED_SUBMISSION_ ATTSBMTIM TIMESTAMP(0) The timestamp when this scheduled job was last submitted.
TIMESTAMP Nullable Contains the null value if the scheduled job has never been
submitted or if the information is not available.
LAST_ATTEMPTED_SUBMISSION_STATUS SBMJOBSTS VARCHAR(68) The status from when this scheduled job was last submitted. Values
are:
Nullable
• JOB SUCCESSFULLY SUBMITTED
• LAST JOB SUBMISSION FAILED, CHECK THE JOB MESSAGE
QUEUE FOR DETAILS
• JOB NOT SUBMITTED DUE TO HELD STATUS
• JOB SUBMITTED AFTER SCHEDULED TIME AS SPECIFIED BY
RECOVERY ACTION
• JOB NOT SUBMITTED AS SPECIFIED BY RECOVERY ACTION
Contains the null value if the scheduled job has never been
submitted or if the information is not available.
KEEP_ENTRY KEEP VARCHAR(3) Whether the job schedule entry is kept or removed after the job has
been submitted.
Nullable
YES The job schedule entry is kept.
Contains the null value when the FREQUENCY column does not
contain *ONCE or if the information is not available.
Example
Review the job scheduled entries which are no longer in effect, either because they were explicitly held or
because they were scheduled to run a single time and the scheduled date and time has passed.
SUBSYSTEM_INFO view
The SUBSYSTEM_INFO view returns information about all subsystems.
The values returned for the columns in the view are closely related to the values returned by the WRKSBS
(Work with Subsystems) CL command and by the Retrieve Subsystem Information (QWDRSBSD) API.
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
MAXIMUM_ACTIVE_JOBS MAX_ACT INTEGER The maximum number of jobs that can run or use
resources in the subsystem at one time.
Nullable
Contains the null value if the subsystem
description specifies *NOMAX, indicating that
there is no maximum.
SUBSYSTEM_MONITOR_JOB SBSMONJOB VARCHAR(28) The qualified job name for the subsystem monitor
job as identified to the system.
Nullable
Contains the null value if STATUS is INACTIVE.
WORKLOAD_GROUP WRK_GROUP VARCHAR(10) The name of the workload group used for jobs
started in this subsystem.
Nullable
Contains the null value if there is no workload
group defined for the subsystem.
SIGNON_DEVICE_FILE_LIBRARY DEVFILELIB VARCHAR(10) The name of the library in which the sign-on
device file resides.
IASP_NAME IASP_NAME VARCHAR(10) The name of the auxiliary storage pool (ASP)
group associated with the subsystem monitor job.
Nullable This is the name of the primary ASP device in
an ASP group or the name of an ASP device
description.
Contains the null value if the subsystem does
not have an auxiliary storage pool (ASP) group
associated with it. Only the libraries in the system
ASP and any basic user ASPs will be in the library
name space for the subsystem monitor job.
Example
• Show information for all active subsystems.
SELECT *
FROM QSYS2.SUBSYSTEM_INFO
WHERE STATUS = 'ACTIVE';
SUBSYSTEM_POOL_INFO view
The SUBSYSTEM_POOL_INFO view returns information about storage pools defined for subsystems.
The values returned for the columns in the view are closely related to the values returned by the WRKSBS
(Work with Subsystems) CL command and by the Retrieve Subsystem Information (QWDRSBSD) API.
Authorization: The caller must have:
• *EXECUTE authority to the library containing the subsystem description, and
• *USE authority to the subsystem description.
The following table describes the columns in the view. The system name is SBS_POOL. The schema is
QSYS2.
Table 283. SUBSYSTEM_POOL_INFO view
SUBSYSTEM_DESCRIPTION_LIBRARY SBSD_LIB VARCHAR(10) The name of the library in which the subsystem
description resides.
SUBSYSTEM_DESCRIPTION SBSD VARCHAR(10) The name of the subsystem about which pool
information is being returned.
Example
• List all the system storage pools in the QBATCH subsystem.
SELECT *
FROM QSYS2.SUBSYSTEM_POOL_INFO
WHERE SUBSYSTEM_DESCRIPTION_LIBRARY = 'QSYS' AND
SUBSYSTEM_DESCRIPTION = 'QBATCH' AND
POOL_NAME <> '*USERPOOL';
SYSTEM_ACTIVITY_INFO ( )
delay-seconds
DELAY_SECONDS =>
delay- An integer value that specifies an interval of time to wait between statistical readings. Detail
seconds gathered from two points in time is used to calculate the table function results.
The result of the function is a table containing a single row with the format shown in the following table.
All the columns are nullable.
Table 284. SYSTEM_ACTIVITY_INFO table function
AVERAGE_CPU_UTILIZATION DECIMAL(20,2) The average CPU utilization for all the active
processors.
MINIMUM_CPU_UTILIZATION DECIMAL(20,2) The CPU utilization of the processor that reported the
minimum amount of CPU utilization.
MAXIMUM_CPU_UTILIZATION DECIMAL(20,2) The CPU utilization of the processor that reported the
maximum amount of CPU utilization.
Example
Return statistical CPU information. Use the default one second interval.
SYSTEM_STATUS (
reset-statistics
RESET_STATISTICS =>
)
, detailed-info
DETAILED_INFO =>
detailed- A character or graphic string expression that indicates the type of information to be
info returned.
The result of the function is a table containing multiple rows with the format shown in the following table.
All the columns are nullable.
Table 285. SYSTEM_STATUS table function
TOTAL_JOBS_IN_SYSTEM INTEGER The total number of user and system jobs that are
currently in the system. The total includes:
• All jobs on job queues waiting to be processed.
• All jobs currently active (being processed).
• All jobs that have completed running but still have
output on output queues to be produced.
ACTIVE_JOBS_IN_SYSTEM INTEGER The number of jobs active in the system (jobs that have
been started, but have not yet ended), including both
user and system jobs.
JOBS_DISCONNECTED INTEGER The number of jobs that have been disconnected due
to either the selection of option 80 (Temporary sign-
off) or the entry of the Disconnect Job (DSCJOB)
command.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
JOBS_SUSPENDED_BY_SYSREQ INTEGER The number of user jobs that have been temporarily
suspended by system request jobs so that another job
may be run.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
JOBS_SUSPENDED_BY_GROUP_JOB INTEGER The number of user jobs that have been temporarily
suspended by group jobs so that another job may be
run.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
JOBS_PRINT_WAITING INTEGER The number of sessions that have ended with printer
output files waiting to print.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_WAITING_TO_RUN INTEGER The number of batch jobs on the system that are
currently waiting to run, including those that were
submitted to run at a future date and time. Jobs on
the job schedule that have not been submitted are not
included.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_ENDING INTEGER The number of batch jobs that are in the process of
ending due to one of the following conditions:
• The job finished processing normally.
• The job ended before its normal completion point
and is being removed from the system.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_HELD_WHILE_RUNNING INTEGER The number of batch jobs that had started running, but
are now held.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_HELD_ON_JOBQ INTEGER The number of batch jobs that were submitted, but
were held before they could begin running.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_ON_HELD_JOBQ INTEGER The number of batch jobs on job queues that have
been assigned to a subsystem, but are being held.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
BATCH_ON_UNASSIGNED_JOBQ INTEGER The number of batch jobs on job queues that have not
been assigned to a subsystem.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
ELAPSED_TIME INTEGER The time that has elapsed, in seconds, between the
measurement start time and the current system time.
ELAPSED_CPU_USED DECIMAL(10,2) The average of the elapsed time during which the
processing units were in use.
AVAILABLE_JOB_TABLE_ENTRIES INTEGER The total number of job table entries that are available.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
IN_USE_JOB_TABLE_ENTRIES INTEGER The total number of job table entries that are
in use. This includes ACTIVE_JOB_TABLE_ENTRIES,
JOBQ_JOB_TABLE_ENTRIES,
OUTQ_JOB_TABLE_ENTRIES, and
JOBLOG_PENDING_JOB_TABLE_ENTRIES.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
ACTIVE_JOB_TABLE_ENTRIES INTEGER The total number of entries that are in use by active
jobs.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
JOBQ_JOB_TABLE_ENTRIES INTEGER The total number of entries that are in use by jobs on a
JOBQ.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
OUTQ_JOB_TABLE_ENTRIES INTEGER The total number of entries that are in use by jobs that
have ended but have spooled output still attached to
the job.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
JOBLOG_PENDING_JOB_TABLE_ENTRIES INTEGER The total number of entries that are in use by jobs that
have ended but have a pending job log.
Contains the null value when the DETAILED_INFO
parameter is BASIC.
PARTITION_ID INTEGER The identifier for the partition in which this view is
being run.
The columns from PARTITION_NAME through UNUSED_CPU_TIME_SHARED_POOL require the user to have *USE authority on the QSYS/QPMLPMGT
service program. Otherwise, they will contain the null value.
PARTITION_NAME VARGRAPHIC(255) CCSID 1200 The name of the partition as it is known to the HMC.
DEFINED_VARIABLE_CAPACITY_WEIGHT INTEGER The weighting factor that was configured for this
partition through the HMC. Variable capacity weight
is used for uncapped partitions when they compete
for unused CPU cycles in the shared pool. Variable
capacity weight can be in the range of 0 - 255. The
larger the weight, the more the chance this partition
will get additional CPU cycles from the shared pool.
Contains the null value if the
DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
ACCESS_PATH_ ESTIMATED_ INTEGER The amount of time, in minutes, that the system will
RECOVERY_TIME take to recover the access paths on the system during
initial program load (IPL) and during the vary on of all
currently available independent storage pools (IASPs).
This value assumes that all access paths that are
protected are recovered at IPL or during vary on of
IASPs.
The estimated system access path recovery time is
influenced by SMAPP_INCLUDE_ACCESS_PATHS.
• If SMAPP_INCLUDE_ACCESS_PATHS is *ELIGIBLE,
this value is the estimated system access path
recovery time of all the eligible access paths that
are not chosen for protection.
• If SMAPP_INCLUDE_ACCESS_PATHS is *ALL, this
value is the estimated system access path recovery
time of all the eligible access paths that are not
chosen for protection plus all the access paths that
are not eligible for protection.
Contains the null value when
ACCESS_PATH_RECOVERY_TIME is *OFF or if the user
does not have *JOBCTL special authority.
ACCESS_PATH_ESTIMATED_INELIGIBLE_ INTEGER The total time, in minutes, that it will take to recover
RECOVERY_TIME all access paths which are not eligible for system-
managed access path protection.
Contains the null value when
ACCESS_PATH_RECOVERY_TIME is *OFF or if the user
does not have *JOBCTL special authority.
Example
Return storage and CPU status for the partition. Specify to reset all the elapsed values to 0.
SYSTEM_STATUS_INFO view
The SYSTEM_STATUS_INFO view returns a single row containing details about the current partition. This
view uses the QSYS2.SYSTEM_STATUS table function with DETAILED_INFO => 'ALL'.
For better performance, use SYSTEM_STATUS_INFO_BASIC except when the additional job table columns
returned by SYSTEM_STATUS_INFO are needed by the query.
The information returned is similar to the detail seen from the Work with System Status (WRKSYSSTS)
and the Work with System Activity (WRKSYSACT) commands, information available in the HMC and with
the Retrieve Partition Information (dlpar_get_info) API, and journal attribute values. It does not reset the
statistical columns; to do this, use the associated table function, “SYSTEM_STATUS table function” on
page 1100.
Authorization: To see non-null values for the columns from PARTITION_NAME through
UNUSED_CPU_TIME_SHARED_POOL, the caller must have *USE authority to the QSYS/QPMLPMGT service
program.
To return values for TEMPORARY_JOB_STRUCTURES_AVAILABLE and
PERMANENT_JOB_STRUCTURES_AVAILABLE, the caller must have:
• *JOBCTL special authority, and
• *USE authority to the QSYS/QWTCTJBS program.
The following table describes the columns in the view. The system name is SYS_STATUS. The schema is
QSYS2.
Table 286. SYSTEM_STATUS_INFO view
TOTAL_JOBS_IN_SYSTEM TOTAL_JOBS INTEGER The total number of user and system jobs that are currently in
the system. The total includes:
• All jobs on job queues waiting to be processed.
• All jobs currently active (being processed).
• All jobs that have completed running but still have output on
output queues to be produced.
MAXIMUM_JOBS_IN_SYSTEM MAX_JOBS INTEGER The maximum number of jobs that are allowed on the system.
When the number of jobs reaches this maximum, you can no
longer submit or start more jobs on the system. The total
includes:
• All jobs on job queues waiting to be processed.
• All jobs currently active (being processed).
• All jobs that have completed running but still have output on
output queues to be produced.
ACTIVE_JOBS_IN_SYSTEM ACT_JOBS INTEGER The number of jobs active in the system (jobs that have been
started, but have not yet ended), including both user and system
jobs.
JOBS_SIGNED_ON JOBS_ON INTEGER The number of jobs currently signed on the system. System
request jobs and group jobs are not included in this number.
JOBS_DISCONNECTED JOBS_DSC INTEGER The number of jobs that have been disconnected due to either
the selection of option 80 (Temporary sign-off) or the entry of the
Disconnect Job (DSCJOB) command.
JOBS_SUSPENDED_BY_SYSREQ JOBS_SYSRQ INTEGER The number of user jobs that have been temporarily suspended
by system request jobs so that another job may be run.
JOBS_SUSPENDED_BY_GROUP_JOB JOBS_GRP INTEGER The number of user jobs that have been temporarily suspended
by group jobs so that another job may be run.
JOBS_PRINT_WAITING JOBS_PRT INTEGER The number of sessions that have ended with printer output files
waiting to print.
BATCH_RUNNING BATCH_RUN INTEGER The number of batch jobs currently running on the system.
BATCH_WAITING_TO_RUN BATCH_WAIT INTEGER The number of batch jobs on the system that are currently
waiting to run, including those that were submitted to run at a
future date and time. Jobs on the job schedule that have not
been submitted are not included.
BATCH_ENDING BATCH_END INTEGER The number of batch jobs that are in the process of ending due to
one of the following conditions:
• The job finished processing normally.
• The job ended before its normal completion point and is being
removed from the system.
BATCH_MESSAGE_WAIT BATCH_MSGW INTEGER The number of batch jobs waiting for a reply to a message before
they can continue to run.
BATCH_HELD_WHILE_RUNNING BATCH_RHLD INTEGER The number of batch jobs that had started running, but are now
held.
BATCH_HELD_ON_JOBQ BATCH_SHLD INTEGER The number of batch jobs that were submitted, but were held
before they could begin running.
BATCH_ON_HELD_JOBQ BATCH_JHLD INTEGER The number of batch jobs on job queues that have been assigned
to a subsystem, but are being held.
BATCH_ON_UNASSIGNED_JOBQ BATCH_NOS INTEGER The number of batch jobs on job queues that have not been
assigned to a subsystem.
BATCH_PRINT_WAITING BATCH_PRT INTEGER The number of completed batch jobs that produced printer
output that is waiting to print.
ELAPSED_TIME ELAP_TIME INTEGER The time that has elapsed, in seconds, between the
measurement start time and the current system time.
ELAPSED_CPU_USED ELAP_USED DECIMAL(5,2) The average of the elapsed time during which the processing
units were in use.
ELAPSED_CPU_SHARED ELAP_SHARE DECIMAL(5,2) The percentage of the total shared processor pool capacity used
by all partitions using the pool during the elapsed time.
Nullable
Returns null if this is a dedicated partition.
ELAPSED_CPU_UNCAPPED_ ELAP_UNCAP DECIMAL(5,2) The percentage of the uncapped shared processing capacity
CAPACITY for the partition used since the last time statistics were reset.
Nullable Returns null if this partition cannot use more that its configured
processing capacity.
CONFIGURED_CPUS CONFIGCPUS INTEGER Total number of configured CPUs for the partition.
CPU_SHARING_ATTRIBUTE CPU_SHARE VARCHAR(8) This attribute indicates whether this partition is sharing
processors. If the value indicates the partition does not share
Nullable physical processors, then this partition uses only dedicated
processors. If the value indicates the partition shares physical
processors, then this partition uses physical processors from a
shared pool of physical processors.
CURRENT_CPU_CAPACITY CPU_CAP DECIMAL(5,2) The current processing capacity specifies the processor units
that are being used in the partition. For a partition sharing
physical processors, the current processing capacity represents
the share of the physical processors in the pool it is running. For
a partition using dedicated processors, the current processing
capacity represents the number of virtual processors that are
currently active in the partition.
Nullable
MAIN_STORAGE_SIZE MAIN_STG BIGINT The amount of main storage, in kilobytes, in the system.
SYSTEM_ASP_STORAGE SYS_STG BIGINT The storage capacity of the system auxiliary storage pool (ASP
number 1) in millions of bytes. This value represents the amount
of space available for storage of both permanent and temporary
objects.
TOTAL_AUXILIARY_STORAGE AUX_STG BIGINT The total auxiliary storage, in millions of bytes, on the system.
SYSTEM_ASP_USED SYS_RATE DECIMAL(5,2) The percentage of the system storage pool (ASP number 1)
currently in use.
CURRENT_TEMPORARY_STORAGE TEMP_CUR INTEGER The current amount of storage, in millions of bytes, in use for
temporary objects.
MAXIMUM_TEMPORARY_STORAGE_ TEMP_MAX INTEGER The largest amount of storage, in millions of bytes, used for
USED temporary objects at any one time since the last IPL.
PERMANENT_ADDRESS_RATE PERM_RATE DECIMAL(6,3) The percentage of the maximum possible addresses for
permanent objects that have been used.
TEMPORARY_ADDRESS_RATE TEMP_RATE DECIMAL(6,3) The percentage of the maximum possible addresses for
temporary objects that have been used.
TEMPORARY_256MB_SEGMENTS TEMP_256MB DECIMAL(5,2) The percentage of the maximum possible temporary 256MB
segments that have been used.
TEMPORARY_4GB_SEGMENTS TEMP_4GB DECIMAL(5,2) The percentage of the maximum possible temporary 4GB
segments that have been used.
PERMANENT_256MB_SEGMENTS PERM_256MB DECIMAL(5,2) The percentage of the maximum possible permanent 256MB
segments that have been used.
PERMANENT_4GB_SEGMENTS PERM_4GB DECIMAL(5,2) The percentage of the maximum possible permanent 4GB
segments that have been used.
TEMPORARY_JOB_STRUCTURES_ TEMP_JS INTEGER The number of temporary job structures that currently exist on
AVAILABLE the system that are not in use.
Nullable
Returns the null value if the user does not have *USE authority on
the QSYS/QWTCTJBS program.
PERMANENT_JOB_STRUCTURES_ PERM_JS INTEGER The number of permanent job structures that currently exist on
AVAILABLE the system that are not in use.
Nullable
Returns the null value if the user does not have *USE authority on
the QSYS/QWTCTJBS program.
AVAILABLE_JOB_TABLE_ENTRIES AVAIL_JOBT INTEGER The total number of job table entries that are available.
IN_USE_JOB_TABLE_ENTRIES INUSE_JOBT INTEGER The total number of job table entries that are
in use. This includes ACTIVE_JOB_TABLE_ENTRIES,
JOBQ_JOB_TABLE_ENTRIES, OUTQ_JOB_TABLE_ENTRIES, and
JOBLOG_PENDING_JOB_TABLE_ENTRIES.
ACTIVE_JOB_TABLE_ENTRIES ACT_JOBT INTEGER The total number of entries that are in use by active jobs.
JOBQ_JOB_TABLE_ENTRIES JOBQ_JOBT INTEGER The total number of entries that are in use by jobs on a JOBQ.
OUTQ_JOB_TABLE_ENTRIES OUTQ_JOBT INTEGER The total number of entries that are in use by jobs that have
ended but have spooled output still attached to the job.
JOBLOG_PENDING_JOB_TABLE_ENTRIE PEND_JOBT INTEGER The total number of entries that are in use by jobs that have
S ended but have a pending job log.
HOST_NAME HOST_NAME VARCHAR(255) Name of the system where this information was generated. This
is the name set by CHGNETA.
PARTITION_ID PART_ID INTEGER The identifier for the partition in which this view is being run.
NUMBER_OF_PARTITIONS NUM_PART INTEGER The number of partitions on the physical machine. This includes
partitions that are currently powered on (running) and partitions
that are powered off.
ACTIVE_THREADS_IN_SYSTEM ACT_THREAD INTEGER The number of initial and secondary threads in the system
(threads that have been started, but have not yet ended),
including both user and system threads.
The columns from PARTITION_NAME through UNUSED_CPU_TIME_SHARED_POOL require the user to have *USE authority on the QSYS/QPMLPMGT
service program. Otherwise, they will contain the null value.
PARTITION_NAME PART_NAME VARGRAPHIC(25 The name of the partition as it is known to the HMC.
5) CCSID 1200
Nullable
Nullable
SHARED_PROCESSOR_POOL_ID POOL_ID INTEGER The shared processor pool this partition is a member of. A shared
processor pool is a set of physical processors on the physical
Nullable machine that is used to run a set of shared processor partitions.
A value of 0 indicates the default pool.
Contains the null value if DEDICATED_PROCESSORS is YES.
DEFINED_MEMORY DEF_MEM BIGINT The amount of memory (in megabytes) that was configured for
this partition through the HMC.
Nullable
MINIMUM_MEMORY MIN_MEM BIGINT The minimum amount of main storage (in megabytes) that can be
assigned to this partition.
Nullable
MAXIMUM_MEMORY MAX_MEM BIGINT The maximum amount of main storage (in megabytes) that can
be assigned to this partition.
Nullable
MEMORY_INCREMENT MEM_INCR BIGINT The smallest amount of main storage (in megabytes) that can be
added to or removed from this partition's memory.
Nullable
PHYSICAL_PROCESSORS PHY_PROC INTEGER The number of physical processors in this physical machine
that are available for use. This does not include processors on
Nullable demand that have not been turned on.
PHYSICAL_PROCESSORS_SHARED_ PHY_SHARE INTEGER The number of physical processors that are allocated to the
POOL shared processor pool used by this partition.
Nullable
Contains the null value if DEDICATED_PROCESSORS is YES.
MAXIMUM_PHYSICAL_PROCESSORS MAX_PHY INTEGER The maximum number of physical processors that can be
active in this physical machine without installing additional
Nullable processors. This value includes currently active processors and
any standby (on demand) processors that are present in this
physical machine.
DEFINED_VIRTUAL_PROCESSORS DEF_VIRT INTEGER The number of virtual processors configured for this partition
through the HMC.
Nullable
VIRTUAL_PROCESSORS VIRT_PROC INTEGER The number of virtual processors currently used by this partition.
Nullable
MINIMUM_VIRTUAL_PROCESSORS MIN_VIRT INTEGER The minimum number of virtual processors that can be
configured for this partition.
Nullable
MAXIMUM_VIRTUAL_PROCESSORS MAX_VIRT INTEGER The maximum number of virtual processors that can be
configured for this partition.
Nullable
DEFINED_PROCESSING_CAPACITY DEF_CAP DECIMAL(5,2) The amount of processing capacity that was configured for this
partition through the HMC.
Nullable
PROCESSING_CAPACITY CAPACITY DECIMAL(5,2) The current (usable) amount of processing capacity available to
the partition (also known as partition's entitled capacity).
Nullable
UNALLOCATED_PROCESSING_CAPACITY AVAIL_CAP DECIMAL(5,2) The amount of processing capacity in the partition group this
partition belongs to, which is not allocated to any partition and is
Nullable available for allocation.
MINIMUM_REQUIRED_PROCESSING_ MIN_REQCAP DECIMAL(5,2) The minimum amount of processing capacity that the operating
CAPACITY system in this partition requires for its operation.
Nullable
MAXIMUM_LICENSED_PROCESSING_ MAX_LICCAP DECIMAL(5,2) The current limit on processing capacity of this partition imposed
CAPACITY by the operating system software license for this partition.
Nullable
MINIMUM_PROCESSING_CAPACITY MIN_CAP DECIMAL(5,2) The minimum amount of processing capacity that can be
assigned to this partition.
Nullable
MAXIMUM_PROCESSING_CAPACITY MAX_CAP DECIMAL(5,2) The maximum amount of processing capacity that can be
assigned to this partition.
Nullable
PROCESSING_CAPACITY_INCREMENT CAP_INCR DECIMAL(5,2) The smallest capacity that can be added to or removed from this
partition's processing capacity.
Nullable
DEFINED_INTERACTIVE_CAPACITY DEF_INTCAP DECIMAL(5,2) The amount of interactive capacity that was configured for this
partition through the HMC. A partition's interactive capacity is
Nullable defined as this partition's portion of total interactive capacity of
the physical machine.
INTERACTIVE_CAPACITY INT_CAP DECIMAL(5,2) This partition's current (usable) portion of the physical machine
interactive capacity.
Nullable
INTERACTIVE_THRESHOLD INT_THRESH DECIMAL(5,2) The maximum interactive CPU utilization which can be sustained
in this partition, without causing a disproportionate increase in
Nullable system overhead.
UNALLOCATED_INTERACTIVE_ AVL_INTCAP DECIMAL(5,2) The amount of interactive capacity in the partition group this
CAPACITY partition belongs to, which is not allocated to any partition and
Nullable is available for allocation. Interactive capacity is defined as the
portion of total interactive capacity of the physical machine.
MINIMUM_INTERACTIVE_CAPACITY MIN_INTCAP DECIMAL(5,2) The minimum portion of the physical machine's interactive
capacity that can be assigned to this partition.
Nullable
MAXIMUM_INTERACTIVE_CAPACITY MAX_INTCAP DECIMAL(5,2) The maximum portion of the physical machine's interactive
capacity that can be assigned to this partition.
Nullable
DEFINED_VARIABLE_CAPACITY_ DEF_CAPW INTEGER The weighting factor that was configured for this partition
WEIGHT through the HMC. Variable capacity weight is used for uncapped
Nullable partitions when they compete for unused CPU cycles in the
shared pool. Variable capacity weight can be in the range of 0
- 255. The larger the weight, the more the chance this partition
will get additional CPU cycles from the shared pool.
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
VARIABLE_CAPACITY_WEIGHT VAR_CAPW INTEGER The weighting factor that is used to assign additional unused
CPU cycles (from the shared processor pool) to the partition.
Nullable Variable capacity weight is used for uncapped partitions when
they compete for unused CPU cycles in the shared pool. This
factor is in the range of 0 - 255. The larger the weight, the greater
the chance this partition will get additional CPU cycles from the
pool. A value of 0 effectively caps this partition at its current
(usable) processing capacity.
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
UNALLOCATED_VARIABLE_CAPACITY_ AVAIL_CAPW INTEGER The amount of capacity weight that is available for allocation to
WEIGHT the partition's variable capacity weight.
Nullable
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
THREADS_PER_PROCESSOR THREADS_PP INTEGER The number of hardware threads per processor when hardware
multi-threading is enabled.
Nullable
Contains the null value if HARDWARE_MULTITHREADING is NO.
DISPATCH_LATENCY LATENCY DECIMAL(20,0) The maximum time in nanoseconds between dispatches of this
partition on a physical processor.
Nullable
TOTAL_CPU_TIME CPU_TOTAL DECIMAL(20,0) The number of nanoseconds of CPU time used by this partition
since IPL.
Nullable
INTERACTIVE_CPU_TIME CPU_INTER DECIMAL(20,0) The amount of CPU time, in nanoseconds, used by interactive
processes in this partition since partition IPL. An interactive
Nullable process is any process doing 5250 display device I/O.
INTERACTIVE_CPU_TIME_ABOVE_ CPU_THRESH DECIMAL(20,0) The amount of CPU time, in nanoseconds, used by interactive
THRESHOLD processes while exceeding the interactive threshold. This is a
Nullable total since IPL.
UNUSED_CPU_TIME_SHARED_POOL CPU_UNUSED DECIMAL(20,0) The number of nanoseconds of CPU time that the physical
processors in a shared processor pool have been idle since
Nullable system IPL.
Contains the null value if DEDICATED_PROCESSORS is YES or if
the partition is not authorized to retrieve shared pool data.
JOURNAL_RECOVERY_COUNT JRNRCYCNT INTEGER Specifies the system wide default journal recovery count. The
journal recovery count allows you to choose between faster
runtime processing of changes to journaled objects and faster
IPL or vary on recovery after an abnormal shutdown. The value
specified influences the frequency with which journaled objects
are forced to auxiliary storage as those objects are changed.
The specified journal recovery count indicates the approximate
number of journaled changes that would need to be recovered
during journal synchronization for this journal in the event of
an IPL or vary on after an abnormal shutdown. A smaller
value decreases the number of changes that would need to
be recovered from this journal by increasing the frequency
with which changed objects are forced to disk. A larger value
increases the runtime processing of changes to journaled objects
by decreasing the frequency with which changed objects are
forced to disk. Changing this value may affect overall system
performance as it affects the utilization of auxiliary storage
devices.
This value can be changed with the Change Journal Attributes
(CHGJRNA) CL command.
The system default for this value is 250,000.
JOURNAL_CACHE_WAIT_TIME CACHEWAIT INTEGER The cache wait time, in seconds, for journal environments with
caching enabled. The cache wait time is the maximum number
of seconds that the system will wait before writing any lingering
journal entries from main memory to disk.
This value can be changed with the Change Journal Attributes
(CHGJRNA) CL command.
The system default for this value is 30 seconds.
ACCESS_PATH_TARGET_ SMAPP VARCHAR(7) The time, in minutes, targeted for access path protection for the
RECOVERY_TIME system.
Nullable
1-1440 The number of minutes set for the system access
path recovery time.
Contains the null value if the user does not have *JOBCTL special
authority.
SMAPP_INCLUDE_ACCESS_PATHS SMAPP_AP VARCHAR(9) Indicates whether the access path recovery time should include
only those access paths which are considered eligible for
Nullable protection or include all access paths.
ACCESS_PATH_ ESTIMATED_ AP_RECOV INTEGER The amount of time, in minutes, that the system will take to
RECOVERY_TIME recover the access paths on the system during initial program
Nullable load (IPL) and during the vary on of all currently available
independent storage pools (IASPs). This value assumes that all
access paths that are protected are recovered at IPL or during
vary on of IASPs.
The estimated system access path recovery time is influenced by
SMAPP_INCLUDE_ACCESS_PATHS.
• If SMAPP_INCLUDE_ACCESS_PATHS is *ELIGIBLE, this value
is the estimated system access path recovery time of all the
eligible access paths that are not chosen for protection.
• If SMAPP_INCLUDE_ACCESS_PATHS is *ALL, this value is the
estimated system access path recovery time of all the eligible
access paths that are not chosen for protection plus all the
access paths that are not eligible for protection.
Contains the null value when ACCESS_PATH_RECOVERY_TIME is
*OFF or if the user does not have *JOBCTL special authority.
ACCESS_PATH_ESTIMATED_INELIGIBLE AP_INELIG INTEGER The total time, in minutes, that it will take to recover all access
_ paths which are not eligible for system-managed access path
Nullable protection.
RECOVERY_TIME
Contains the null value when ACCESS_PATH_RECOVERY_TIME is
*OFF or if the user does not have *JOBCTL special authority.
SMAPP_DISK_STORAGE_USED SMAPP_STG BIGINT The total amount of auxiliary disk storage, in megabytes, used by
internal objects that are used exclusively for system-managed
Nullable access path protection (SMAPP). This value is the sum of
the auxiliary storage used for access path protection for each
auxiliary storage pool (ASP).
Contains the null value when ACCESS_PATH_RECOVERY_TIME is
*OFF or if the user does not have *JOBCTL special authority.
Examples
• Review the state of the job table entries for the partition.
SYSTEM_STATUS_INFO_BASIC view
The SYSTEM_STATUS_INFO_BASIC view returns a single row containing details about the current
partition. This view uses the QSYS2.SYSTEM_STATUS table function with DETAILED_INFO => 'BASIC'.
This view contains the same information as SYSTEM_STATUS_INFO except it excludes the job table
columns.
The information returned is similar to the detail seen from the Work with System Status (WRKSYSSTS)
and the Work with System Activity (WRKSYSACT) commands, information available in the HMC and with
the Retrieve Partition Information (dlpar_get_info) API, and journal attribute values. It does not reset the
statistical columns; to do this, use the associated table function, “SYSTEM_STATUS table function” on
page 1100.
Authorization: To see non-null values for the columns from PARTITION_NAME through
UNUSED_CPU_TIME_SHARED_POOL, the caller must have *USE authority to the QSYS/QPMLPMGT service
program.
To return values for TEMPORARY_JOB_STRUCTURES_AVAILABLE and
PERMANENT_JOB_STRUCTURES_AVAILABLE, the caller must have:
• *JOBCTL special authority, and
• *USE authority to the QSYS/QWTCTJBS program.
TOTAL_JOBS_IN_SYSTEM TOTAL_JOBS INTEGER The total number of user and system jobs that are currently in
the system. The total includes:
• All jobs on job queues waiting to be processed.
• All jobs currently active (being processed).
• All jobs that have completed running but still have output on
output queues to be produced.
MAXIMUM_JOBS_IN_SYSTEM MAX_JOBS INTEGER The maximum number of jobs that are allowed on the system.
When the number of jobs reaches this maximum, you can no
longer submit or start more jobs on the system. The total
includes:
• All jobs on job queues waiting to be processed.
• All jobs currently active (being processed).
• All jobs that have completed running but still have output on
output queues to be produced.
ACTIVE_JOBS_IN_SYSTEM ACT_JOBS INTEGER The number of jobs active in the system (jobs that have been
started, but have not yet ended), including both user and system
jobs.
ELAPSED_TIME ELAP_TIME INTEGER The time that has elapsed, in seconds, between the
measurement start time and the current system time.
ELAPSED_CPU_USED ELAP_USED DECIMAL(5,2) The average of the elapsed time during which the processing
units were in use.
ELAPSED_CPU_SHARED ELAP_SHARE DECIMAL(5,2) The percentage of the total shared processor pool capacity used
by all partitions using the pool during the elapsed time.
Nullable
Returns null if this is a dedicated partition.
ELAPSED_CPU_UNCAPPED_ ELAP_UNCAP DECIMAL(5,2) The percentage of the uncapped shared processing capacity
CAPACITY for the partition used since the last time statistics were reset.
Nullable Returns null if this partition cannot use more that its configured
processing capacity.
CONFIGURED_CPUS CONFIGCPUS INTEGER Total number of configured CPUs for the partition.
CPU_SHARING_ATTRIBUTE CPU_SHARE VARCHAR(8) This attribute indicates whether this partition is sharing
processors. If the value indicates the partition does not share
Nullable physical processors, then this partition uses only dedicated
processors. If the value indicates the partition shares physical
processors, then this partition uses physical processors from a
shared pool of physical processors.
CURRENT_CPU_CAPACITY CPU_CAP DECIMAL(5,2) The current processing capacity specifies the processor units
that are being used in the partition. For a partition sharing
physical processors, the current processing capacity represents
the share of the physical processors in the pool it is running. For
a partition using dedicated processors, the current processing
capacity represents the number of virtual processors that are
currently active in the partition.
Nullable
MAIN_STORAGE_SIZE MAIN_STG BIGINT The amount of main storage, in kilobytes, in the system.
SYSTEM_ASP_STORAGE SYS_STG BIGINT The storage capacity of the system auxiliary storage pool (ASP
number 1) in millions of bytes. This value represents the amount
of space available for storage of both permanent and temporary
objects.
TOTAL_AUXILIARY_STORAGE AUX_STG BIGINT The total auxiliary storage, in millions of bytes, on the system.
SYSTEM_ASP_USED SYS_RATE DECIMAL(5,2) The percentage of the system storage pool (ASP number 1)
currently in use.
CURRENT_TEMPORARY_STORAGE TEMP_CUR INTEGER The current amount of storage, in millions of bytes, in use for
temporary objects.
MAXIMUM_TEMPORARY_STORAGE_ TEMP_MAX INTEGER The largest amount of storage, in millions of bytes, used for
USED temporary objects at any one time since the last IPL.
PERMANENT_ADDRESS_RATE PERM_RATE DECIMAL(6,3) The percentage of the maximum possible addresses for
permanent objects that have been used.
TEMPORARY_ADDRESS_RATE TEMP_RATE DECIMAL(6,3) The percentage of the maximum possible addresses for
temporary objects that have been used.
TEMPORARY_256MB_SEGMENTS TEMP_256MB DECIMAL(5,2) The percentage of the maximum possible temporary 256MB
segments that have been used.
TEMPORARY_4GB_SEGMENTS TEMP_4GB DECIMAL(5,2) The percentage of the maximum possible temporary 4GB
segments that have been used.
PERMANENT_256MB_SEGMENTS PERM_256MB DECIMAL(5,2) The percentage of the maximum possible permanent 256MB
segments that have been used.
PERMANENT_4GB_SEGMENTS PERM_4GB DECIMAL(5,2) The percentage of the maximum possible permanent 4GB
segments that have been used.
TEMPORARY_JOB_STRUCTURES_ TEMP_JS INTEGER The number of temporary job structures that currently exist on
AVAILABLE the system that are not in use.
Nullable
Returns the null value if the user does not have *USE authority on
the QSYS/QWTCTJBS program.
PERMANENT_JOB_STRUCTURES_ PERM_JS INTEGER The number of permanent job structures that currently exist on
AVAILABLE the system that are not in use.
Nullable
Returns the null value if the user does not have *USE authority on
the QSYS/QWTCTJBS program.
HOST_NAME HOST_NAME VARCHAR(255) Name of the system where this information was generated. This
is the name set by CHGNETA.
PARTITION_ID PART_ID INTEGER The identifier for the partition in which this view is being run.
NUMBER_OF_PARTITIONS NUM_PART INTEGER The number of partitions on the physical machine. This includes
partitions that are currently powered on (running) and partitions
that are powered off.
ACTIVE_THREADS_IN_SYSTEM ACT_THREAD INTEGER The number of initial and secondary threads in the system
(threads that have been started, but have not yet ended),
including both user and system threads.
The columns from PARTITION_NAME through UNUSED_CPU_TIME_SHARED_POOL require the user to have *USE authority on the QSYS/QPMLPMGT
service program. Otherwise, they will contain the null value.
PARTITION_NAME PART_NAME VARGRAPHIC(25 The name of the partition as it is known to the HMC.
5) CCSID 1200
Nullable
Nullable
SHARED_PROCESSOR_POOL_ID POOL_ID INTEGER The shared processor pool this partition is a member of. A shared
processor pool is a set of physical processors on the physical
Nullable machine that is used to run a set of shared processor partitions.
A value of 0 indicates the default pool.
Contains the null value if DEDICATED_PROCESSORS is YES.
DEFINED_MEMORY DEF_MEM BIGINT The amount of memory (in megabytes) that was configured for
this partition through the HMC.
Nullable
MINIMUM_MEMORY MIN_MEM BIGINT The minimum amount of main storage (in megabytes) that can be
assigned to this partition.
Nullable
MAXIMUM_MEMORY MAX_MEM BIGINT The maximum amount of main storage (in megabytes) that can
be assigned to this partition.
Nullable
MEMORY_INCREMENT MEM_INCR BIGINT The smallest amount of main storage (in megabytes) that can be
added to or removed from this partition's memory.
Nullable
PHYSICAL_PROCESSORS PHY_PROC INTEGER The number of physical processors in this physical machine
that are available for use. This does not include processors on
Nullable demand that have not been turned on.
PHYSICAL_PROCESSORS_SHARED_ PHY_SHARE INTEGER The number of physical processors that are allocated to the
POOL shared processor pool used by this partition.
Nullable
Contains the null value if DEDICATED_PROCESSORS is YES.
MAXIMUM_PHYSICAL_PROCESSORS MAX_PHY INTEGER The maximum number of physical processors that can be
active in this physical machine without installing additional
Nullable processors. This value includes currently active processors and
any standby (on demand) processors that are present in this
physical machine.
DEFINED_VIRTUAL_PROCESSORS DEF_VIRT INTEGER The number of virtual processors configured for this partition
through the HMC.
Nullable
VIRTUAL_PROCESSORS VIRT_PROC INTEGER The number of virtual processors currently used by this partition.
Nullable
MINIMUM_VIRTUAL_PROCESSORS MIN_VIRT INTEGER The minimum number of virtual processors that can be
configured for this partition.
Nullable
MAXIMUM_VIRTUAL_PROCESSORS MAX_VIRT INTEGER The maximum number of virtual processors that can be
configured for this partition.
Nullable
DEFINED_PROCESSING_CAPACITY DEF_CAP DECIMAL(5,2) The amount of processing capacity that was configured for this
partition through the HMC.
Nullable
PROCESSING_CAPACITY CAPACITY DECIMAL(5,2) The current (usable) amount of processing capacity available to
the partition (also known as partition's entitled capacity).
Nullable
UNALLOCATED_PROCESSING_CAPACITY AVAIL_CAP DECIMAL(5,2) The amount of processing capacity in the partition group this
partition belongs to, which is not allocated to any partition and is
Nullable available for allocation.
MINIMUM_REQUIRED_PROCESSING_ MIN_REQCAP DECIMAL(5,2) The minimum amount of processing capacity that the operating
CAPACITY system in this partition requires for its operation.
Nullable
MAXIMUM_LICENSED_PROCESSING_ MAX_LICCAP DECIMAL(5,2) The current limit on processing capacity of this partition imposed
CAPACITY by the operating system software license for this partition.
Nullable
MINIMUM_PROCESSING_CAPACITY MIN_CAP DECIMAL(5,2) The minimum amount of processing capacity that can be
assigned to this partition.
Nullable
MAXIMUM_PROCESSING_CAPACITY MAX_CAP DECIMAL(5,2) The maximum amount of processing capacity that can be
assigned to this partition.
Nullable
PROCESSING_CAPACITY_INCREMENT CAP_INCR DECIMAL(5,2) The smallest capacity that can be added to or removed from this
partition's processing capacity.
Nullable
DEFINED_INTERACTIVE_CAPACITY DEF_INTCAP DECIMAL(5,2) The amount of interactive capacity that was configured for this
partition through the HMC. A partition's interactive capacity is
Nullable defined as this partition's portion of total interactive capacity of
the physical machine.
INTERACTIVE_CAPACITY INT_CAP DECIMAL(5,2) This partition's current (usable) portion of the physical machine
interactive capacity.
Nullable
INTERACTIVE_THRESHOLD INT_THRESH DECIMAL(5,2) The maximum interactive CPU utilization which can be sustained
in this partition, without causing a disproportionate increase in
Nullable system overhead.
UNALLOCATED_INTERACTIVE_ AVL_INTCAP DECIMAL(5,2) The amount of interactive capacity in the partition group this
CAPACITY partition belongs to, which is not allocated to any partition and
Nullable is available for allocation. Interactive capacity is defined as the
portion of total interactive capacity of the physical machine.
MINIMUM_INTERACTIVE_CAPACITY MIN_INTCAP DECIMAL(5,2) The minimum portion of the physical machine's interactive
capacity that can be assigned to this partition.
Nullable
MAXIMUM_INTERACTIVE_CAPACITY MAX_INTCAP DECIMAL(5,2) The maximum portion of the physical machine's interactive
capacity that can be assigned to this partition.
Nullable
DEFINED_VARIABLE_CAPACITY_ DEF_CAPW INTEGER The weighting factor that was configured for this partition
WEIGHT through the HMC. Variable capacity weight is used for uncapped
Nullable partitions when they compete for unused CPU cycles in the
shared pool. Variable capacity weight can be in the range of 0
- 255. The larger the weight, the more the chance this partition
will get additional CPU cycles from the shared pool.
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
VARIABLE_CAPACITY_WEIGHT VAR_CAPW INTEGER The weighting factor that is used to assign additional unused
CPU cycles (from the shared processor pool) to the partition.
Nullable Variable capacity weight is used for uncapped partitions when
they compete for unused CPU cycles in the shared pool. This
factor is in the range of 0 - 255. The larger the weight, the greater
the chance this partition will get additional CPU cycles from the
pool. A value of 0 effectively caps this partition at its current
(usable) processing capacity.
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
UNALLOCATED_VARIABLE_CAPACITY_ AVAIL_CAPW INTEGER The amount of capacity weight that is available for allocation to
WEIGHT the partition's variable capacity weight.
Nullable
Contains the null value if DEDICATED_PROCESSORS is YES or if
CPU_SHARING_ATTRIBUTE is CAPPED.
THREADS_PER_PROCESSOR THREADS_PP INTEGER The number of hardware threads per processor when hardware
multi-threading is enabled.
Nullable
Contains the null value if HARDWARE_MULTITHREADING is NO.
DISPATCH_LATENCY LATENCY DECIMAL(20,0) The maximum time in nanoseconds between dispatches of this
partition on a physical processor.
Nullable
TOTAL_CPU_TIME CPU_TOTAL DECIMAL(20,0) The number of nanoseconds of CPU time used by this partition
since IPL.
Nullable
INTERACTIVE_CPU_TIME CPU_INTER DECIMAL(20,0) The amount of CPU time, in nanoseconds, used by interactive
processes in this partition since partition IPL. An interactive
Nullable process is any process doing 5250 display device I/O.
INTERACTIVE_CPU_TIME_ABOVE_ CPU_THRESH DECIMAL(20,0) The amount of CPU time, in nanoseconds, used by interactive
THRESHOLD processes while exceeding the interactive threshold. This is a
Nullable total since IPL.
UNUSED_CPU_TIME_SHARED_POOL CPU_UNUSED DECIMAL(20,0) The number of nanoseconds of CPU time that the physical
processors in a shared processor pool have been idle since
Nullable system IPL.
Contains the null value if DEDICATED_PROCESSORS is YES or if
the partition is not authorized to retrieve shared pool data.
JOURNAL_RECOVERY_COUNT JRNRCYCNT INTEGER Specifies the system wide default journal recovery count. The
journal recovery count allows you to choose between faster
runtime processing of changes to journaled objects and faster
IPL or vary on recovery after an abnormal shutdown. The value
specified influences the frequency with which journaled objects
are forced to auxiliary storage as those objects are changed.
The specified journal recovery count indicates the approximate
number of journaled changes that would need to be recovered
during journal synchronization for this journal in the event of
an IPL or vary on after an abnormal shutdown. A smaller
value decreases the number of changes that would need to
be recovered from this journal by increasing the frequency
with which changed objects are forced to disk. A larger value
increases the runtime processing of changes to journaled objects
by decreasing the frequency with which changed objects are
forced to disk. Changing this value may affect overall system
performance as it affects the utilization of auxiliary storage
devices.
This value can be changed with the Change Journal Attributes
(CHGJRNA) CL command.
The system default for this value is 250,000.
JOURNAL_CACHE_WAIT_TIME CACHEWAIT INTEGER The cache wait time, in seconds, for journal environments with
caching enabled. The cache wait time is the maximum number
of seconds that the system will wait before writing any lingering
journal entries from main memory to disk.
This value can be changed with the Change Journal Attributes
(CHGJRNA) CL command.
The system default for this value is 30 seconds.
Examples
• Review the storage and CPU status for the partition.
SELECT
(SELECT CURRENT_NUMERIC_VALUE FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QTOTJOB') AS INITIAL_PERM_JOB_STRUCTURES,
(SELECT CURRENT_NUMERIC_VALUE FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QADLTOTJ') AS ADDITIONAL_PERM_JOB_STRUCTURES,
PERMANENT_JOB_STRUCTURES_AVAILABLE AS AVAILABLE_PERM_JOB_STRUCTURES,
PERMANENT_JOB_STRUCTURES_AVAILABLE + TOTAL_JOBS_IN_SYSTEM AS TOTAL_PERM_JOB_STRUCTURES,
(SELECT CURRENT_NUMERIC_VALUE FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QACTJOB') AS INITIAL_TEMP_JOB_STRUCTURES,
(SELECT CURRENT_NUMERIC_VALUE FROM QSYS2.SYSTEM_VALUE_INFO
WHERE SYSTEM_VALUE_NAME = 'QADLACTJ') AS ADDITIONAL_TEMP_JOB_STRUCTURES,
TEMPORARY_JOB_STRUCTURES_AVAILABLE AS AVAILABLE_TEMP_JOB_STRUCTURES,
(SELECT BUCKET_CURRENT_SIZE FROM QSYS2.SYSTMPSTG
WHERE GLOBAL_BUCKET_NAME = '*ACTJOB') AS TOTAL_TEMP_STORAGE_USED
FROM QSYS2.SYSTEM_STATUS_INFO_BASIC;
CURRENT_NUMERIC_VALUE CURNUMVAL BIGINT Contains the value if the system value is numeric data. Otherwise, contains
the null value.
Nullable
CURRENT_CHARACTER_VALUE CURCHARVAL VARGRAPHIC(3840) Contains the value if the system value is character data. Otherwise,
CCSID(1200) contains the null value.
Nullable
*ALC Allocation
*EDT Editing
*SEC Security
*STG Storage
CHANGEABLE CHANGEABLE VARCHAR(3) Whether the system value can be changed with the Change System Value
(CHGSYSVAL) CL command.
SHIPPED_DEFAULT_VALUE DEFAULT VARGRAPHIC(3840) The default value that is shipped for the system value.
CCSID(1200)
Example
Look at the system values related to maximums and their system shipped defaults..
returns
TRACKED_JOB_INFO (
node-name-filter
NODE_NAME_FILTER =>
, iasp-name-filter
IASP_NAME_FILTER =>
, job-queue-library-filter
JOB_QUEUE_LIBRARY_FILTER =>
)
, job-queue-filter
JOB_QUEUE_FILTER =>
node-name- A string containing a node name in the job tracking files to be included in the result. If
filter this parameter is omitted, information for all nodes is eligible to be returned.
iasp-name- A string containing a job queue independent ASP name in the job tracking files to be
filter included in the result. Can contain the special value *SYSBAS. If this parameter is
omitted, information for all ASPs is eligible to be returned.
job-queue- A string containing a job queue library name in the job tracking files to be included in
library-filter the result. If this parameter is omitted, information for all tracked job queue libraries is
eligible to be returned.
job-queue- A string containing a job queue name in the job tracking files to be included in the
filter result. If this parameter is omitted, information for all tracked job queue queues is
eligible to be returned.
The result of the function is a table containing rows with the format shown in the following table. All the
columns are nullable.
Table 289. TRACKED_JOB_INFO table function
NODE_NAME VARCHAR(8) The name of the IBM i partition where the tracked job
queue is located.
COMMAND_OR_REQUEST_DATA VARCHAR(20000) The command the job will run or the request data that
is placed as an entry in the job's message queue.
Contains the null value if no command or request data
for the job has been set.
JOB_ENTERED_SYSTEM_TIME TIMESTAMP(0) The timestamp for when the job was placed on the
system.
JOB_QUEUE_ASP_NAME VARCHAR(10) The ASP device name where the job queue is located.
JOB_QUEUE_LIBRARY VARCHAR(10) The name of the library containing the job queue.
JOB_QUEUE VARCHAR(10) The name of the job queue for the submitted job.
JOB_DESCRIPTION_LIBRARY VARCHAR(10) The name of the library containing the job description.
JOB_DESCRIPTION VARCHAR(10) The name of the job description used for this job.
PROCESSING_UNIT_TIME BIGINT The amount of processing unit time used by the job, in
milliseconds.
Contains the null value if the job has not ended.
PRINTER_DEVICE_NAME VARCHAR(10) The printer device used for printing output from this
job.
OUTPUT_QUEUE_LIBRARY VARCHAR(10) The name of the library that contains the default
output queue.
Contains the null value if OUTPUT_QUEUE contains a
special value.
OUTPUT_QUEUE VARCHAR(10) The name of the default output queue that is used
for spooled output produced by this job. The default
output queue is only for spooled printer files that
specify *JOB for the output queue. Can contain the
special value *DEV.
OUTPUT_QUEUE_PRIORITY INTEGER The output priority for spooled output files that this job
produces. The highest priority is 0, and the lowest is 9.
RUN_PRIORITY INTEGER The priority at which the job or thread competes for the
processing unit relative to other jobs and threads that
are active at the same time. The run priority ranges
from 1 (highest priority) to 99 (lowest priority).
Contains the null value if the run priority for the job has
not been set.
PRINT_TEXT VARCHAR(30) The line of text that is printed at the bottom of each
page of printed output for the job.