Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/String-prepend/COBOL/string-prepend-1.cobol
Normal file
25
Task/String-prepend/COBOL/string-prepend-1.cobol
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
identification division.
|
||||
program-id. prepend.
|
||||
data division.
|
||||
working-storage section.
|
||||
1 str pic x(30) value "World!".
|
||||
1 binary.
|
||||
2 len pic 9(4) value 0.
|
||||
2 scratch pic 9(4) value 0.
|
||||
procedure division.
|
||||
begin.
|
||||
perform rev-sub-str
|
||||
move function reverse ("Hello ") to str (len + 1:)
|
||||
perform rev-sub-str
|
||||
display str
|
||||
stop run
|
||||
.
|
||||
|
||||
rev-sub-str.
|
||||
move 0 to len scratch
|
||||
inspect function reverse (str)
|
||||
tallying scratch for leading spaces
|
||||
len for characters after space
|
||||
move function reverse (str (1:len)) to str
|
||||
.
|
||||
end program prepend.
|
||||
12
Task/String-prepend/COBOL/string-prepend-2.cobol
Normal file
12
Task/String-prepend/COBOL/string-prepend-2.cobol
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
>>SOURCE FREE
|
||||
PROGRAM-ID. prepend.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 str PIC X(30) VALUE "world!".
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
MOVE FUNCTION CONCATENATE("Hello, ", str) TO str
|
||||
DISPLAY str
|
||||
.
|
||||
END PROGRAM prepend.
|
||||
Loading…
Add table
Add a link
Reference in a new issue