newtoclarion
Programmer
I face problem in trying the code in clarion 6.3 help
I see the code but dont know where to put it
for example these codes
!***code 1*******
PROGRAM !Example program code
MAP
OpenFile PROCEDURE(FILE AnyFile)!Procedure prototype with parameter
ShoTime PROCEDURE !Procedure prototype without parameter
DayString PROCEDURE,STRING !Procedure prototype with a return value
END
FileOne FILE,DRIVER('Clarion') !Declare a file
RECORD !begin record declaration
Name STRING(20)
Number LONG
END ! end record declaration
END !End file declaration
TodayString STRING(9)
CODE
TodayString = DayString() !Procedure called with a return value
OpenFile(FileOne) !Call procedure to open file
ShoTime !Call ShoTime procedure
!More executable statements
OpenFile PROCEDURE(FILE AnyFile)!Open any file
CODE !Begin code section
OPEN(AnyFile) !Open the file
IF ERRORCODE() = 2 !If file not found
CREATE(AnyFile) !create it
END
RETURN !Return to caller
ShoTime PROCEDURE !Show time
Time LONG !Local variable
Window WINDOW,CENTER
STRING(@T3),USE(Time),AT(34,70)
BUTTON('Exit'),AT(138,92),USE(?Exit)
END
CODE !Begin executable code section
Time = CLOCK() !Get time from system
OPEN(Window)
ACCEPT
CASE ACCEPTED()
OF ?Exit
BREAK
END
END
RETURN !Return to caller
DayString PROCEDURE !Day string procedure
ReturnString STRING(9),AUTO !Uninitialized local stack variable
CODE !Begin executable code section
EXECUTE (TODAY() % 7) + 1 !Find day of week from system date
ReturnString = 'Sunday'
ReturnString = 'Monday'
ReturnString = 'Tuesday'
ReturnString = 'Wednesday'
ReturnString = 'Thursday'
ReturnString = 'Friday'
ReturnString = 'Saturday'
END
RETURN(ReturnString) !Return the resulting string
!**********code2*****
Name CSTRING(21) !Declare 21 byte field - 20 bytes data
OtherName CSTRING(21),OVER(Name) !Declare field over name field
Contact CSTRING(21),DIM(4) !Array 21 byte fields - 80 bytes data
Company CSTRING('SoftVelocity Corporation') !21 byte string - 20 bytes data
Phone CSTRING(@P(###)###-####P) !Declare 14 bytes - 13 bytes data
ExampleFile FILE,DRIVER('Btrieve') !Declare a file
Record RECORD
NameField CSTRING(21),NAME('ZstringField') !Declare with external name
END
END
CODE
Name = 'Tammi' !Assign a value
Name[5] = 'y' ! then change fifth letter
Name[6] = 's' ! then add a letter
Name[7] = '<0>' ! and handle null terminator
Name[5:6] = 'ie' ! and change a "slice"
! -- the fifth and sixth letters
Contact[1] = 'First' !Assign value to first element
Contact[1,2] = 'u' !Change first element 2nd character
Contact[1,2:3] = Name[5:6] !Assign slice to slice
!*****end****************
please help
I see the code but dont know where to put it
for example these codes
!***code 1*******
PROGRAM !Example program code
MAP
OpenFile PROCEDURE(FILE AnyFile)!Procedure prototype with parameter
ShoTime PROCEDURE !Procedure prototype without parameter
DayString PROCEDURE,STRING !Procedure prototype with a return value
END
FileOne FILE,DRIVER('Clarion') !Declare a file
RECORD !begin record declaration
Name STRING(20)
Number LONG
END ! end record declaration
END !End file declaration
TodayString STRING(9)
CODE
TodayString = DayString() !Procedure called with a return value
OpenFile(FileOne) !Call procedure to open file
ShoTime !Call ShoTime procedure
!More executable statements
OpenFile PROCEDURE(FILE AnyFile)!Open any file
CODE !Begin code section
OPEN(AnyFile) !Open the file
IF ERRORCODE() = 2 !If file not found
CREATE(AnyFile) !create it
END
RETURN !Return to caller
ShoTime PROCEDURE !Show time
Time LONG !Local variable
Window WINDOW,CENTER
STRING(@T3),USE(Time),AT(34,70)
BUTTON('Exit'),AT(138,92),USE(?Exit)
END
CODE !Begin executable code section
Time = CLOCK() !Get time from system
OPEN(Window)
ACCEPT
CASE ACCEPTED()
OF ?Exit
BREAK
END
END
RETURN !Return to caller
DayString PROCEDURE !Day string procedure
ReturnString STRING(9),AUTO !Uninitialized local stack variable
CODE !Begin executable code section
EXECUTE (TODAY() % 7) + 1 !Find day of week from system date
ReturnString = 'Sunday'
ReturnString = 'Monday'
ReturnString = 'Tuesday'
ReturnString = 'Wednesday'
ReturnString = 'Thursday'
ReturnString = 'Friday'
ReturnString = 'Saturday'
END
RETURN(ReturnString) !Return the resulting string
!**********code2*****
Name CSTRING(21) !Declare 21 byte field - 20 bytes data
OtherName CSTRING(21),OVER(Name) !Declare field over name field
Contact CSTRING(21),DIM(4) !Array 21 byte fields - 80 bytes data
Company CSTRING('SoftVelocity Corporation') !21 byte string - 20 bytes data
Phone CSTRING(@P(###)###-####P) !Declare 14 bytes - 13 bytes data
ExampleFile FILE,DRIVER('Btrieve') !Declare a file
Record RECORD
NameField CSTRING(21),NAME('ZstringField') !Declare with external name
END
END
CODE
Name = 'Tammi' !Assign a value
Name[5] = 'y' ! then change fifth letter
Name[6] = 's' ! then add a letter
Name[7] = '<0>' ! and handle null terminator
Name[5:6] = 'ie' ! and change a "slice"
! -- the fifth and sixth letters
Contact[1] = 'First' !Assign value to first element
Contact[1,2] = 'u' !Change first element 2nd character
Contact[1,2:3] = Name[5:6] !Assign slice to slice
!*****end****************
please help