Skip to main content

COBCH0845 Unknown class: DirectoryServices in Visual COBOL

  • March 14, 2018
  • 0 replies
  • 0 views

Hi,

Product Information : Enterprise developer 3.0 Eclipse. 


I am writing a program to store the password in projected by using the Hash algorithm. while writing the below code getting error "COBCH0845S Unknown type 'type System.Security.Cryptography.SHA1Managed'"
- COBCH0012S Operand mymessage is not declared
COBCH0845S Unknown type 'type System.Text.StringBuilder'

Program :------

configuration section.
repository.

class cSHA1Managed as "System.Security.Cryptography.SHA1Managed"

class cStringBuilder as "System.Text.StringBuilder".
data division.
working-storage section.



01 PWD pic x(22) value "This is a TEST String.".

01 mySHA1 cSHA1Managed.
Errror : "COBCH0845S Unknown type 'type System.Security.Cryptography.SHA1Managed'"
01 myByteArray binary-char unsigned occurs any. *> Byte Array

01 myHash 
binary-char unsigned occurs any. *> Byte Array

01 ws-byte binary-char unsigned. *> Byte

01 strBuilder cStringBuilder.
Error : "COBCH0845S Unknown type 'type System.Security.Cryptography.SHA1Managed'"
01 array-len binary-long.

procedure division.
***** Create a SHA1 Hashing Instance
set mySHA1 to cSHA1Managed::"New"()


set myByteArray to mymessage
Error : -- Multiple markers at this line
- COBCH1710S 'type HashIt' has no member with name 'mymessage'
- COBCH0012S Operand mymessage is not declared
set myHash to mySHA1::"ComputeHash"(myByteArray)

goback.
create-hex-string section.

****************************************** 

* Create Hex String from Byte[]

****************************************** 
set strBuilder to cStringBuilder::"New"()

set array-len to myHash::"Length"

move length of myHash to array-len

perform varying ws-byte through myHash

invoke strBuilder::"Append"(String::"Format"("{0,2:x}", ws-byte)::"Replace"(" " , "0"))

end-perform
end program HashIt.


_____________________________

Can any of you please guide/suggest. This may not be the right one for Enterprise Developer for Eclipse.


#EnterpriseServer

0 replies

Be the first to reply!