{"id":120,"date":"2025-08-12T09:55:22","date_gmt":"2025-08-12T09:55:22","guid":{"rendered":"https:\/\/fhix.fr\/?p=120"},"modified":"2025-08-31T10:09:00","modified_gmt":"2025-08-31T10:09:00","slug":"trouver-le-programme-appelant-dans-un-rpg","status":"publish","type":"post","link":"https:\/\/fhix.fr\/index.php\/2025\/08\/12\/trouver-le-programme-appelant-dans-un-rpg\/","title":{"rendered":"Trouver le programme appelant dans un RPG"},"content":{"rendered":"\n<p>Permet dans un RPG d&rsquo;identifier son programme appelant. Cela peut servir par exemple pour conditionner certaines actions ou laisser une trace dans un fichier log.<\/p>\n\n\n\n<p><strong>en SQLRPGLE :<\/strong><br><code>dcl-ds N PSDS;<br>  nom_du_pgm CHAR(10) POS(1);<br>end-ds; <br>dcl-s appelant char(10); <\/code><br><code><br>EXEC SQL <\/code><br>  <code>SELECT program_name INTO :appelant <\/code><br>  <code>FROM TABLE(stack_info('*'))<br> WHERE program_name not in (' ' , :nom_du_pgm)<br> AND ordinal_position &lt;<br> ( SELECT ordinal_position FROM TABLE(stack_info('*')) WHERE<br>   program_name=:nom_du_pgm LIMIT 1)<br> LIMIT 1;<\/code><\/p>\n\n\n\n<p><strong>Explications :<\/strong><br><code>stack_info<\/code> permet de r\u00e9cup\u00e9rer la pile de programme en cours. Le SQL propos\u00e9 identifie dans la pile le programme au dessus du programme en cours.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Permet dans un RPG d&rsquo;identifier son programme appelant. Cela peut servir par exemple pour conditionner certaines actions ou laisser une trace dans un fichier log. en SQLRPGLE :dcl-ds N PSDS; nom_du_pgm CHAR(10) POS(1);end-ds; dcl-s appelant char(10); EXEC SQL SELECT program_name INTO :appelant FROM TABLE(stack_info(&lsquo;*&rsquo;)) WHERE program_name not in (&lsquo; &lsquo; , :nom_du_pgm) AND ordinal_position &lt; &#8230; <a title=\"Trouver le programme appelant dans un RPG\" class=\"read-more\" href=\"https:\/\/fhix.fr\/index.php\/2025\/08\/12\/trouver-le-programme-appelant-dans-un-rpg\/\" aria-label=\"En savoir plus sur Trouver le programme appelant dans un RPG\">Lire la suite<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-120","post","type-post","status-publish","format-standard","hentry","category-rpg"],"_links":{"self":[{"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":6,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/posts\/120\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fhix.fr\/index.php\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}