Operating System - Linux
1752781 Members
6020 Online
108789 Solutions
New Discussion юеВ

Re: .netrc file not been used

 
OldSchool
Honored Contributor

Re: .netrc file not been used

you don't accidently have the "-n" switch in your ftp command in the cobol program perhaps?

if not, then I'm at a loss....I have apps that do this all the time (not cobol, but that shouldn't matter)
John Waller
Esteemed Contributor

Re: .netrc file not been used

Nice try with the -n switch but no, I've checked the source code and it only runs a ftp -iv ip_address.
Fat Scrape
Honored Contributor

Re: .netrc file not been used

Hi John,

In my experience this type of problem is always caused by some env. vars unset.

I don't understand if you are sure (or you debug the script) that $HOME var is set.

Could you try, if you want, to debug and verify if this var is set?

I created a script and I modified the path of variable $HOME, netrc file wasn't found. The same problem happens if I run the same script using switch user when "-" option is omitted, because, in this way, some variables ($HOME and other) aren't set.

You said that the cobol program is called by a full application. Problaby when this cobol program is called some vars aren't set, caused by a anomaly/bug in the code, that you solve opening a case

Regards,

Fat
John Waller
Esteemed Contributor

Re: .netrc file not been used

Hi,
Well I'm now totally confused. I've had the programmer make a change so he performs a touch on the .netrc file before trying the ftp and when the program runs it updates the time stamp on the .netrc file but still doesn't work. The next thing I'm going to ask him to try is to change the programmes so it also sets the "LOGNAME" parameter in case it is something to do with the UserID.
Fat Scrape
Honored Contributor

Re: .netrc file not been used

Hi John,

Which is the result of your tests?
Are HOME, LOGNAME and other parameters defined during ftp session called by COBOL application?

Regards,

Fat

John Waller
Esteemed Contributor

Re: .netrc file not been used

Hi
Yes, by displaying the variables into a debug file everything appears to be set how I would expect them to be. In the end I've wrote a script which does the ftp.
e.g.

ftp -iv $1 <<-eof
user wmsftp notshown
cd /goc
lcd /opus/test/interface/out/goc/send
mput *.DTS
close
quit
eof

Then within the cobol program issue a call "sh /home/testsys/script $IP_address".

It's not ideal, but it works. I still don't understand why it doesn't work on this perticular machine but works on a number of others.
Steven Schweda
Honored Contributor

Re: .netrc file not been used

You've verified that the same "ftp" program
is being used in each case?
John Waller
Esteemed Contributor

Re: .netrc file not been used

Not exactly the same but we are using the standard hp-ux ftp in /usr/bin. On this machine with the problem I did notice there was an ftp program installed as part of perl so I renamed that to ensure it wasn't been picked up. The difference is that this server is PA-Risc 11.23. The working servers are either IA64 11.23 or PA-Risc 11.00,