Wendell,

First, no apology was needed, rather I should apologize for my sting. ;-)
Second THANK YOU for the script.
Actually it's more or less I'm going to prepare (for other, less advanced users).

BTW, fun fact: nowadays they are not allowed to write .BAT scripts on their Windows desktop. Precisely, the can write any file with any extension, but even the person with "local admin" authority is not allowed to run .BAT script. That require yet another authority. :-(

--
Radoslaw Skorupka
Lodz, Poland




W dniu 27.06.2025 o 16:22, Wendell Lovewell pisze:
Radoslaw, I apologize for my poor typing.  I was trying to use my phone and 
couldn't actually see what I was typing very well.

If you want a Windows .bat file that will upload all the .Txt files from a 
directory to an already-defined PDS, this will work:

-----------------------------------------------------------
UploadTxt2PDS.BAT:

@ECHO OFF
:: TPath is a non-existent directory
:: FPath is the directory containing the txt files
:: SPath is the directory containing the FTP script

set Tpath=c:\temp\t
set FPath=c:\temp\txtfiles
Set SPath=c:\temp

cd %FPath%

GOTO COPYTHEM

::The Rename in-place option:
rename %FPath%\*.txt *.
FTP -s:%SPath%\UploadTxt2PDS.ftp
rename %FPath%\*. *.txt
Goto EOF


:COPYTHEM
:: Copy to another directory first
md %TPath%
del /Q %Tpath%\*.*
Copy %FPath%\*.Txt %TPath%\*.
cd %TPATH%
FTP -s:%SPath%\UploadTxt2PDS.ftp
del /q %TPath%\*.*
cd %FPATH%
rmdir %TPath%

:EOF

-------------------------------------------

UploadTxt2PDS.ftp:

open zoshost
userid
pwd
CD 'dest.pds'
PROMPT
mput *
quit

----------------------------------------------

On my system, existing members in the PDS are replaced.

This obviously has no error handling--I would go with the Python recommendation 
for that.   The user will have to pay attention to the messages.

For example, if you try to upload a file with a record longer than the PDS 
LRECL, you'll get

451-File transfer failed. File contains records that are longer than the LRECL 
of the new file.
451 Transfer aborted due to file error.

hth
Wendell




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to