Paul,
The reason that Set Var v2 date = (ssub(.vLFNFileDT1,-1)) fails is that you cannot assign the results of an expression which evaluates to a TEXT datatype to a DATE datatype. The two-step approach works because R:BASE lets you create a DATE variable by assigning a text value without the use of a function call. Honestly, that is non-standard. Use it all the time; love it; wouldn't ever want to see it changed. But non-standard. It is really an implied function call: SET VAR v2 DATE = (ConvertToDate(SSUB(.vLFNFileDT1,-1))) Now, you *could* write your own function (stored procedure) ConvertToDate that does nothing but create a date variable from a text input . or you can use a long string of nested functions to get to your result in one step. R>SET VAR vresult TEXT = (CTXT(IYR4(.#DATE))+SGET(FORMAT(IMON(.#DATE),'00'),2,2)+SGET(FORMAT(IDAY(.#D ATE),'00'),2,2)) R>SHO VAR Variable = Value Type ------------------ ------------------------------ -------- #DATE = 08/17/2009 DATE #TIME = 13:34:19 TIME #PI = 3.14159265358979 DOUBLE SQLCODE = 0 INTEGER SQLSTATE = 00000 TEXT #NOW = 08/17/2009 13:34:19 DATETIME vresult = 20090817 TEXT You can take the above and, in the same step, tack on whatever else you want for filename . or expand it to include the time in the string, or both. Emmitt Dove Manager, Converting Applications Development Evergreen Packaging, Inc. [email protected] (203) 214-5683 m (203) 643-8022 o (203) 643-8086 f [email protected] From: [email protected] [mailto:[email protected]] On Behalf Of Paul InterlockInfo Sent: Monday, August 17, 2009 12:41 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: SSub Declare date var Set var vLFNFileDT1 text = '8/17/2009 4:23 AM' Now that we get this var from a RBL so no changing it! But I would like var v_something Text = '20090817' Lead year for file use, zero filed months and days etc.. Time could be nice also but not required in this case. So I would assume Set Var v2 date = (ssub(.vLFNFileDT1,-1)) fails! But: Set Var v3 = (ssub(.vLFNFileDT1,-1)) Set Var v4 date = .v3 provides the date value As expected. That way you could set Date = 'YYYYMMDD' and add that part in the string and put it together in front of a file name. Seems simple, but I am missing the first step that fails. I could include this long declare var this/that (v1,v2,v3,.) but it would be nice in 1-2 var Set Date YYYYMMDD Set var V2 text = ((ssub(.v1,-1)) & .vLFNFileNameS1) Set Date MM/DD/YYYY However I know that is impossible. Thought about using #NOW and loading that into a var? Not possible from what I can see. Example: Set var v1 #NOW = . vLFNFileDT1 and then switch it to a text var with YYYYMMDD HHMM. Also again adding steps. Any ideas why "Set Var v2 date = (ssub(.vLFNFileDT1,-1))" fails? Am I missing something in quotes or ? Not possible and just take the addn'l steps? Sincerely, Paul Dewey

