RosettaCodeData/Task/Hostname/COBOL/hostname.cobol
2017-09-25 22:28:19 +02:00

15 lines
466 B
COBOL

identification division.
program-id. hostname.
data division.
working-storage section.
01 hostname pic x(256).
01 nullpos pic 999 value 1.
procedure division.
call "gethostname" using hostname by value length of hostname
string hostname delimited by low-value into hostname
with pointer nullpos
display "Host: " hostname(1 : nullpos - 1)
goback.
end program hostname.