Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to perform FTP for the variable file name at the remote server.

Status
Not open for further replies.

Nits1212

Programmer
Aug 16, 2007
34
IN
Hi,

I am planning to use FTPS for file transfer from mainframe to SAG and vice versa. As i came to know is, You shoule always have a fixed input file name. But in my case, input file name contains timestamp on SAG. so every time when i need to transfer file from SAG to mainframe, i will have different input file name. can you have any suggestion on, How the file transfer will be possible in this case? before doing file transfer, how can i change the file name from mainframe?

plz suggest.

Awaiting for your input.

Thanks,
Nits
 
Why not simply use the mget ftp command ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Dear PHV.

You are absolutely correct, but what i want to do is, after transferring that files to Mainframe, i have to read these files first record, by doing this, i will come to know what type of file it is. then i will have to convert that file into fixed name format for the next jobs.
 
Write a COBOL program to generate the required JCL, and write it to the Internal Reader of JES.
 
No, it's been over 30 years since I've done this. I don't work on mainframes any more. I know they would never get rid of the internal reader as that is how you submit jobs from TSO.

In the COBOL program, you code the JCL in a table of 80-byte text strings. You modify the variable names via standard COBOL statements. Then write the JCL to the output file. The output DD statement specifies the internal reader. I can not provide the codeing for the DD statement, things have changed too much.

Another way to do it would be to write the output to a normal file and then submit it via TSO; but I think you are trying to get away from any manual processing.
 
Nits,

From what you have said about mainframe, I would suggest using the REXX language. This could pick up the file output from the Cobol source and copy it to a file whose name was determined by the date. You could then use the FTP commands suggested by Webrabbit in a previous thread to send the file to your destination. I don't think, from your description of what you are trying to do, that this lends itself to a 100% Cobol solution. REXX, in my opinion, would be the best option.

Marc
 
Dear Marc,

Please find the below input names (these are the file names which will be available on SAG) MMDDYYHHMMSSNN will be a variable part for every file name.
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.S
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.S
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.S
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.C
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.C
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.C
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.F
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.F
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.F
S201XCTBBBBBBBBYYMMDDHHMMSSNNN.D

My aim is to get these files on mainframe with fixed file names, so that i can use these files for the further process.

It will be great if you can through some light and let me know how can this be possible.. may be by REXX.. or whatever.. plz suggest,

Regards,
Nits
 
REXX is a great language. I was just learning it when I left the mainframe world. It is implemented in OS/2 and the latest versions of PC (not MS) DOS.
 
REXX is now also used largely in mainframes - replaced my personal favourite 'Clist'.

Nits, are you trying to send the files to SAG (whatever that may be) via FTP from the mainframe, or the other way round?

Marc
 
Dear Marc,

I am planning to "PULL" these above mentioned files from UNIX server to mainframe.

If i know the fixed input file name, then this can be done by using GET FTP command. But here is my file name is dynamic as i have specified.

But whatever i have to do, i have been told that i will have to do it only from Mainframe, so there will be no script running on UNIX side.

Please suggest.


Regards,
Nits
 
Nits,

What I've done in the past, is run a two step FTP process. First, I run and FTP and do a DIR (list) command. I then scan through the ftplog with a program to find the dataset names and create the GET commands. I then use the GET commands in the second FTP step.
BTW: different servers return the DIR (list) display in different formats so you should run an FTP just to have a listing to reference.
I use REXX, but COBOL should work.

Hope this helps.
 
Dear RXPGMR,

Please coorect me if i am wrong,

1. es i can get the list of files from the remote server by running LIST command in first step and i can copy the SYSOUT dump in one dataset.


2. Read the dataset for the file names by using COBOL program.

3. get the dataset name from the sysout spool,

and use that file name for the next step for FTP.

But i am little confused in one thing... as i will pick up the file name from the spool, how will i able to put that file name as a input file name in next step for FTP. I have tried INTRDR option also, plz through some light on the same and provide me the sample code if possible..

Thanks
Nits
 
nits.

On a FTP JCL the SYSIN DD can be pointing to a normal dataset.

What you do is to write to that dataset using a COBOL program.

lines could look like

get my_unix_file 'my_main_frame_dataset'
get my_unix_file1 'my_main_frame_dataset2'
get my_unix_file2 'my_main_frame_dataset3'


The COBOL program would run before the FTP Step obvisouly.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Dear Frederico,

Kindly provide some sample code if possible.

Thanks,
Nits
 
Nits,

Frederico has it.

In your first FTP step create a file using the OUTPUT DD:

//FTP1 EXEC PGM=FTP
...
//OUTPUT DD DISP=(NEW,CATLG,DELETE),
// DSN=your.ftp.log,
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE),
// DCB=(RECFM=FBA,LRECL=133,BLKSIZE=13300)

Follow this with your COBOL program using the ftp log as input and creating new ftp commands with the gets as the output

//MAKEGETS EXEC PGM=cobpgm
//INPUT DD DSN=your.ftp.log,DISP=SHR
//OUTPUT DD DSN=your.new.ftp.gets, ...

In the second FTP step use your new commands as the input

//FTP2 EXEC PGM=FTP
...
//INPUT DD DSN=your.new.ftp.gets,DISP=SHR

That's the basics.

 
Thank you very much Mr. Rxpgmr. I appreciate your assistance in this regard.

Regards,
Nits
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top