Trucs et Astuces - AS400 - Tips and Tricks
page d'accueil
Boite à outils

Copie de code
Table des matières
Depuis l'AS400
vers
un fichier texte dans un répertoire IFS
CPYTOSTMF FROMMBR('/qsys.lib/jpl.lib/qpgmsrc.file/sample.mbr') TOSTMF('/home/jpl/sample-rpg.txt') STMFCODPAG(*PCASCII)
|
puis ouvrir
avec le bloc-notes
si le fichier
source a une description (DDS ou
SQL), utiliser plutôt CPYTOIMPF :
CPYTOIMPF FROMFILE(JPL/QPGMSRC) TOSTMF('JPL/SYLK_H.txt') MBROPT(*REPLACE) STMFCODPAG(*PCASCII) RCDDLM(*CRLF) STRDLM(*NONE) FLDDLM(X'05') FROMMBR(SYLK_H) chgaut obj('JPL/SYLK_H.txt') user(*public) dtaaut(*rwx)
|
vers
un fichier texte dans un répertoire QDLS
CPYTOPCD FROMFILE(*LIBL/QPGMSRC) TOFLR(jpl) FROMMBR(SYLK_H) TODOC(*FROMMBR) REPLACE(*YES) TRNTBL(*DFT) TRNFMT(*TEXT)
|
puis ouvrir
avec le bloc-notes
vers
un fichier texte d'un PC : agir depuis le
PC
-
par client
access : cliquer le bouton Recevoir des données
-
par
WebSphereDevelopmentStudio, s'il est installé :
ouvrir le fichier
-
par FTP
C:\TEMP>ftp MyAS400 Connecté à ... 220-QTCP at ... 220 Connection will close if idle more than 5 minutes. Utilisateur (...:(none)) : jpl 331 Enter password. Mot de passe : 230 JPL logged on. ftp> cd jpl 250 "JPL" is current library. ftp> get qpgmsrc.sylk_h sylk_h.txt (replace 200 PORT subcommand request successful. 150 Retrieving member SYLK_H in file QPGMSRC in library JPL. 250 File transfer completed successfully. ftp : 35093 octets reçus dans 0,01Secondes 2339,53Ko/sec. ftp> quit 221 QUIT subcommand received.
|
Vers l'AS400
via
un fichier texte dans un répertoire IFS
- copier/coller le code dans le bloc-notes
- enregistrer dans l'IFS, par exemple dans /home/jpl
(complètement au hasard ...)
- sur l'AS, CPYFRMSTMF
CPYFRMSTMF FROMSTMF('/jpl/sylh_h.txt') TOMBR('/qsys.lib/qtemp.lib/jpl.file/sylk_h.mbr') CVTDTA(*AUTO) STMFCODPAG(*PCASCII) DBFCCSID(*FILE) TABEXPN(*NO) CHGPFM FILE(mylib/QxxxSRC) MBR(sample) SRCTYPE(xxx) TEXT('description')
|
CPYFRMIMPF FROMSTMF(&IFSFILE) TOFILE(&ENV/&FIC TXT) MBROPT(*REPLACE) RCDDLM(*CRLF) STRDLM(*NONE) FLDDLM(';')
|
via
un fichier texte dans un répertoire QDLS
- copier/coller le code dans le bloc-notes
- enregistrer dans le dossier QDLS
- sur l'AS, CPYFRMPCD
CPYFRMPCD FROMFLR(JPL) TOFILE(QTEMP/JPL) FROMDOC(SYLK_H) TOMBR(SYLK_H) TRNTBL(*DFT) TRNFMT(*TEXT)
|
via ftp
ftp> cd jpl 250 "JPL" is current library. ftp> lcd c:\temp Dossier local maintenant C:\TEMP. ftp> put sylk_h.txt qpgmsrc.sylh_h (replace 200 PORT subcommand request successful. 150 Sending file to member SYLH_H in file QPGMSRC in library JPL. 250 File transfer completed successfully. ftp : 35093 octets reçus dans 0,00Secondes 35093000,00Ko/sec.
|
Copie de SAVF
Depuis l'AS400
Par
ftp
- créer le fichier *SAVF sur l'AS400
- sur le PC, le lire avec FTP
ftp> cd jpl 250 "JPL" is current library. ftp> lcd c:\temp Dossier local maintenant C:\TEMP. ftp> bin 200 Representation type is binary IMAGE. ftp> get jplsavf jplsavf.savf (replace 200 PORT subcommand request successful. 150 Retrieving member JPLSAVF in file JPLSAVF in library JPL. 250 File transfer completed successfully. ftp : 1786752 octets reçus dans 0,27Secondes 6717,11Ko/sec.
|
Vers l'AS400
Par ftp
- créer le fichier *SAVF sur l'AS400
- sur le PC, le charger avec FTP
ftp> cd jpl 250 "JPL" is current library. ftp> lcd c:\temp Dossier local maintenant C:\TEMP. ftp> bin 200 Representation type is binary IMAGE. ftp> quote rcmd crtsavf jpl/jplsavf3 250 Command crtsavf jpl/jplsavf3 successful. ftp> put jplsavf.savf jplsavf3 (replace 200 PORT subcommand request successful. 150 Sending file to member JPLSAVF3 in file JPLSAVF3 in library JPL. 250 File transfer completed successfully. ftp : 1786752 octets reçus dans 0,36Secondes 4977,03Ko/sec.
|
You have the as400 or iSeries or SystemI5 disk shared, ie you
can see it with
the windows explorer
- On the web page right clic the link & save as a
file in your PC with the .MBR extention
- On the file explorer, expand your I5Shared disk, expand
QSYS, up to your source file
sample (to be replaced with a picture)
+ qsys.lib
+jpltools.lib
+qpgmsrc.file
- drag & drop your .MBR file to your source file
- On the web page, cut & paste the CHGPFM commands to
a green screen to finish the work
You have no shared disk but you have iSeriesNavigator
- On the web page right clic the link & save as a
file in your PC
- Open iSeriesNavigator
- drag & drop your files to your home directory
- On a green screen, copy one file or all files as members
into your source file :
- CPYFRMSTMF
FROMSTMF('/IfsDir/Sample.txt')
TOMBR('/qsys.lib/jpltools.lib/qpgmsrc.file/sample.mbr')
MBROPT(*REPLACE) STMFCODPAG(*PCASCII) CVTDTA(*AUTO) DBFCCSID(*FILE)
TABEXPN(*NO)
or
- CPY
OBJ('/ifsdir/sample.txt')
TOOBJ('/qsys.lib/jpltools.lib/qpgmsrc.file/sample.mbr') DTAFMT(*TEXT)
FROMCODPAG(*PCASCII) TOCODEPAGE(*CALC)
or, for the whole directory ... if all files
are correctly named *.mbr (see into CPY help, it's detailed)
- CPY OBJ('/jpl/*.mbr')
TODIR('/qsys.lib/jpltools.lib/qpgmsrc.file') DTAFMT(*TEXT)
FROMCODPAG(*PCASCII) TOCODEPAGE(*CALC)
- On the web page, cut & paste the CHGPFM commands to
a green screen to finish the work
If you encounter some translation errors
For example, in a french source, @ is replaced by à, { by
é, } by è, you can solve then with this indirect
copy
:
- CRTSRCPF
FILE(JPLTOOLS/QPGMSRC) RCDLEN(112) CCSID(297)
- CPYFRMSTMF
FROMSTMF('/IfsDir/Sample.txt')
TOMBR('/qsys.lib/jpltools.lib/qpgmsrc.file/sample.mbr')
MBROPT(*REPLACE) STMFCODPAG(*PCASCII) CVTDTA(*AUTO) DBFCCSID(*FILE)
TABEXPN(*NO) (or any other command able to load
the source text into the source file member)
- CHGPFM
FILE(mylib/QxxxSRC) MBR(sample) SRCTYPE(xxx) TEXT('description')
- Then copy
where you want, the CCSID parameter will take care of translation.