Operating System - OpenVMS
1753772 Members
5324 Online
108799 Solutions
New Discussion юеВ

Re: FTP syntax to IBM Mainframe

 
SOLVED
Go to solution
John T. Farmer
Regular Advisor

FTP syntax to IBM Mainframe

Hello,

Does anyone have the proper DCL syntax to put a file to IBM mainframe system. The destination is a mainframe dataset gdg. I'm told I need to wrap the name in single quotes,

example:
$ FTP/INPUT=FTPSCRIPT.TXT IBM1.MYCOMPANY.COM

where FTPSCRIPT.TXT IS

MyUsername
MyPassword
put TEST.DAT "'ABC.123.XYZ(+1)'"
bye

Now the problem: I need to represent the dataset name inside quotes for a quoted string as P1 parameter for my ftp procedure.

Example:
$ VMSFILE="TESTDIR:CLI_TEST_ELIG.DAT"
$ FTPFILE="'TLVPC.OPDCD.TCOB.CB30073.ELIG(+1)'"
$ @FTPFILE "SHOWSCRIPT, FTPID=MAINFRAM, VMSFILE=''VMSFILE', FTPFILE=''FTPFILE'"

I need to get double quotes around the data set name. Script is produced with only the single quotes of course.

BRNTWD
BRNTW00D
asc
put TESTDIR:CLI_TEST_ELIG.DAT 'TLVPC.OPDCD.TCOB.CB30073.ELIG(+1)'
exit


I can't get the right combination of " around the name.

Thanks for suggestions,

John
6 REPLIES 6
Steven Schweda
Honored Contributor

Re: FTP syntax to IBM Mainframe

You lost me. However:

alp $ type sp1.com
$ write sys$output p1
$ write sys$output "''p1'"
alp $ @ sp1.com fred
FRED
FRED
alp $ @ sp1.com "fred"
fred
fred
alp $ @ sp1.com ""fred""
FRED
FRED
alp $ @ sp1.com """fred"""
"fred"
FRED
alp $ @ sp1.com """"fred""""
"FRED"
FRED
alp $ @ sp1.com """""fred"""""
""fred""
"fred"
alp $ @ sp1.com """"""fred""""""
""FRED""
"FRED"
alp $ @ sp1.com """""""fred"""""""
"""fred"""
"FRED"
alp $ @ sp1.com """"""""fred""""""""
"""FRED"""
"FRED"
alp $ @ sp1.com """""""""fred"""""""""
""""fred""""
""fred""
[...]

Stop when you see what you want.
Hein van den Heuvel
Honored Contributor

Re: FTP syntax to IBM Mainframe

[ be sure to paste the original topic and this reply into a notepad or something with a fixed size font! ]

Not sure I managed to follow the problem description exactly.

Anyway... Typically one just keeps adding double-double quotes within a quoted string until your get the desired. Every time the symbol is substitute, a set will turn to single.

So if your downstream proceduces insist to assigning variables through substitution, then you may well need 4 or 8 double quotes in a row.

You may want to review the procedures used to change to use string concatenation instead of substitution.

So instead of
$ a = """aap"""
$ b = """noot"""
$ c = "''a' ''b'"
$ show symb c
C = "AAP NOOT"

or even

$ aa = """""aap"""""
$ bb = """""noot"""""
$ cc = "''aa' ''bb'"
CC = ""aap" "noot""

use:

$ x = a + " " + b
$ show symb x
X = ""aap" "noot""
$ write sys$output x
"aap" "noot"

That typically helps me keep my sanity.

That and helper symbols like
$ q = "'"
$ qq = """"

Sometimes it helps to used the 'delayed' substitution operator &. I

$ y = &a + " " + &b
$ show symb y
Y = "aap noot"


fwiw,
Hein.

John Gillings
Honored Contributor
Solution

Re: FTP syntax to IBM Mainframe

John,
Note that you can parameterise FTP scripts using PIPE:

$ srcfile="TESTDIR:CLI_TEST_ELIG.DAT"
$ dstfile="'TLVPC.OPDCD.TCOB.CB30073.ELIG(+1)'"
$ OUT="WRITE SYS$OUTPUT"
$ PIPE (OUT "ASCII" ; -
OUT "PUT ''srcfile' ''dstfile'" ; -
OUT "BYE") | -
FTP/INPUT=SYS$PIPE/USER="''User'"/PASSWORD="''Pass'" 'node'

If you want to specify the dataset name without quotes and have the script add them, try:

$ srcfile="TESTDIR:CLI_TEST_ELIG.DAT"
$ dstfile="TLVPC.OPDCD.TCOB.CB30073.ELIG(+1)"
$ OUT="WRITE SYS$OUTPUT"
$ PIPE (OUT "ASCII" ; -
OUT "PUT ''srcfile' '"+dstfile+"'" ; -
OUT "BYE") | -
FTP/INPUT=SYS$PIPE/USER="''User'"/PASSWORD="''Pass'" 'node'
A crucible of informative mistakes
Hoff
Honored Contributor

Re: FTP syntax to IBM Mainframe

The COPY /FTP command (which was first available in V6.2) is generally easier than the ftp utility. Usually far easier.

http://labs.hoffmanlabs.com/node/136

Quote the target file spec, and you can stick most anything into it that you want; that the remote end requires.

COPY/FTP [/BINARY or /ASCII] -
foo.txt -
ibm1.example.com"user pass"::"what-+=ever ?? you !! want"

The remote spec is passed to the far end for processing.

If you need double quotes IN that remote string, then double those within the quoted string.

COPY/FTP [/BINARY or /ASCII] -
foo.txt -
ibm1.example.com"user pass"::"He said ""hello"" to me"

John T. Farmer
Regular Advisor

Re: FTP syntax to IBM Mainframe

Thank you all for the tips, suggestions and sample code. This is my first encounter with IBM mainframe as the ftp server, and my DCL ftp scripting procedures which worked on other platforms has problems with this syntax. I will study this today and report back with my success shortly.

Thanks,

John F.
John T. Farmer
Regular Advisor

Re: FTP syntax to IBM Mainframe

I chose to follow the PIPE command approach and have a working solution. Worked to get the right combination of single and double quotes...

Thanks,

John