This format of the @SET statement is used to store the date and time in a string variable or a work file. The value is stored starting at a specified column.
Operation | Operands | F mode, L mode |
@SET | {svarex | lvar} [,col]={DATE [ISO[4] ] | TIME} |
svarex | String variable ( |
lvar | Line number variable ( |
col | Column as of which the date or time are to be stored. If |
DATE | The current date is inserted in the specified string variable or line in the |
ISO ISO4 TIME | Specifies that the date is to be output in the format Specifies that the date is to be output in the format The time is stored in the specified string variable or line in the form |
If the insertion operation causes the line or string variable to exceed the maximum length of 32768 then the statement is rejected with the message EDT5474
.
If the information is inserted in a line then the character set depends on the work file. If the current work file already has a character set then the value is inserted in this character set. If the work file is empty and has the character set *NONE
then it is assigned the character set EDF041
prior to insertion.
If the information is inserted in a string variable then it is converted into the character set of the string variable before insertion.
In this statement, the statement name may be omitted entirely. In F mode, it is also permissible to omit the statement symbol.
Example
1. @SET #L0 = 1 -------------------------------------------------- (1) 1. @SET #L0 = DATE ----------------------------------------------- (2) 1. @SET #L0 ,13 = DATE ISO --------------------------------------- (3) 1. @SET #S0 = TIME ----------------------------------------------- (4) 1. @SET #S0 ,13 = DATE ISO4 -------------------------------------- (5) 1. @PRINT 1 ------------------------------------------------------ (6) 1.0000 02/07/06038 06-02-07038 1. @PRINT #S00 --------------------------------------------------- (7) #S00 165941 2006-02-07038
(1) | The value 0001.0000 is assigned to the line number variable #L0 . |
(2) | The date is inserted in line 1 as of column 1. |
(3) | The date is inserted in ISO format in line 1 as of column 13. |
(4) | The time is inserted in the string variable #S00 starting at column 1. |
(5) | The date in ISO4 format is inserted in the string variable #S00 starting at column 13. |
(6) | Line 1 is output. |
(7) | The string variable #S00 is output. |