Problem solve Get help with specific problems with your technologies, process and projects.

Creating ASCII import files in root file system (IFS)

In OS/400 version 4 release 3 and before OR if ptf's SF61859 & SF61937 have not been loaded/applied to V4R4, a method is needed to create an ASCII import file in the root file system to be used with the CPYTOIMPF/CPYFRMIMPF commands. That's because these commands do not allow the STMFCODPAG keyword. The following code is a automated method to accomplish this:

You can create a file in the IFS using CPYTOSTMF specifying the Stream File Code Page(STMFCODPAG).
Example:

CPYTOSTMF FROMMBR ('/qsys.LIB/Source.LIB/Source.FILE/Source.MBR')������� 
� TOSTMF('/tmp/ASCIIfile')��������������������� 
�� STMFOPT(*Replace) STMFCODPAG(*PCASCII)��������������������� 
��� ENDLINFMT(*CRLF)
�����������������������������������������

The Source member can be any source member or it could� be a Program Described file(i.e. Flat File).�The Source member or Flat File should be small or empty because the data is not to be used in the target file.

You can then use the CPYTOIMPF command to copy to this file specify *REPLACE and your data will be converted to ASCII.
Example:

CpyToImpF FromFile( TRANS ) TOSTMF( /tmp/ASCIIfile ) + 
��������� MbrOpt( *REPLACE ) RcdDlm( *CRLF ) +�� 
��������� DtaFmt( *FIXED ) StrDlm( x'05' )

This will place a Carrige Return/Line Feed at the end of each record and a TAB between fields.


Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close