Caché ObjectScript Tutorial
Exercise 2: Second Data Entry Routine
[Back] 
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Search:    

  1. Start Caché Studio, and open the mydatent routine.
  2. Enter the following ObjectScript:
    mydatent ; second data entry routine
    
    main ; main loop section
        do {
            do prompt()
            quit:(name = "")
            do display()
        }
        while name'=""
        quit
    
    prompt() [name, phone, dob]
        {
        ; procedure for prompting
        read !, "Name: ", name
        quit:(name="")  ; user entered nothing
        read !, "Phone: ", phone
        read !, "DOB: ", dob
        write !!
        }
    
    display() [name, phone, dob]
        {
        ; display the data
        write !, "Name:", ?20, name
        write !, "Phone:", ?20, phone
        write !, "DOB:", ?20, dob
        }