Skip to main content

How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

I am confused about the steps you have taken to correct the issue:

"I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck."

What exactly have you done here?

If you have an application that runs under both Server Express on Unix and Net Express on Windows then you need to code your filenames according to the convention used on the particular system.

This is precisely what MFEXTMAP.DAT is for.

You should have one version of MFEXTMAP.DAT that uses Unix filenames and one that uses Windows file naming conventions so that your source does not need to be changed when moving between the two systems.

Instead you would just use the appropriate version of MFEXTMAP.DAT.

On Unix it would point to: /usr2/spool/somefile.index#.job#.customer_id.dat

While under Windows it would point to something like:  \\Users\\spool\\somefile.index#.job#.customer_id.dat

It sounds like perhaps your filename for this particular file is being dynamically constructed within the program itself instead of using MFEXTMAP.DAT for this file.

Can you confirm what your select statement looks like for this file?

Thanks.


How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

Chris, I'm sorry to confuse you.  Yes, the program must build the filenames dynamically for its purposes--which works fine with the Unix server.  However, in testing/debugging on the Windows environment, it is difficult to predict the "variable" parts of the filenames, so I didn't add it to my MFEXTMAP.DAT. Plus the fact that the filenames have a Unix path built into the filenaming process to ensure the file is put where desired made it confusing to me to handle in MFEXTMAP.DAT.  Note that these dynamic filenames are not in the shell script that runs the program (whereas the fixed filenames are referenced in the shell script).

The variable parts of the filenames like the .index#, job#, and customer_id change depending on values it gets from the Oracle database.  The program may generate one or many different reports of a given type where the contents are based upon the variable parts of the filename.

Perhaps there is no way for me to overcome this obstacle and I must test this with Display statements on the Unix machine.  I was hoping to avoid doing this and use Net Express to debug on my local machine.


How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

Chris, I'm sorry to confuse you.  Yes, the program must build the filenames dynamically for its purposes--which works fine with the Unix server.  However, in testing/debugging on the Windows environment, it is difficult to predict the "variable" parts of the filenames, so I didn't add it to my MFEXTMAP.DAT. Plus the fact that the filenames have a Unix path built into the filenaming process to ensure the file is put where desired made it confusing to me to handle in MFEXTMAP.DAT.  Note that these dynamic filenames are not in the shell script that runs the program (whereas the fixed filenames are referenced in the shell script).

The variable parts of the filenames like the .index#, job#, and customer_id change depending on values it gets from the Oracle database.  The program may generate one or many different reports of a given type where the contents are based upon the variable parts of the filename.

Perhaps there is no way for me to overcome this obstacle and I must test this with Display statements on the Unix machine.  I was hoping to avoid doing this and use Net Express to debug on my local machine.


How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

Chris, I'm sorry to confuse you.  Yes, the program must build the filenames dynamically for its purposes--which works fine with the Unix server.  However, in testing/debugging on the Windows environment, it is difficult to predict the "variable" parts of the filenames, so I didn't add it to my MFEXTMAP.DAT. Plus the fact that the filenames have a Unix path built into the filenaming process to ensure the file is put where desired made it confusing to me to handle in MFEXTMAP.DAT.  Note that these dynamic filenames are not in the shell script that runs the program (whereas the fixed filenames are referenced in the shell script).

The variable parts of the filenames like the .index#, job#, and customer_id change depending on values it gets from the Oracle database.  The program may generate one or many different reports of a given type where the contents are based upon the variable parts of the filename.

Perhaps there is no way for me to overcome this obstacle and I must test this with Display statements on the Unix machine.  I was hoping to avoid doing this and use Net Express to debug on my local machine.


How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

I am still not sure that I understand the problem here.
Can you show me what your select/assign statement looks like?

If you are assigning to a filename like "/usr2/spool/somefile.index#.job#.customer_id.dat" in your program this should also work under Windows as long as the folder \\usr2\\spool exists at the time of the open.

The file handler accepts both "/" and "\\" as valid separator characters in Net Express.

I just tested this here with the following program and it correctly created and then read back the file:
"/usr2/spool/somefile.index#.job#.customer_id.dat":

      id division.                                                  
      program-id.  testslash.                                        
      input-output section.                                          
              select test-file assign to dynamic filename            
                               organization is line sequential      
                               file status is file-status.          
      data division.                                                
      file section.                                                  
      fd test-file.                                                  
      01 test-record  pic x(20).                                    
      working-storage section.                                      
      01 file-status   pic x(2) value spaces.                        
      01 filename      pic x(100) value                              
      "/usr2/spool/somefile.index#.job#.customer_id.dat".            
      procedure division.                                            
          open output test-file                                      
          display "status = " file-status                            
          move all "A" to test-record                                
          write test-record                                          
          display "status = " file-status                            
          close test-file                                            
          open i-o test-file                                        
          display "status = " file-status                            
          read test-file                                            
             at end                                                  
                display "end"                                        
          end-read                                                  
          display "status = " file-status                            
          close test-file                                            
          stop run.                                                  


How do I deal with dynamic filenames in Net Express running on Windows?  I have a MFEXTMAP.DAT that works fine for the static filenames, but ran into a program that I need to debug and it has some dynamic filenaming going on.  When it builds the filename it has a Unix path hardcoded into the name building logic. 

For example it would create a name like: /usr2/spool/somefile.index#.job#.customer_id.dat

I'm getting an error saying directory not found (and it shows the dynamic filename), and I can't debug any further.  I tried putting the directories in my project directory hoping that would work, but no luck.  I also tried putting the directories in the same place the MFEXTMAP.DAT pointed the other files to, and again no luck.  I tried this in my root directory too, no luck.

My goal is to not mess up the filenaming in the COBOL program as it works properly in the Unix environment.  Surely there is a way to deal with this--at least I hope.

Thanks,

 

 


#unix
#windows7
#DynamicFilenames
#NetExpressmMFEXTMAP.DAT
#COBOL

Ok, I'm feeling a little dense now.  I figured it out from your above script.  I thought from reading that it would put the files in subdirectories of the project's root.  Also I was missing the subdirectories in my true root directory only the C:\\usr2 was there.  

For other readers, this does not have to go into the MFEXTMAP.DAT for dynamic filenames.  If your filename is created with a path involved, and it starts with a slash, it will go to the root of the drive and work from there.  In the above case, it would literally put the file in:

C:\\usr2\\spool\\somefile.index#.job#.customer_id.dat

I hope this helps someone else.