cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
terapin
Level VI

JSL code for File Open if file exists

Hi Folks,

I have some JSL code that opens a series of files (both a *.jmp and *.dat) and then performs various data management activities on them (namely, testing for presence of new data and then concatenating only the new data). The code runs fine as long as all the files are present.  There are some cases where a particular data file hasn't been collected and I want the JSL code to run for those data files that exist.  Currently, the JSL code stops if a file specified in my dt = Open  ( ......) doesn't exist.  I am looking for a way to test for whether a *.dat file exists and to open it if does or jump to next section of code if it doesn't.  Is there a way to do this in JSL?  Any suggestions would be very much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: JSL code for File Open if file exists

At least in JMP 10 there is a function File Exists() that could be useful here.

For( i = 1, i <= n_files, i++,

  If( File Exists( "path" ),

  my dt = Open( "path" ); // more code...

  )

);

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: JSL code for File Open if file exists

At least in JMP 10 there is a function File Exists() that could be useful here.

For( i = 1, i <= n_files, i++,

  If( File Exists( "path" ),

  my dt = Open( "path" ); // more code...

  )

);

terapin
Level VI

Re: JSL code for File Open if file exists

Thanks MS,

I knew there must be some command for this task.