Posted: Tue Mar 07, 2006 9:22 pm Post subject: Write CObol program to perform FTP
Hi all..
I have 2 questions..
1 ) Can i write a cobol program to do FTP from my OS390 to my server?
I got a problem how/what can i use to do the FTP..
It is any parameter or variable in COBOL to invoke FTP command?
Any body have any experience in how to perform FTP using COBOL program?
2) I need to know, why when i do a FTP using JCL, if i use GET command, i must put "(replace" command. If not, the file will not replace the existing dataset in host. The problem is, if there is no filename in remote directory, the GET command will replace the existing dataset with empty..
1. Its possible. I never tried thru COBOL as FTP thru JCL really works fine for me and its approiate.
For COBOL its like another CALL statement.
2.
Code:
----------------- V=IBM P=Z/OS FTP SUB-CMDS R=V1R4 I=GET D=M -----------------
(REPLACE
Causes a data set on your local host to be overwritten, if it already
exists. If the data set already exists, and you do not use the replace
parameter, the existing data set is not overwritten. A message
informing you of this is displayed.
If the data set already exists and you specify REPLACE, the data in
the file is overwritten, but not reallocated. This means the local
data set retains its existing characteristics.
...
...
Attention: A Get subcommand issued for an empty or nonexisting
foreign file erases the contents of the existing local data set.
My solution would be in two phase.
FTP the file into a Temporary PS file. Check for empty file condition and then only COPY to original PS.
1. Its possible. I never tried thru COBOL as FTP thru JCL really works fine for me and its approiate.
For COBOL its like another CALL statement.
My OS390 is old version, cannot produce system date using JCL..I need to get current date when i perform FTP..So, i decide to use COBOL to perform FTP and use current date..
I will try to find the solution to perform FTP using COBOL..If you can give me any tips for searching, pls do.
Quote:
My solution would be in two phase.
FTP the file into a Temporary PS file. Check for empty file condition and then only COPY to original PS.
That good idea..i will try your suggestion..
Thank you..
My OS390 is old version, cannot produce system date using JCL..I need to get current date when i perform FTP .So, i decide to use COBOL to perform FTP and use current date..
Solution 1:
Try building the FTP control card thru COBOL. Where you can get the date and other required dataset or file naming conventions.
In the next step use PGM=FTP with the generated control card.
Solution 2:
Use REXX and FTP together. (do a Search)
Hope you are aware that thru SORT you can get the date. Search this forums to get the current date thru SORT jcl.
The problem now, When the file is not exist in the server, than the FTP will replace the dataset with empty..My intent, if no file in the server, than FTP will not replace the dataset with empty,just remain with the previus data..
So, i think i want to try to write COBOL prgram to perform FTP.
If there is no way to write the cobol program, i will try your suggestion, to check whether the dataset is empty..
RAVI,
Do you have any simple COBOL FTP program? I have a problem how to CALL a FTP in COBOL..
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum