{"id":55,"date":"2022-04-15T21:17:38","date_gmt":"2022-04-15T21:17:38","guid":{"rendered":"http:\/\/www.navan.com.au\/wp\/?page_id=55"},"modified":"2024-01-20T23:22:30","modified_gmt":"2024-01-20T23:22:30","slug":"developer-tips","status":"publish","type":"page","link":"https:\/\/www.navan.com.au\/?page_id=55","title":{"rendered":"Developer Tips"},"content":{"rendered":"\n<h2>IBM i SQL Tips<\/h2>\n<ol>\n<li><h3>Check Object Record Locks<\/h3>\n<pre>\nSELECT MEMBER_LOCK_TYPE,LOCK_STATE,LOCK_SCOPE,JOB_NAME,\n       SUBSTR(JOB_NAME,8,LOCATE_IN_STRING(JOB_NAME,'\/',8)-8) AS \"User\"\n        FROM QSYS2.OBJECT_LOCK_INFO\n        WHERE SYSTEM_OBJECT_SCHEMA = 'LIBRARY'\n          AND SYSTEM_OBJECT_NAME = 'TABLE'\n          AND OBJECT_TYPE = '*FILE'\n<\/pre>\n<hr>\n<li><h3>Run a Command via SQL<\/h3>                                         \n<pre>                                               \ncall qsys2.qcmdexc ('dspjob')                       \ncall qcmdexc ('dltf qtemp\/file')                    \ncall qcmdexc ('rmvlnk ''home\/<USER>\/file.txt''')    \n<\/pre>                                                                                         \n<hr>\n<li><h3>Environment Variables<\/h3>                                 \n<h4>*SYS Environment Variables<\/h4>                            \n<pre>                                                          \n SELECT ENVIRONMENT_VARIABLE_NAME, ENVIRONMENT_VARIABLE_VALUE  \n     FROM QSYS2.ENVIRONMENT_VARIABLE_INFO                      \n     WHERE ENVIRONMENT_VARIABLE_TYPE = 'SYSTEM'                \n<\/pre>                                                         \n<h4>*JOB Environment Variables<\/h4>                            \n<pre>                                                          \n SELECT ENVIRONMENT_VARIABLE_NAME, ENVIRONMENT_VARIABLE_VALUE  \n     FROM QSYS2.ENVIRONMENT_VARIABLE_INFO                      \n     WHERE ENVIRONMENT_VARIABLE_TYPE = 'JOB'                   \n<\/pre>                                                         \n<hr>                                                           \n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>IBM i SQL Tips Check Object Record Locks SELECT MEMBER_LOCK_TYPE,LOCK_STATE,LOCK_SCOPE,JOB_NAME, SUBSTR(JOB_NAME,8,LOCATE_IN_STRING(JOB_NAME,&#8217;\/&#8217;,8)-8) AS &#8220;User&#8221; FROM QSYS2.OBJECT_LOCK_INFO WHERE SYSTEM_OBJECT_SCHEMA = &#8216;LIBRARY&#8217; AND SYSTEM_OBJECT_NAME = &#8216;TABLE&#8217; AND OBJECT_TYPE = &#8216;*FILE&#8217; Run a Command via SQL call qsys2.qcmdexc (&#8216;dspjob&#8217;) call qcmdexc (&#8216;dltf qtemp\/file&#8217;) call qcmdexc (&#8216;rmvlnk &#8221;home\/\/file.txt&#8221;&#8217;) Environment Variables *SYS Environment Variables SELECT ENVIRONMENT_VARIABLE_NAME, ENVIRONMENT_VARIABLE_VALUE FROM QSYS2.ENVIRONMENT_VARIABLE_INFO WHERE ENVIRONMENT_VARIABLE_TYPE&nbsp;&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-55","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/pages\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.navan.com.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=55"}],"version-history":[{"count":22,"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/pages\/55\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/www.navan.com.au\/index.php?rest_route=\/wp\/v2\/pages\/55\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/www.navan.com.au\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}