An example of when this could be useful is if you want to create a PFF file with the data file named after the login ID of the keyer who has logged onto that machine.
PROC GLOBAL
alpha (20) tempFilename = "tempusername.txt";
alpha (300) str;
FILE inputFile;
alpha (50) username;
PROC EXAMPLE
execsystem(maketext('cmd /c "set username > %s"',strip(tempFilename)),wait);
setfile(inputFile,strip(tempFilename));
fileread(inputFile,str);
close(inputFile);
filedelete(strip(tempFilename));
// str looks like this: USERNAME=pedro
username = str[poschar("=",str) + 1];
errmsg("Computer username is %s",strip(username));
No comments:
Post a Comment