Skip to content

Instantly share code, notes, and snippets.

@blippy
Created October 29, 2016 19:44
Show Gist options
  • Select an option

  • Save blippy/a21dc4aa45e3b330fa70157d4019dbce to your computer and use it in GitHub Desktop.

Select an option

Save blippy/a21dc4aa45e3b330fa70157d4019dbce to your computer and use it in GitHub Desktop.
In one version, out the other.
001000 IDENTIFICATION DIVISION.
* 2016-10-29 created by mcarter
* convert version3 to version 4
001010 PROGRAM-ID. v3-v4.
002000 ENVIRONMENT DIVISION.
002010 INPUT-OUTPUT SECTION.
FILE-CONTROL.
select fd-in assign to ws-fd-in-name 12
organisation is line sequential.
003000 DATA DIVISION.
003010 FILE SECTION.
FD fd-in. 1
01 inline pic x(80).
003020 WORKING-STORAGE SECTION.
01 ws-fd-in-name pic x(50). 2
01 command pic x(7).
77 CR pic X value X'0A'.
01 acc-in pic X(6).
* 01 cr-acc-in pic X(6).
* 01 dr-acc-in pic X(6).
01 amount-in pic X(10).
01 buy-in pic X.
01 chg-in pic x(15).
01 chgpc-in pic x(15).
01 chgpcv pic S9(3)V9(4).
01 chgv pic S9(4)V9(6).
01 desc-in pic x(20).
01 etran-in pic x(20).
01 nb-in pic x(74).
01 qty-in pic X(15).
01 sym-in pic X(6).
01 taxable-in pic X.
01 dstamp-in pic X(10).
*05 command pic x(4) value "etran".
*05 filler pic X.
01 comm-rec.
05 comm-sym pic x(6).
05 filler pic X.
05 comm-dload pic x.
05 filler pic X.
05 comm-type pic x(4).
05 filler pic X.
05 comm-currency pic x(4).
05 filler pic X.
05 filler pic x value '"'.
05 comm-name pic x(25).
05 filler pic x value '"'.
01 etran-rec.
05 etran-dstamp pic x(10).
05 filler pic X.
05 etran-acc pic X(6).
05 filler pic x.
05 etran-sym pic X(6).
05 filler pic x.
05 etran-qty pic 9(6).999.
05 filler pic x.
05 etran-amount pic 9(6).99.
05 filler pic x.
05 etran-buy pic X.
05 filler pic x.
05 etran-taxable pic X.
05 filler pic XX value ' "'.
05 etran-desc pic X(40).
05 filler pic X value '"'.
01 leak-rec.
05 leak-dstamp pic x(10).
05 filler pic x.
05 leak-folio pic x(6).
05 filler pic x.
05 leak-sym pic x(6).
05 filler pic x.
05 leak-amount pic 9(6).99.
05 filler pic x.
05 leak-t pic x.
05 filler pic x.
05 filler pic X value '"'.
05 leak-desc pic x(40).
05 filler pic X value '"'.
01 nacc-rec.
05 nacc-acc pic x(6).
05 filler pic x.
05 nacc-alt pic x(6).
05 filler pic x.
05 nacc-type pic x.
05 filler pic x.
05 nacc-scale pic +9.
05 filler pic x.
05 filler pic XX value ' "'.
05 nacc-desc pic x(30).
05 filler pic XX value ' "'.
01 ntran-rec.
05 ntran-dstamp pic x(10).
05 filler pic x.
05 ntran-dr-acc pic x(6).
05 filler pic x.
05 ntran-cr-acc pic x(6).
05 filler pic x.
05 ntran-amount pic 9(6).99.
05 filler pic x.
05 filler pic x value '"'.
05 ntran-desc pic x(37).
05 filler pic x value '"'.
01 yahoo-rec.
05 yahoo-dstamp pic x(10).
05 filler pic x.
05 yahoo-tstamp pic x(8).
05 filler pic x.
05 yahoo-sym pic x(6).
05 filler pic x.
05 yahoo-rox pic 99.9(4).
05 filler pic x.
05 yahoo-price pic 9(5).9(6).
05 filler pic x.
*05 yahoo-chg-sgn pic x.
05 yahoo-chg pic +9(4).9(6).
05 filler pic x.
* 05 yahoo-chgpc-sgn pic x.
05 yahoo-chgpc pic +9(3).9(4).
05 filler pic x.
05 yahoo-unit pic x(3).
05 filler pic x.
05 filler pic x value '"'.
05 yahoo-desc pic x(40).
05 filler pic x value '"'.
003030 LOCAL-STORAGE SECTION.
003040 LINKAGE SECTION.
004000 PROCEDURE DIVISION.
program-begin.
move "shell.cob" to ws-fd-in-name. 2
* display "=== ECHOING FILE ==="
* open input fd-in.
perform forever
accept command
evaluate command
when "bl"
*display "blank"
display CR with no advancing
when "comm-1"
perform process-comm-1
when "etran"
perform process-etran
when "etran-1"
perform process-etran-1
when "leak-1"
perform process-leak-1
when "nacc"
perform process-nacc
when "nb"
perform process-nb
when "ntran"
perform process-ntran
when "yahoo"
perform process-yahoo
when "yahoo-1"
perform process-yahoo-1
when "QUIT"
stop run
when other
display "*** didn't understand: " command
end-evaluate
* if cmd = "QUIT" then stop run
* read fd-in
* at end exit perform
* not at end display inline
* end-read
end-perform
*display "=== FINISHED ==="
* close fd-in.
.
program-done.
stop run.
process-comm-1.
accept comm-sym
accept comm-dload
accept comm-type
accept comm-currency
accept comm-name
display "comm-1 " comm-rec
.
process-etran-any.
accept taxable-in
move taxable-in to etran-taxable
accept dstamp-in
move dstamp-in to etran-dstamp
accept buy-in
move buy-in to etran-buy
accept acc-in
move acc-in to etran-acc
accept sym-in
move sym-in to etran-sym
accept qty-in
move qty-in to etran-qty
accept amount-in
move amount-in to etran-amount
.
process-etran.
perform process-etran-any
move "no desc" to etran-desc
display "etran-1 " etran-rec
.
process-etran-1.
perform process-etran-any
accept etran-desc
display "etran-1 " etran-rec
.
process-leak-1.
accept leak-t
accept leak-dstamp
accept leak-folio
accept leak-sym
accept amount-in
move amount-in to leak-amount
accept leak-desc
display "leak-1 " leak-rec
.
process-nacc.
accept nacc-acc
accept nacc-alt
accept nacc-type
accept nacc-scale
*if nacc-scale = "1" move "I 1" to nacc-scale
accept nacc-desc
display "nacc " nacc-rec
.
process-etran-1.
perform process-etran-any
accept etran-desc
display "etran-1 " etran-rec
.
process-leak-1.
accept leak-t
accept leak-dstamp
accept leak-folio
accept leak-sym
accept amount-in
move amount-in to leak-amount
accept leak-desc
display "leak-1 " leak-rec
.
process-nacc.
accept nacc-acc
accept nacc-alt
accept nacc-type
accept nacc-scale
*if nacc-scale = "1" move "I 1" to nacc-scale
accept nacc-desc
display "nacc " nacc-rec
.
process-nb.
accept nb-in
display 'nb "' nb-in '"'
.
process-ntran.
accept ntran-dstamp
accept ntran-dr-acc
accept ntran-cr-acc
accept amount-in
move amount-in to ntran-amount
accept ntran-desc
display "ntran " ntran-rec
.
process-yahoo-any.
accept yahoo-dstamp
accept yahoo-tstamp
accept yahoo-sym
accept yahoo-rox
accept yahoo-price
accept chg-in
* move chg-in to chgv
move chg-in to yahoo-chg
* move '+' to yahoo-chg-sgn
* if chgv <0
* move '-' to yahoo-chg-sgn
* multiply chgv by -1 giving chgv
* move chgv to yahoo-chg
* end-if
*display "AAA " chgv
* move abs(chgv) to yahoo-chg
accept chgpc-in
move chgpc-in to yahoo-chgpc
* move chgpc-in to chgpcv
* move '+' to yahoo-chgpc-sgn
* if chgpcv <0 move '-' to yahoo-chgpc-sgn
* move chgpcv to yahoo-chgpc
accept yahoo-unit
.
process-yahoo.
perform process-yahoo-any
move "no desc" to yahoo-desc
display "yahoo-1 " yahoo-rec
.
process-yahoo-1.
perform process-yahoo-any
accept yahoo-desc
display "yahoo-1 " yahoo-rec
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment