{"id":1864,"date":"2015-09-01T17:59:54","date_gmt":"2015-09-01T16:59:54","guid":{"rendered":"http:\/\/www.unicoda.com\/?p=1864"},"modified":"2015-09-03T14:02:27","modified_gmt":"2015-09-03T13:02:27","slug":"manipulations-de-donnees-simples","status":"publish","type":"post","link":"https:\/\/www.unicoda.com\/?p=1864","title":{"rendered":"Manipulations de donn\u00e9es simples"},"content":{"rendered":"<p>Des cas simples, toujours bon \u00e0 avoir sous la main, ou ici plus particuli\u00e8rement sous les yeux et \u00e0 port\u00e9e d&rsquo;internet !<br \/>\nDans cet article je vais parler de quelques bases de manipulations de donn\u00e9es en Cobol:<\/p>\n<pre><code><span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">WORKING-STORAGE<\/span> <span style=\"color: #00ff00;\">SECTION<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">01<\/span><span style=\"color: #ffffff;\"> WORKING-VAR.<\/span><\/span>\r\n      <span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">05<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2 <\/span><span style=\"color: #00ff00;\">PIC<\/span> <span style=\"color: #ff0000;\">S9(15)V9(2)<\/span> <span style=\"color: #00ff00;\">COMP-3<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n      <span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">05<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17   <\/span><span style=\"color: #00ff00;\">PIC<\/span> <span style=\"color: #ff0000;\">S9(17)<\/span> <span style=\"color: #00ff00;\">COMP-3<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n\r\n<span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">PROCEDURE<\/span> <span style=\"color: #00ff00;\">DIVISION<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variables non renseign\u00e9es :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ff0000;\">12,34<\/span> <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ff0000;\">1234<\/span> <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variables renseign\u00e9es :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2 <\/span><span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variables apr\u00e8s passage de 15-2 \u00e0 17 :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">compute<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17 <\/span><span style=\"color: #00ff00;\">=<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2 <\/span><span style=\"color: #00ff00;\">*<\/span> <span style=\"color: #ff0000;\">100<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variables apr\u00e8s multiplic. de 15-2 par 100 \u00e0 17 :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #ffff80;\">*<\/span><span style=\"color: #97b4ff;\"> Les deux techniques suivantes marchent :<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #97b4ff;\"><span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ffffff;\">\u00a0W-SOLDMOYEN-17<\/span>  <span style=\"color: #00ff00;\">to<\/span> <span style=\"color: #ffffff;\">W-SOLDMOYEN-15-2 <\/span>\r\n<\/span><\/span>   <span style=\"font-size: small;\"> <span style=\"color: #ffff80;\">*<\/span><span style=\"color: #97b4ff;\"> ... laquelle des deux est la meilleure ?\r\n<\/span><\/span>   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">compute<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2 <\/span><span style=\"color: #00ff00;\">=<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variables apr\u00e8s passage de 17 \u00e0 15-2 :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ff0000;\">12345678901234567<\/span> <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">compute<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2 <\/span><span style=\"color: #00ff00;\">=<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-17<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'Variable 15-2 apr\u00e8s compute de 12345678901234567 :'<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'15-2 :'<\/span><span style=\"color: #ffffff;\"> W-SOLDMOYEN-15-2<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">display<\/span> <span style=\"color: #ff8040;\">'17 :'<\/span><span style=\"color: #ffffff;\">   W-SOLDMOYEN-17<\/span><\/span><\/code><\/pre>\n<p>Ce qui nous donne en sortie :<\/p>\n<pre>Variables non renseign\u00e9es :\r\n15-2 :00000000000000000\r\n17   :00000000000000000\r\nVariables renseign\u00e9es :\r\n15-2 :00000000000001234\r\n17   :00000000000001234\r\nVariables apr\u00e8s passage de 15-2 \u00e0 17 :\r\n15-2 :00000000000001234\r\n17   :00000000000000012\r\nVariables apr\u00e8s multiplic. de 15-2 par 100 \u00e0 17 :\r\n15-2 :00000000000001234\r\n17   :00000000000001234\r\nVariables apr\u00e8s passage de 17 \u00e0 15-2 :\r\n15-2 :00000000000123400\r\n17   :00000000000001234\r\nVariable 15-2 apr\u00e8s compute de 12345678901234567 :\r\n15-2 :34567890123456700\r\n17   :12345678901234567 \r\n<\/pre>\n<p>Voil\u00e0 pour les manipulations du jour, le but \u00e9tant de retrouver facilement quelles actions donne quels r\u00e9sultats en \u00e9tant s\u00fbr des donn\u00e9es et ne pas avoir \u00e0 retaper un cas de test ou de faire des displays abusifs ;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Des cas simples, toujours bon \u00e0 avoir sous la main, ou ici plus particuli\u00e8rement sous les yeux et \u00e0 port\u00e9e d&rsquo;internet ! Dans cet article je vais parler de quelques bases de manipulations de donn\u00e9es en Cobol: WORKING-STORAGE SECTION. 01 WORKING-VAR. 05 W-SOLDMOYEN-15-2 PIC S9(15)V9(2) COMP-3. 05 W-SOLDMOYEN-17 PIC S9(17) COMP-3. PROCEDURE DIVISION. display &lsquo;Variables &hellip; <a href=\"https:\/\/www.unicoda.com\/?p=1864\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Manipulations de donn\u00e9es simples&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[243,3,40],"tags":[244,247,245,249,248,246],"class_list":["post-1864","post","type-post","status-publish","format-standard","hentry","category-cobol","category-code","category-info","tag-cobol","tag-debutant","tag-manipulations","tag-notes","tag-simples","tag-test"],"_links":{"self":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1864"}],"version-history":[{"count":19,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1864\/revisions"}],"predecessor-version":[{"id":1884,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1864\/revisions\/1884"}],"wp:attachment":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}