Upgrade to Pro — share decks privately, control downloads, hide ads and more …

メドレー開発部TechLunch ORCAとCOBOLと WATASHI

メドレー開発部TechLunch ORCAとCOBOLと WATASHI

メドレー開発部TechLunchで発表した内容を掲載しました。

メドレーで開発部では、隔週で社内勉強会が開かれています。
今回は、「ORCAとCOBOLと WATASHI」というタイトルで発表し、医療系の分野でサービス開発・運営するエンジニアとして、医療分野のレガシーな技術に触れる機会となりました。

発表者:竹内正明

D879794ea42768ea417f970914430d56?s=128

Medley Inc.

April 18, 2017
Tweet

Transcript

  1. ORCAͱCOBOLͱ WATASHI

  2. ࣗݾ঺հ • ஛಺ ਖ਼໌ • ΦϯϥΠϯපؾࣄయMEDLEYͷ։ൃ୲౰

  3. ࠓ೔࿩͢͜ͱ • ORCAͱ͸Կ͔ʗϨηίϯͱ͸Կ͔ • ೔ϨηͷγεςϜߏ੒ʹ͍ͭͯ • COBOLͷجૅ

  4. ORCAͱ͸Կ͔ʗϨηίϯͱ͸Կ͔

  5. Ϩηϓτʹ͍ͭͯ • Ϩηϓτ - Wikipedia • ʮױऀ͕ड͚ͨอݥ਍ྍʹ͍ͭͯɺҩྍػ͕ؔอݥऀʢࢢொ ଜ΍݈߁อݥ૊߹౳ʣʹ੥ٻ͢Δҩྍใुͷ໌ࡉॻʯ

  6. Ϩηίϯʹ͍ͭͯ • Ϩηϓτίϯϐϡʔλ - Wikipedia • ʮ໌ࡉॻͷ࡞੒ʹ͸ߴ౓ͳઐ໳஌ࣝͱෳࡶͳܭࢉ͕ඞཁʯͰ ͋ͬͨ • ҩྍػؔͷෛ୲ΛݮΒ͢໨తͰɺ1970೥୅ࠒ͔Βొ৔

  7. վΊͯORCAͱ͸ • ORCAϓϩδΣΫτ • ORCA Projectɿ ORCAϓϩδΣΫτͷ֓ཁ • ʮҩࢣձ૯߹৘ใωοτϫʔΫߏ૝ʯͷߏ੒ཁૉͷͻͱͭ •

    ҩࢣɺҩྍػؔɺ୭Ͱ΋ແྉͰ࢖͑ΔOSSΛ഑෍
  8. ORCAͷϨηίϯ • ORCAͷެ։͢ΔϨηίϯ=೔ҩඪ४Ϩηϓτιϑτ • ʮશࠃ໿10ສՕॴͷҩྍػؔͷׂ̔Ҏ্ʯ͕Ϩηίϯಋೖ • ߴ͍΋ͷ͕ଟ͍ • ֤ࣾσʔλͷޓ׵ੑ͕ͳ͍ •

    ʮҩྍ৘ใͷඪ४Խʯʮҩྍͷ࣭޲্ʯͷͨΊϨηίϯΛ։ ൃɺ഑෍
  9. None
  10. None
  11. ೔ϨηͷγεςϜߏ੒ʹ͍ͭͯ

  12. ORCAʢ೔Ϩηʣͷٕज़৘ใ • ORCA Projectɿ ٕज़৘ใ • αʔόαΠυʢMONTSUQIʣ • ORCAͷ֩ͱͳΔۀ຿γεςϜߏஙϛυϧ΢ΣΞ •

    ΫϥΠΞϯταΠυʢglclientɺmonsiajʣ • ٕज़ελοΫ • Linux/C/COBOL/Postgresql/Java • ϛυϧ΢ΣΞͷϦχϡʔΞϧ༧ఆˠginbee • https://github.com/montsuqi/panda/tree/ginbee48
  13. ORCAʢ೔ϨηʣͷγεςϜߏ੒

  14. ORCAʢ೔Ϩηʣͷ࢓૊ΈΛཧղ͍ͨ͠ • ҎԼʹ͍ͭͯɺཧղ͢Δඞཁ͕͋Δ • MONTSUQI • COBOL • ࠓճ͸COBOLͷجૅΛ঺հ •

    ୭͔MONTSUQIʢor ginbeeʣʹ͍ͭͯษڧͯ͠ڭ͑ͯͩ͘ ͍͞
  15. COBOLͷجૅ

  16. COBOL • COBOL - Wikipedia • Common Business Oriented Language

    • ࣄ຿ॲཧ༻ʹ1959೥ʹ։ൃ͞Εͨ • ʮࣗવݴޠͰ͋Δӳޠʹ͍ۙهड़ΛΊͨ͟͠ʯ • ։ൃऀ͸άϨʔεɾϗούʔ - Wikipedia • ΞϝϦΧւ܉ͷ܉ਓ͔ͭܭࢉػՊֶऀʢ࠷ऴ֊ڃ͸।কʣ
  17. COBOLΛษڧͯ͠ΈΑ͏ • ։ൃ؀ڥˠDockerͰ४උ͢Δ • https://github.com/ise/cobol-sample • ࢀߟαΠτɿॻ͖ॳΊίʔσΟϯάʂ Docker + CGI

    + COBOLͳ؀ڥΛ࡞ͬͯԹނ஌৽
  18. ίϯύΠϧʗ࣮ߦํ๏ # ίϯύΠϧ $ docker run --rm -v /Users/masaakitakeuchi/git_work/ise/cobol-sample:/cobol cobol

    cobc -x --free src/hoge.cob -o bin/exec # ίϯύΠϧΦϓγϣϯʹ͍ͭͯ # -xɿ࣮ߦϑΝΠϧΛ࡞੒͢Δ # --freeɿࣗ༝ܗࣜˠʮݻఆܗࣜ΍ՄมܗࣜͷҰ࿈൪߸ྖҬɺඪࣝྖҬ͕ແ͘ɺࣗ༝ʹهड़Ͱ͖·͢ɻʯͱͷ͜ͱ # https://plaza.rakuten.co.jp/u703331/diary/201103310000/ # http://software.aufheben.info/linux/freepascal.html # https://codezine.jp/article/detail/2303 # ͪͳΈʹʮ-CʯͰCݴޠͷιʔεΛు͖ग़ͯ͘͠ΕΔ # ࣮ߦ $ docker run -it --rm -v /Users/masaakitakeuchi/git_work/ise/cobol-sample:/cobol cobol bin/exec
  19. Hello, COBOL IDENTIFICATION DIVISION. PROGRAM-ID. HELLO_WORLD. ENVIRONMENT DIVISION. DATA DIVISION.

    PROCEDURE DIVISION. DISPLAY "Hello, COBOL". STOP RUN.
  20. શମ૾ • ݟग़͠෦ʢIDENTIFICATION DIVISIONʣ • ϓϩάϥϜ໊΍࡞੒ऀ౳Λهड़ • ؀ڥ෦ʢENVIRONMENT DIVISIONʣ •

    ಡΈॻ͖͢ΔϑΝΠϧ৘ใ౳Λهड़ • σʔλ෦ʢDATA DIVISIONʣ • ϑΝΠϧϑΥʔϚοτɺม਺ʢσʔλ߲໨ʣ౳Λهड़ • खଓ͖෦ʢPROCEDURE DIVISIONʣ • ࣮ࡍͷॲཧΛهड़
  21. ม਺ • ม਺ˠCOBOLͰ͸ʮσʔλ߲໨ʯΒ͍͠ *> 01͸Ϩϕϧ൪߸ *> CNT01͕ม਺໊ *> PIC͸PICTURE۟Ͱσʔλ߲໨Λఆٛ͢ΔͨΊͷจ๏ *>

    9(1)͸਺ࣈҰܻ *> VALUEͰॳظ஋ઃఆ DATA DIVISION. WORKING-STORAGE SECTION. 01 CNT01 PIC 9(1) VALUE 0.
  22. ഑ྻ • ഑ྻˠCOBOLͰ͸ʮςʔϒϧʯΒ͍͠ *> Ϩϕϧ൪߸͸ *> 1͕࠷্Ґͷ֊૚ͱͳΓɺ਺ࣈ͕૿͑Δ΄ͲԼҐͷ֊૚ͱͳΓ·͢ *> ͱͷ͜ͱ *>

    http://tallercolibri.com/archives/104 *> OCCURS͕۟഑ྻఆٛ༻ͷจ๏ DATA DIVISION. WORKING-STORAGE SECTION. 01 TABLE01. 03 ELEM OCCURS 3. 05 VAL PIC 9(1).
  23. ͍Ζ͍Ζͳจ • DISPLAYจ • දࣔ • COMPUTEจ • ࢉज़ԋࢉ •

    COMPUTE CNT = 1 + 1Έ͍ͨͳײ͡ • MOVEจ • సه • ୅ೖ༻్ͬΆ͍͕ɺʮඪ४ܻدͤنଇͱݺ͹ΕΔϧʔϧ͕͋Γɺඇ਺ࣈ߲໨͸ࠨدͤʹసه͠ɺ༨Γͷ෦෼͸ ۭനจࣈͰิΘΕ·͢ʯͱͷ͜ͱ • http://www.atmarkit.co.jp/ait/articles/0906/11/news104_3.html • MOVE 0 TO CNT
  24. ෼ذ *> IF͸ׂΓͱී௨ IF A = B DISPLAY "ಉ͡" END-IF

    *> EVALUATE͸switchจ΍caseจΈ͍ͨͳײ͡ EVALUATE CNT WHEN 1 DISPLAY "ONE" WHEN 2 DISPLAY "TWO" END-EVALUATE.
  25. ܁Γฦ͠ • ͍Ζ͍Ζ͋Δ͚Ͳɺɺɺ *> ഑ྻELEMͷͦΕͧΕʹ1͔Β3Λ୅ೖ PERFORM VARYING CNT FROM 1

    BY 1 UNTIL CNT > 3 MOVE CNT TO ELEM(CNT) END-PERFORM
  26. ͦͯ͠ਓੜ͸ଓ͘ • ຾͍ • ؔ਺ఆٛɺݺͼग़͠ • ϑΝΠϧೖग़ྗ • ֎෦ϓϩάϥϜݺͼग़͠ •

    ாථ • …
  27. FizzBuzzͷྫ • https://github.com/ise/cobol-sample/blob/master/src/fizzbuzz.cob IDENTIFICATION DIVISION. PROGRAM-ID. FIZZ_BUZZ. DATA DIVISION. WORKING-STORAGE

    SECTION. 01 CNT PIC 9(3) VALUE 0. 01 MOD3 PIC 9(1) VALUE 0. 01 MOD5 PIC 9(1) VALUE 0. PROCEDURE DIVISION. PERFORM VARYING CNT FROM 1 BY 1 UNTIL CNT > 100 COMPUTE MOD3 = FUNCTION MOD(CNT 3) COMPUTE MOD5 = FUNCTION MOD(CNT 5) IF MOD3 = 0 AND MOD5 = 0 DISPLAY "FizzBuzz" ELSE IF MOD3 = 0 DISPLAY "Fizz" ELSE IF MOD5 = 0 DISPLAY "Buzz" ELSE DISPLAY CNT END-IF END-PERFORM. • আࢉΛආ͚ΔྫˠFizzBuzz໰୊ - COBOLٕज़ऀͷ༕ᓔ
  28. ͓·͚ʢ̍ʣ • Ͳ͏ͯ͠΋ORCAͷίʔυΛಡΈ͍ͨਓ΁ • ࡶͳCOBOLίʔυҰཡ • https://github.com/ise/orca-jma-receipt-study/blob/ master/cobol.md

  29. ͓·͚ʢ̎ʣ • Ͳ͏ͯ͠΋ORCAͷίʔυΛಡΈ͍ͨਓ΁ # ϦϙδτϦऔಘ $ brew install cvs $

    curl http://ftp.orca.med.or.jp/pub/data/receipt/tec/orcacvs > ~/bin/orcacvs $ chmod +x ~/bin/orcacvs $ cvs -d :ext:anoncvs@cvs.orca.med.or.jp:/cvs co jma-receipt
  30. ࢀߟαΠτʢORCAʣ • ORCA Projectɿ ٕज़৘ใ • ORCA | ͓ͪ͝ΌΜͷࡶจ •

    ORCA࣍ظFW։ൃͷݱঢ় • ҩྍ෼໺ʹ͓͚ΔΦʔϓϯιʔειϑτ΢ΣΞͷ։ൃͱར༻ • http://www.opensquare.co.jp/seminar/document/19/3-OpenCOBOL • https://ftp.orca.med.or.jp/pub/data/news/orca-conference-2015-document-7-ginbee1.pdf • ORCAΧϯϑΝϨϯε2015ɹGinbee։ൃঢ়گʹ͍ͭͯ - ͓஌Βͤ • ೔ҩITઓུηογϣϯʙORCAɾ೔ҩೝূہͷࠓޙͷൃలʹ޲͚ͯʮ೔Ϩηͱ࿈ܞιϑτʢిࢠΧϧςͳͲʣͷ࠷৽৘ใʯ - ͓஌Βͤ • xenialORCA - ORCA ؆୯ Πϯετʔϧ • ORCAΧϯϑΝϨϯε2016 - ORCAϓϩδΣΫτ | Doorkeeper • ORCAΧϯϑΝϨϯε2015ɹ৽ͨͳ̖̥̞ʢ̧̝̖̤̞ʣʹ͍ͭͯ - ͓஌Βͤ • https://ftp.orca.med.or.jp/pub/data/news/orca-conference-2015-document-6-haori.pdf • ϔϧεέΞ͚ͩͰऴΘΒͤͳ͍ҩྍITʢ6ʣɿษڧձͰ໌Β͔ʹͳͬͨҩྍ޲͚OSSͷଟ༷ͳ׆༻๏ᴷᴷిࢠΧϧςɺྟচࢼݧσʔλղੳɺ೔ຊޠҩֶ༻ޠϓϥ οτϑΥʔϜɺը૾DB (1/4) - ˏIT • http://www.ssk.or.jp/seikyushiharai/gyomuflow/gyomuflow_01.html
  31. ࢀߟαΠτʢCOBOLʣ • αϧͰ΋Θ͔ΔCOBOLೖ໳ ʲͻΑ͜άϛʳ • COBOLϓϩάϥϛϯάೖ໳ • COBOL - Getting

    Started - ˏIT • COBOLϓϩάϥϛϯά࿈ࡌҰཡɿCodeZineʢίʔυδϯʣ • COBOLެࣜαΠτ
  32. ·ͱΊ • ORCAͱCOBOLʹ͍ͭͯ঺հͨ͠ • COBOL໘ന͍Ͱ͢Ͷ • ͳΜ͔ͩ৺͕๛͔ʹͳΓ·ͨ͠Ͷ • Զͨͪͷઓ͍͸͜Ε͔Βͩ

  33. ͋Γ͕ͱ͏͍͟͝·ͨ͠