How to convert RPG to a .txt file
15 pts.
0
Q:
How to convert RPG to a .txt file
How do you take a regular source member and convert it a .txt file?
ASKED: Aug 31 2009  9:38 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
4040 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
From STRPDM, select option 6 to print then open the spooled ouptut with iSeries Nav. It will be opened with Notepad as .TXT file and from there you can save, print, email, etc.
Last Answered: Aug 31 2009  11:49 PM GMT by Whatis23   4040 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Joe94553   15 pts.  |   Sep 1 2009  2:02AM GMT

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

 

Cwc   3860 pts.  |   Sep 1 2009  1:31PM GMT

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.

 

Sloopy   1940 pts.  |   Sep 1 2009  1:57PM GMT

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.

Regards,

Sloopy

 

Hafwhit   630 pts.  |   Sep 1 2009  5:35PM GMT

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.

 

WilsonAlano   2005 pts.  |   Sep 1 2009  6:31PM GMT

Hi,

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.

Wilson

 

Pdraebel   885 pts.  |   Sep 2 2009  8:08AM GMT

I once stumbled upon a PC BAT file called GETALLSRC. It uses FTP from PC to get source files from your iSeries.

@ECHO OFF
IF %1.==. GOTO problem
IF %2.==. GOTO problem
IF %3.==. GOTO problem
IF %4.==. GOTO problem
IF %5.==. GOTO problem
cls
ping %3 -n 2 | find /i “reply” >nul && goto getfils
echo System does not exist on the network! & goto End
:getfils
cls
F:
cd
cd sources
md %3
cd %3
md %4
cd %4
md %5
cd %5
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
DEL FTPSRC.TXT
rename *.MBR *.txt
GOTO END
:problem
cls
ECHO —————————————————–
ECHO Type in : GETALLSRC USER PASSWORD SYSTEM LIBRARY FILE
ECHO —————————————————–
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
:END

 

DanTheDane   245 pts.  |   Sep 2 2009  2:36PM GMT

I think WilsonAlano’s solution is fine (see above). I use this cmd (option ‘SF’ for StreamFile) in PDM (slightly different to Wilson’s):

CPYTOSTMF FROMMBR(’/qsys.lib/&l.lib/&f.file/&n.mbr’)
          TOSTMF(’/temp/&n.&s’)
          CVTDTA(*NONE)
          STMFCCSID(*PCASCII)
          ENDLINFMT(*CR)

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:

CPYTOSTMF FROMMBR(’/qsys.lib/mylib.lib/QALLSRC.file/A_1.mbr’)
          TOSTMF(’/temp/A_1.txt’)
          CVTDTA(*NONE)
          STMFCCSID(*PCASCII)
          ENDLINFMT(*CR)

 

Littlepd   500 pts.  |   Sep 3 2009  3:00PM GMT

Open WDSc.
Add the source member to an iSeries Project.
Export the source member to your local hard drive.

 
0