RE: Naming 4GL Report Files with a Date Value
Posted in 1997
Nilima: It looks like your DBDATE environment is the culprit here. Setting the = date field with a USING statement will not have any effect on the way that = date is stored. When you attempt to print the date field (or assign it to = a string), the DBDATE will be used as the format unless you include a = USING clause AT THAT POINT. eg LET cur_date =3D TODAY IF (cur_time > cutoff_time) THEN LET cur_date =3D cur_date + 1 END IF LET addfg_file =3D "/tmp/edcadd/", cur_date USING "YYMMDD", ".rpt" --- The previous version is probably producing something like "/tmp/edcadd/97/08/23.rpt" ... and it's easy to see why the shell chokes on that. cheers RET +--------------------------------------------------------------------------= --+ | Richard Thomas (DBA) richard_thomas@yes.optus.com.au +61 2 9342 = 7188 | +--------------------------------------------------------------------------= --+ ______________________________Reply Separator___________________________ From: NILIMA_DESAI@HP-SanJose-om1.om.hp.com on Tue, 26 Aug 1997 11:20 Subject: Naming 4GL Report Files with a Date Value To: informix-list@rmy.emory.edu Item Subject: cc:Mail Text Hello All: I have a 4GL program that needs to create a ".rpt" file beginning = with a date value. For example "970825.rpt". I have no problems if I try = to create this file with the TODAY command. However I need to be able to = add 1 to the current date if certain conditions are true. This is where I have a problem. Here is a brief sample of the code in my program and the exact error message that I get. GLOBALS DEFINE cur_date date addfg_file char (80), part_num char(16), cur_time datetime hour to second, cutoff_time datetime hour to second, (this variable stores the value of the cutoff_time for the IF statement) addfg_line char(80) LET cur_date =3D TODAY USING "mmddyy" LET cur_time =3D CURRENT HOUR = TO SECOND LET cutoff_time =3D "17:00:00" (assigns the value of the = cutoff_time) IF cur_time > cutoff_time THEN (IF statement defines the value of = cur_date) LET cur_date =3D cur_date + 1 END IF LET addfg_file =3D "/tmp/edcadd/", cur_date, ".rpt" (assigns the = file-name to this variable) LET addfg_line =3D "cat >> ", addfg_file CLIPPED (assigns the = command to create and append to the file) START REPORT addfg TO PIPE addfg_line (creates the report file) OUTPUT TO REPORT addfg () FINISH REPORT addfg REPORT addfg() -------------------------- END REPORT When I use these commands in my program I get the following error message: sh: /tmp/edcadd/: Cannot create the specified file. If I instead use the command LET addfg_file =3D "/tmp/edcadd/", TODAY using "yymmdd", ".rpt" my program works and creates the file for me. I am not sure if this is a problem with the way I am assigning the value to the cutoff_time or something else. I would greatly appreciate any valuable responses. Regards, Nilima