How to convert RPG to a .txt file

40 pts.
Tags:
RPG
RPG to .txt file
How do you take a regular source member and convert it a .txt file?
ASKED: August 31, 2009  9:38 PM
UPDATED: February 25, 2014  3:23 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Joe94553
    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
    40 pointsBadges:
    report
  • Cwc
    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.
    4,290 pointsBadges:
    report
  • Sloopy
    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
    2,195 pointsBadges:
    report
  • hafwhit
    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.
    1,145 pointsBadges:
    report
  • WilsonAlano
    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
    2,450 pointsBadges:
    report
  • pdraebel
    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
    2,390 pointsBadges:
    report
  • DanTheDane
    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)
    
    2,555 pointsBadges:
    report
  • Littlepd
    Open WDSc. Add the source member to an iSeries Project. Export the source member to your local hard drive.
    1,130 pointsBadges:
    report
  • JinKazana
    OMG! All answers here are amazing but to me code gave by pdraebel it just a combination of amazing and "make it simple". I know that post has 5 years old but I just need it now.
    20 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following