tags:

views:

29

answers:

2

Hi All,

I'm trying to upload a text file (converted to ebcdic) into a library in MVS using C#. For uploading a file, I used the following string: filename = @"ftp://xx.xx.xx.xx//'myFile'"; It is not possible without the apostrophes.
Now, I used @"ftp://xx.xx.xx.xx//'libary_name(myFile)'" for upload into a library but I get incorrect syntax or parameters error. Library name: user_id.xyz.temp_lib and myFile: user_id.xyz.someFile. How do I go about fixing this?

Also, is there a way to control the block size of the text file in c#? MVS currently states the uploaded file as VB but I want it as FB (length specified of course).

Thanks

A: 

Fixed it!

Instead of @"ftp://xx.xx.xx.xx//'libary_name(myFile)'" where Library name: user_id.xyz.temp_lib and myFile: user_id.xyz.someFile, you have to use @"ftp://xx.xx.xx.xx//'libary_name(someFile)'" If you use the full MVS data set path on this command, you will get an error.

Erf
it appears there is an issue with the naming convention inside the brackets. The server doesn't like file names with more than 8 characters and they have to be letters or numbers, nothing else.
Erf
A: 

Two thoughts...

Your first example suggests a basic misunderstanding of MVS file names.

Unlike Unix, DOS or MS Windows there is no such thing as a folder or "path". The entire MVS file is defined in the system catalog by its unique dataset name which can not exceed 44 characters. The file can vary in organizational structure which may or may not have an internal directory or index. It can be a simple flat file, or a PDS, or VSAM, or GDG, or database etc. You have to understand what type of file you are working with to use it correctly.

In this situation, you called it a "library" and you further indicated this library has a member name which strongly hints that the file is organized as a PDS dataset. As a PDS, there is an internal directory and you can have multiple members, but no single member name may exceed 8 bytes. The member name counts toward the 44 byte name space limitation of the file name. As Erf indicated, the PDS member name is limited to letters, numbers and a few national characters. The data within the member is accessed sequentially.

In your first example you indicated the member name is: user_id.xyz.someFile

That name is obviously invalid as it exceeds the 8 byte limit. If you had shortend the name your example may have worked. Indeed, it appears in your corrected example that you fixed the illegal member name issue by creating a PDS member called "someFile" and that is pefectly valid.

2nd thought...
You said "If you use the full MVS data set path on this command, you will get an error."

That statement sounds incorrect and indicates you may not have allowed for the fact that the FTP session is appending the user id to your file name automatically. While allowing FTP to default your file name works fine, in most cases you should explicitly qualify the entire MVS file name.

Without the apostrophes, FTP should append your user id to the MVS file name by default. The following names are equivalent...

@"ftp://xx.xx.xx.xx//libary_name(aMember)"
@"ftp://xx.xx.xx.xx//'user_id.libary_name(aMember)'"

With the apostrophes, FTP expects you to explicitly name the fully-qualified MVS file name. It will not append the user id for you.

This example shows the difference:

@"ftp://xx.xx.xx.xx//libary_name(aMember)"        <- user_id.libary_name(aMember)
@"ftp://xx.xx.xx.xx//'xyz.libary_name(aMember)'"  <- xyz.libary_name(aMember)

You mentioned that FTP will not work without apostrophes. That surprises me. Have you tried using the C# escape double-quote (\") character instead? I think that would work as well.

MikeC