mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
Translate Python example to Micro Focus COBOL.
This commit is contained in:
parent
435eacbd69
commit
8fd48c063b
167
COBOL/mf/src/.cobolProj
Normal file
167
COBOL/mf/src/.cobolProj
Normal file
@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="cobolProject" name="Gilded Rose" uuid="3529a385-3bb5-4b82-9b84-9e384fb2bdd4" version="4.0">
|
||||
<settings xsi:type="projectSettingsContainer">
|
||||
<copybook-paths xsi:type="copybookPathsSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</copybook-paths>
|
||||
<build-precedence-paths xsi:type="buildPrecedenceSettings">
|
||||
<path enabled="true" name="/Gilded Rose" type="mfpath"/>
|
||||
</build-precedence-paths>
|
||||
<configurations default="Gilded Rose" linkedWith="2017" xsi:type="buildConfigurationsContainer">
|
||||
<configuration description="Gilded Rose" type="single_exe" is64bit="false" createlbr="false" platform="Windows" xsi:type="cobolBuildConfiguration">
|
||||
<targetdir name="Gilded Rose.bin"/>
|
||||
<application_configuration xsi:type="runtimeConfigurationSettings">
|
||||
<cobol_switches xsi:type="projectCobolSwitches"/>
|
||||
<rts_switches xsi:type="projectRtsSwitches"/>
|
||||
<envScriptParameters></envScriptParameters>
|
||||
<envScriptPath></envScriptPath>
|
||||
<inheritBuildEnv>false</inheritBuildEnv>
|
||||
<tunables>
|
||||
<tunable index="0" name="screen_lines" value="25"/>
|
||||
<tunable index="0" name="screen_cols" value="80"/>
|
||||
<tunable index="0" name="default_cancel_mode" value="1"/>
|
||||
<tunable index="0" name="program_search_order" value="4"/>
|
||||
<tunable index="0" name="arguments_are_initial" value="false"/>
|
||||
<tunable index="0" name="command_line_accept" value="false"/>
|
||||
<tunable index="0" name="sort_memory" value="0"/>
|
||||
<tunable index="0" name="dynamic_memory_limit" value="2147483647"/>
|
||||
<tunable index="0" name="memory_free_check_size" value="100"/>
|
||||
<tunable index="0" name="memory_strategy" value="1"/>
|
||||
<tunable index="0" name="ansi_input_mode" value="false"/>
|
||||
<tunable index="0" name="current_year" value="0"/>
|
||||
<tunable index="0" name="current_month" value="0"/>
|
||||
<tunable index="0" name="current_day" value="0"/>
|
||||
<tunable index="0" name="datewarp_dynamic" value="false"/>
|
||||
<tunable index="0" name="current_hour" value="-1"/>
|
||||
<tunable index="0" name="current_minute" value="-1"/>
|
||||
<tunable index="0" name="current_second" value="-1"/>
|
||||
<tunable index="0" name="timewarp_dynamic" value="false"/>
|
||||
</tunables>
|
||||
</application_configuration>
|
||||
<link_settings xsi:type="linkSettings">
|
||||
<additional_options value=""/>
|
||||
<rts_bind value="false"/>
|
||||
<custom_link_command value=""/>
|
||||
<debug value="false"/>
|
||||
<entry_point name=""/>
|
||||
<entry_point_runtime value="false"/>
|
||||
<error_undefined_syms value="false"/>
|
||||
<application_type value="console"/>
|
||||
<include_cpp value="false"/>
|
||||
<additional_files/>
|
||||
<rcfile path=""/>
|
||||
<rts_type value="shared"/>
|
||||
<target name="Gilded Rose"/>
|
||||
<targettype type="exe"/>
|
||||
<threaded_rts value="true"/>
|
||||
<verbose value="false"/>
|
||||
</link_settings>
|
||||
</configuration>
|
||||
</configurations>
|
||||
<cobol_settings xsi:type="cobolSettings">
|
||||
<options>
|
||||
<option name="WARNING" value="1"/>
|
||||
<option name="DIALECT" value="MF"/>
|
||||
<option name="CHARSET" value="ASCII"/>
|
||||
<option name="SOURCEFORMAT" value="free"/>
|
||||
<option name="MAX-ERROR" value="100"/>
|
||||
</options>
|
||||
<createJar value="false"/>
|
||||
<createJarAfterBuild value="false"/>
|
||||
<debug value="true"/>
|
||||
<enableCodeCoverage value="true"/>
|
||||
<enableProfiler value="false"/>
|
||||
<generate value="false"/>
|
||||
<retainDirectivesFile value="false"/>
|
||||
<genListFile value="false"/>
|
||||
<packageToFolderMapping value="false"/>
|
||||
<useJvmDynamicCalls value="false"/>
|
||||
<useJvmIncrementalBuild value="false"/>
|
||||
<verbose value="false"/>
|
||||
</cobol_settings>
|
||||
<ims_settings xsi:type="additionalImsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<generatedFileDir name=""/>
|
||||
<imsDatabaseDir name=""/>
|
||||
</ims_settings>
|
||||
<mfs_settings xsi:type="mfsSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/MFS/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
</mfs_settings>
|
||||
<dbd_settings xsi:type="dbdSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/DBD/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanDbdOutputFiles value="false"/>
|
||||
</dbd_settings>
|
||||
<psb_settings xsi:type="psbSettings">
|
||||
<options>
|
||||
<option id="generate_list_file" name="LIST" value="Listing/PSB/*.lst"/>
|
||||
</options>
|
||||
<verbose value="false"/>
|
||||
<cleanPsbOutputFiles value="false"/>
|
||||
</psb_settings>
|
||||
<bms_settings xsi:type="bmsSettings">
|
||||
<options>
|
||||
<option id="dsect" name="bmsSettings" value="/SYSPARM=DSECT"/>
|
||||
<option id="decimalchar" name="bmsSettings" value="/DP=."/>
|
||||
<option id="currencychar" name="bmsSettings" value="/CS=$"/>
|
||||
<option id="sdf" name="bmsSettings" value="/IGNORE"/>
|
||||
<option id="map" name="bmsSettings" value="/SYSPARM=MAP"/>
|
||||
</options>
|
||||
</bms_settings>
|
||||
<dependent-projects xsi:type="dependentProjectsSettings"/>
|
||||
<asm_settings xsi:type="assemblerCompileSettings">
|
||||
<options>
|
||||
<option id="compile_pre_assm_macros" name="mf370chk" value="NOMPC"/>
|
||||
<option id="compile_mark_reentrant" name="mf370chk" value="RENT"/>
|
||||
<option id="compile_create_optimized_code" name="mf370chk" value="NOOPT"/>
|
||||
<option id="compile_aat_info" name="mf370chk" value="NOAAT"/>
|
||||
<option id="compile_cross_ref_listing" name="mf370chk" value="NOXREF"/>
|
||||
<option id="compile_create_debug_info" name="mf370chk" value="ANIM"/>
|
||||
<option id="compile_generate_listing" name="mf370chk" value="NOLIST"/>
|
||||
</options>
|
||||
</asm_settings>
|
||||
<asm_link_settings xsi:type="assemblerLinkSettings">
|
||||
<options>
|
||||
<option id="link_residency_mode" name="mf370lnk" value="RMODE(31)"/>
|
||||
<option id="link_linker_output" name="mf370lnk" value="OMF(390)"/>
|
||||
<option id="link_resolve_external" name="mf370lnk" value="CALL"/>
|
||||
<option id="link_mark_reusable" name="mf370lnk" value="REUS"/>
|
||||
<option id="link_generate_listing" name="mf370lnk" value="NOLIST"/>
|
||||
<option id="link_create_debug_info" name="mf370lnk" value="ANIM"/>
|
||||
<option id="link_mark_reentrant" name="mf370lnk" value="RENT"/>
|
||||
<option id="link_addressing_mode" name="mf370lnk" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_link_settings>
|
||||
<asm_cics_settings enabled="false" xsi:type="assemblerCicsSettings">
|
||||
<options>
|
||||
<option id="cics_insert_epilog_macros" name="mf370chkCics" value="EPILOG"/>
|
||||
<option id="cics_unsupported_option" name="mf370chkCics" value="UOPT(E)"/>
|
||||
<option id="cics_insert_prolog_macros" name="mf370chkCics" value="PROLOG"/>
|
||||
<option id="cics_unsupported_function" name="mf370chkCics" value="UFUNC(E)"/>
|
||||
</options>
|
||||
</asm_cics_settings>
|
||||
<asm_autolink_settings enabled="true" xsi:type="assemblerAutoLinkSettings">
|
||||
<options>
|
||||
<option id="autolink_residency_mode" name="mf370chkAutoLink" value="RMODE(31)"/>
|
||||
<option id="autolink_mark_reusable" name="mf370chkAutoLink" value="REUS"/>
|
||||
<option id="autolink_resolve_external" name="mf370chkAutoLink" value="CALL"/>
|
||||
<option id="autolink_linker_output" name="mf370chkAutoLink" value="OMF(390)"/>
|
||||
<option id="autolink_addressing_mode" name="mf370chkAutoLink" value="AMODE(31)"/>
|
||||
</options>
|
||||
</asm_autolink_settings>
|
||||
</settings>
|
||||
<files xsi:type="projectFileStore">
|
||||
<filetype type="cobol" xsi:type="cobolFileContainer">
|
||||
<file compile="true" path="GildedRose.cbl" xsi:type="cobolFile"/>
|
||||
</filetype>
|
||||
<filetype type="cobol.copybook" xsi:type="cobolFileContainer"/>
|
||||
</files>
|
||||
</project>
|
||||
2
COBOL/mf/src/.gitignore
vendored
Normal file
2
COBOL/mf/src/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.cobolBuild
|
||||
/Gilded_Rose.bin/
|
||||
17
COBOL/mf/src/.project
Normal file
17
COBOL/mf/src/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Gilded Rose</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.microfocus.eclipse.project.cobolBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.microfocus.eclipse.project.cobolNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
72
COBOL/mf/src/GildedRose.cbl
Normal file
72
COBOL/mf/src/GildedRose.cbl
Normal file
@ -0,0 +1,72 @@
|
||||
program-id. GildedRose as "GildedRose".
|
||||
|
||||
file-control.
|
||||
select in-items assign 'in-items'.
|
||||
select items assign 'items'.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd in-items.
|
||||
01 in-item pic x(58).
|
||||
fd items.
|
||||
01 item.
|
||||
02 sell-in pic 9(4).
|
||||
02 quality pic 9(4).
|
||||
02 name pic x(50).
|
||||
|
||||
working-storage section.
|
||||
procedure division.
|
||||
open input in-items output items.
|
||||
start-lable.
|
||||
read in-items end go to end-lable.
|
||||
move in-item to item.
|
||||
if name not equal "Aged Brie" and name not equal "Backstage passes to a TAFKAL80ETC concert"
|
||||
if quality greater then 0
|
||||
if name not equal to "Sulfuras, Hand of Ragnaros"
|
||||
compute quality = quality - 1
|
||||
end-if
|
||||
end-if
|
||||
else
|
||||
if quality is less then 50
|
||||
compute quality = quality + 1
|
||||
if name equals "Backstage passes to a TAFKAL80ETC concert"
|
||||
if sell-in less then 11
|
||||
if quality less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
if sell-in less then 6
|
||||
if quality less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
if name not equal "Sulfuras, Hand of Ragnaros"
|
||||
compute sell-in = sell-in - 1
|
||||
end-if
|
||||
if sell-in is less then 0
|
||||
if name is not equal to "Aged Brie"
|
||||
if name is not equal to "Backstage passes to a TAFKAL80ETC concert"
|
||||
if quality is greater then 0
|
||||
if name is equal to "Sulfuras, Hand of Ragnaros"
|
||||
compute quality = quality - 1
|
||||
end-if
|
||||
end-if
|
||||
else
|
||||
compute quality = quality - quality
|
||||
end-if
|
||||
else
|
||||
if quality is less then 50
|
||||
compute quality = quality + 1
|
||||
end-if
|
||||
end-if
|
||||
end-if
|
||||
write item.
|
||||
go to start-lable.
|
||||
end-lable.
|
||||
close items.
|
||||
goback.
|
||||
|
||||
end program GildedRose.
|
||||
Loading…
Reference in New Issue
Block a user