I am familiar with your solution – but it’s not the one I was looking for – the .TXT should only contain source records – not records that contain page headers/footers
I want to loop through a source file and for each member get a .TXT member created on my PC in a pre-defined path. If there was some way I could use the API that Client Access uses to “Receive file from Host”
The solution I seek is only temporary – so any 3rd party utility with a free trial would work for me
You could download each source member to a text file via the iSeries Access file transfer function, or you could copy the source file member to an ASCII text file in the IFS via the CPYTOIMPF command. If you use CPYTOIMPF, it would be easier to automate in a CL program.
You can create a CL program to read the member list for the source file. FOr each member name, use either the CPYTOPCD command – which will create a copy of the source member’s DATA field as a PC TEXT document in a subfolder under QDLS, or the CPYTOSTMF command, which will create a very similar file in ANY folder in the IFS.
For example, the two commands below show how to create a TEXT file for a source member using both commands:
CPYTOPCD FROMFILE(TGSMSRCTRI/QRPGLESRC) TOFLR(BLECMD) FROMMBR(WIRCSVF)
- creates a file called WIRCSVF in ASCII TEXT format in folder QDLS/BLECMD
CPYTOSTMF FROMMBR(‘QSYS.LIB/TGSMSRCTRI.LIB/QRPGLESRC.FILE/WIRCSVF.MBR’) TOSTMF(‘/blecmd/wircsvf.txt’) STMFOPT(*REPLACE) STMFCODPAG(*STDASCII)
- creates a file called WIRCSVF.TXT in Standard ASCII TEXT format in IFS folder (root/) BLECMD.
Note that if you use some special characters in your source (such as dollar or pound-sterling signs), these might not translate the way you expect.
The resulting files will NOT contain the SRCDAT and SRCSEQ fields – only the SRCDTA field from the source member.
You could ftp the source members from the system to the your PC. You don’t have to do any special program and you can name the source member with an extension of txt.
We created an PDM option to that for us:
Option . . . . . . . . : ST
Command . . . . . . . . : CPYTOSTMF FROMMBR(‘/qsys.lib/&l.lib/&f.file/&n.mb
r’) TOSTMF(‘/tmp/&n.&t’) STMFOPT(*REPLACE) STMFCODPAG(*PCASCII) ENDLINFMT(*CRLF)
And just use ST on each source to convert.
I once stumbled upon a PC BAT file called GETALLSRC. It uses FTP from PC to get source files from your iSeries.
IF %1.==. GOTO problem
IF %2.==. GOTO problem
IF %3.==. GOTO problem
IF %4.==. GOTO problem
IF %5.==. GOTO problem
ping %3 -n 2 | find /i “reply” >nul && goto getfils
echo System does not exist on the network! & goto End
rename *.txt *.MBR
ECHO open %3 >FTPSRC.TXT
ECHO user %1 >>FTPSRC.TXT
ECHO %2 >>FTPSRC.TXT
ECHO ascii >>FTPSRC.TXT
ECHO PROMPT >>FTPSRC.TXT
ECHO QUOTE SITE NAMEFMT 1 >>FTPSRC.TXT
ECHO MGET /QSYS.LIB/%4.LIB/%5.FILE/*.MBR >>FTPSRC.TXT
ECHO quit >>FTPSRC.TXT
ftp -n -s:FTPSRC.TXT
rename *.MBR *.txt
ECHO Type in : GETALLSRC USER PASSWORD SYSTEM LIBRARY FILE
ECHO USER = user profile to use for FTP
ECHO PASSWORD = password for user profile to use for FTP
ECHO SYSTEM = name of the system you wish to FTP from
ECHO LIBRARY = name of the library you wish to FTP from
ECHO FILE = name of the file you wish to FTP from
I think WilsonAlano’s solution is fine (see above). I use this cmd (option ‘SF’ for StreamFile) in PDM (slightly different to Wilson’s):
With this option ‘ST’ in my PDM + cmd13 (dup option) I moved 500+ sourcemembers to the IFS in a split of a second.
Sample codestring that was executed from my ‘SF’-option:
Add the source member to an iSeries Project.
Export the source member to your local hard drive.