Page 1 of 1

Set output function splits file when number of cases increases

Posted: December 23rd, 2021, 12:46 am
by manishcspro
I have created month wise backup utility using set output function and passing system parameter.
When the desired month is selected in dropdown menu for creating backup it generates a csdb file in output folder.
But if the number of cases increases the set output function splits the output file into two or more files as backup rather than single csdb file.
I want a single output as backup.
Please guide me about the solution.

Thanks..

Re: Set output function splits file when number of cases increases

Posted: December 23rd, 2021, 9:01 am
by Gregory Martin
Can you share some code with us here, or at cspro@lists.census.gov? I would like to see how you are using the function.

Re: Set output function splits file when number of cases increases

Posted: December 28th, 2021, 3:13 am
by manishcspro
First of all I have created a pff file to split data into the desired month:-

POSTPROC

setfile(pffFile,"splitach.pff",create);
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 7.5");
filewrite(pffFile,"AppType=Batch");
filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=.\splitach.bch");
filewrite(pffFile,"InputData=..\..\..\UPMPR17\achdata\achdata.csdb|CSPRODB)");
filewrite(pffFile,"OutputData=|NONE");
filewrite(pffFile,"Listing=.\splitach.lst");

filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"ViewListing=OnError");
filewrite(pffFile,"ViewResults=No");

filewrite(pffFile,"FILTERID=%6S",CONCAT(MENU_MTH,MENU_YR));

filewrite(pffFile,"OnExit=%s",".\showreport\report.pff");

close(pffFile);
execpff(filename(pffFile),wait);

stop(1);
reenter;


them run the set output function:

PROC GLOBAL
NUMERIC I,C;
STRING P;

PROC ACH_FF

PROC ACH_QUEST
PREPROC

//FILEDELETE(pathname(Desktop) + maketext("AchivementDataBackup\*.csdb"));

IF MAKETEXT("%2S%4S",ACH_MTH,ACH_YR) <> SYSPARM("FILTERID") THEN
SKIP CASE;
ENDIF;

PROC DEPT

setoutput(maketext(pathname(Desktop) + maketext("AchivementDataBackup\मासिक_प्रगति_%02S_%4S_उत्तर प्रदेश_%10S_%8S.csdb",GETLABEL(ACH_MTH_VS1,ACH_MTH),ACH_YR,EDIT("99_99_9999",SYSDATE("DDMMYYYY")),EDIT("99_99_99",SYSTIME()))));

Re: Set output function splits file when number of cases increases

Posted: December 28th, 2021, 4:30 pm
by Gregory Martin
You are using the sysdate/systime function in your setoutput/maketext call, which will always give you a fresh reading of the date and time. I'm guessing you want to keep it as a single value for the duration of your program. Something like:
PROC GLOBAL

numeric
startDate;
numeric startTime;

PROC ACH_FF

preproc

   
startDate = SYSDATE("DDMMYYYY");
    startTime = SYSTIME();
Then use those values when formatting your setoutput filenames.

Re: Set output function splits file when number of cases increases

Posted: December 29th, 2021, 4:23 am
by manishcspro
Thanks a lot...