Creating a New COBOL JVM Class

You need to create a new COBOL JVM Class in the addressBookWrapper project which will hold the record data:

  1. Right-click addressBookWrapper, and then click New > COBOL JVM Class

    This opens the New COBOL JVM Class dialog box.

  2. In the Name field, type RecordDTO
  3. Click Finish.

    This opens the RecordDTO.cbl program in a COBOL editor.

  4. In the working-storage section, define the public properties that describe a record - its name, address, phone number, and so forth. Your program should look like this:
           class-id com.addressBookWrapper.RecordDTO public.
    
           working-storage section.
             01 recordID binary-long property with no set public value 0.
             01 #name string property public value "".
             01 family string property public value "".
             01 postalCode binary-long property public value 0.
             01 city string property public value "".
             01 street string property public value "".
             01 phone string property public value "".
           method-id instanceMethod.
           local-storage section.
           procedure division.
    
               goback.
           end method.
           
           end class.
    
  5. Define a constructor that can receive id as an integer and that sets the recordID property to the id:
    	   method-id New protected.
               procedure division using by value #id as binary-long.
               set recordID to #id
               goback.
           end method.
    Note: Type met and then use Content Assist on the context menu. Alternatively, press Ctrl+Space.
  6. Click File > Save.