Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
move name-field (K:) to name-key
move a-word (K:) to name-key
identification division.
program-id. wordxref.
data division.
working-storage section.
01 name-field pic x(100).
01 a-word pic x(50).
01 I pic 9(5) BINARY.
01 J pic 9(5) BINARY.
01 K pic 9(5) BINARY.
procedure division.
a.
move "JONATHAN" to name-field.
perform xref.
move "NATHANIEL" to name-field.
perform xref.
move "JOHN JON ANDERSAN" to name-field.
perform xref.
stop run.
xref.
move 1 to I
perform until I > 100
unstring NAME-FIELD delimited by all spaces
into a-word count in J
pointer I
end-unstring
if J > 1
subtract 1 from J
perform varying K from 1 by 1 until K > J
display a-word (K:)
end-perform
end-if
end-perform.
JONATHAN
ONATHAN
NATHAN
ATHAN
THAN
HAN
AN
NATHANIEL
ATHANIEL
THANIEL
HANIEL
ANIEL
NIEL
IEL
EL
JOHN
OHN
HN
JON
ON
ANDERSAN
NDERSAN
DERSAN
ERSAN
RSAN
SAN
AN
if J > 1
subtract 1 from J
perform varying K from 1 by 1 until K > J
perform varying L from 2 by 1 until L > J + 2 - K
display a-word (K:L)
end-perform
end-perform
end-if
end-perform.
[\code]
Glenn
MOVE INPUT-STRING(1:CTR-1) TO NAME-KEY.
START xref-file KEY = NAME-KEY SIZE CTR-1
INVALID KEY
display "name does not exist"
END-START