10 MYDAT // LIB con precedenza massima, le altre hanno minore precedenza 20 MYDAT2 40 PGM_DAT 50 PGM_OBJ
CL a_set :
CHGLIBL LIBL(QTEMP QGPL PRJ_LIB PRJ_LIB2 PRJ_LIB3 + PRJ_LIB_SRC PRJ_LIB_SRC2) CURLIB(PRJ_LIB)
QSYS - System Parent Library QSYS2 - System Library for CPI's QGPL - General Purpose Library, if the system does not know where to put something, it will likely end up here QTEMP - Every job has its own QTEMP libary. The library gets cleared everytime the job ends. So, this is a great place to put truly temporary files.
compilare sorgente RPG:
equivalente a:
# errori compilazione WRKSPLF SELECT(*CURRENT *ALL *ALL *ALL *ALL OR*) # controllare errori runtime WRKUSRJOB USER(*CURRENT)
compilare con debug
F4 prima di ricompilare F10: visualizza altre opzioni di compilazione pagina giu, verso la fine si trova "Visualizzazione di Debug" mettere *SOURCE compilare
Risalire al sorgente dal oggetto compilato:
strpdm 2. gestione oggetti percorso oggetto 5. visualizza tra le altre informazioni ci sono "file origine" e "libreria"
DIFF: file compare
option 54 da PDM lista sorgenti CMPPFM (Compare Physical File Member)
Search In File - From PDM, "Work with members", type in 25 in the Opt space of the Member you would like to do the search on. - to check all the programs, hit F13 (Shift F1) and you will see that 25 is filled in on all the options. - "F16=Ripetiz. ricerca" per trovare le altre occorrenze
Search File Data
STRQRY
Debug SERVICE JOB: occorrono due sessioni aperte, una per il debugger e una per chiamare il programma
# sessione 1: STRDBG SP_NAME SBREAK 52 USER QTMHHTTP # vedi utente usato dalla connessione F12 # occorre uscire dal debugger per attivare l'ascoltatore # lancia programma da web, DBG stampa il service job ID che sta ascoltando F1 sul messaggio di interruzione all ultima riga # mostra il $jobID es: 041170/TAZIO/QPADEV0016, # fare attenzione a non leggere il job della console dell'utente corrente # sessione 2: #endsrvjob se ce ne è uno attivo STRSRVJOB $jobID # copiaincolla da terminale STRDBG SP_NAME F6 su linea selezionata su strdbg sess.1 # sessione 1 F12 per rilasciare il debug in ascolto, ma catturato in sessione 2 # sessione 2 # deve essersi attivato il DBG in sessione 2 del job EV input enddbg #toglie il dbg in ascolto, da fare su tutte e due le sessioni endsrvjob
è possibile interrogare la lista di librerie con cui gira il job
displayjob $jobID
debug RPG std program:
* Add this line to the beginning of your program: H OPTION(*NODEBUGIO) * Compile the program with Debug View set to *LIST * Start the debugger with the command: STRDBG pgmname (Update Production files *YES) * Put cursor on the first line that you want to see and hit F6. Exit with F3. * Call your program: CALL pgmname * Use F10 to step through the program. Use F11 to see values. * SHIFT+F10 per entrare in una subroutine * If you wish, set additional breakpoints and use F12 to run until the next breakpoint.
messaggi sql error:
EV SQLCOD EV SQLSTT
librerie associate a un utente (JOBD):
// ottenere lista utenti, va controllato quale utente usa la connessione WRKUSRPRF *all // controlla specifico utente DSPUSRPRF $USERNAME // JOBD definition path Descrizione lavoro . . . . . . . . . . . . : $JOBD_NAME Libreria . . . . . . . . . . . . . . . . : $JOBD_LIB // mostra definizioni della jobd // per vedere LIBL, in ultima pagina, scrollare e dare invio DSPJOBD JOBD($JOBD_LIB/WB_JBDSTD)
CHGUSRPRF $USERNAME WRKUSRJOB $USERNAME
associare una JOBD
CRTJOBD JOBD(QGPL/APP_NAME_JOBD) INLIBL(lib1 lib2 lib3 QGPL) CHGUSRPRF USRPRF(APP_USR) JOBD(QGPL/APP_NAME_JOBD) WRKUSRPRF USRPRF(APP_USR) RTVUSRPRF Current library . . . . . . . . . . . . . : *CRTDFT Library . . . . . . . . . . . . . . . . : LIBTSTA // in php connect only with configured user APP_USR
use a standard lib $JOBD_LIB where are JOBD defined
use i5 naming for consistency.
librerie associate a un processo:
WRKACTJOB F16 per ordinare per STATO i programmi con stato AWAIT / MWAIT sono fermi con messaggi che richiedono risposta 5 -> gestione programma 13 -> Visualizzazione della lista delle librerie, se attivo
utenti:
WRKUSRPROFILE GO CMDUSR
Lanciare un Programma con Argomenti: attenzione agli argomenti passati
call PGM(pgmname) # usa library list per trovare il programma call PGM(library/pgmname) call PGM(R105) PARM('99' X'015F' 'see you') # multiple args
The following table shows the verb abbreviations:
English | CL Abbreviation |
---|---|
Add | ADD |
Allocate | ALC |
Call | CALL |
Change | CHG |
Clear | CLR |
Copy | CPY |
Create | CRT |
Declare | DCL |
Delete | DLT |
Do | DO |
Display | DSP |
End | END |
Go To | GOTO |
Hold | HLD |
Initialize | INZ |
Move | MOV |
Override | OVR |
Reorganize | RGZ |
Release | RLS |
Remove | RMV |
Restore | RST |
Retrieve | RTV |
Save | SAV |
Send | SND |
Start | STR |
Work With | WRK |
Then you have the subjects:
English CL | Abbreviation |
---|---|
Attribute | A |
Authority | AUT |
Configuration | CFG |
Command | CMD |
Communication | CMN |
Description | D |
Diskette | DKT |
Document | DOC |
Entry | E |
File | F |
Folder | FLR |
Job | JOB |
Library | LIB |
List | L |
Member | M |
Message | MSG |
Object | OBJ |
Program | PGM |
Queue | Q |
Subsystem | SBS |
System | SYS |
Tape | TAP |
preferenze e default programmi:
CHGCMDDFT CMD(CRTSQLRPGI) NEWDFT('DBGVIEW(*source)')
LS/DIR/FIND
# LS: Displays contents of specified library DISPLIB # To list all files in library MYLIB that start with "A": # Use *ALLUSR in qualified name to skip Q libraries WRKOBJ MYLIB/A* *FILE # To look through all libraries for the file named LOSTFIL: WRKOBJ *ALL/LOSTFIL *FILE # To look through all libraries in your library list for a program named GLR100: WRKOBJ GLR100 *PGM
lista sorgenti(mbr) rediretta su un file DSPFD: Displays file description for specified file
DSPFD FILE(LIBRARY/*ALL) TYPE(*MBR) + OUTPUT(*OUTFILE) FILEATR(*PF) + OUTFILE(RGZFILEP) OUTMBR(*FIRST *REPLACE)
ottenere la descrizione campi di un file get file fileds description
DSPFFD FILE($JOBD_LIBDAT/MATPF00F)
FIND
WRKOBJ *ALL/EC_CLAGE0F DSPOBJD OBJ(*ALL/LISTQ*) OBJTYPE(*FILE)
invio sulle header per spostarsi sulle eventuali altre librerie in cui potrebbero esserci risultati
CAT DSPPFM: Display Physical File Member command, leggere i dati Use F20 (shift and F8) to scroll right, F19 to scroll left. B go to bottom T go to the top.
DSPPFM PR001 DSPPFM MYLIB/PR001 RUNQRY QRYFILE(PR001) // id formato file, numero campi, lunghezza record DSPFD MILIB/MYFILE00L
Display the files used in a program and which libraries the program was compiled over
DSPPGMREF
CP
CPYF CPYF FROMFILE(PERSONNEL/PAYROLL) TOFILE(TESTPAY/PAYROLL) MBROPT(*ADD)
chmod
edtobjaut
per files in IFS, si esegue come al solito da QSHELL
TOP / PS Work with Active Jobs: To see all jobs running on your system, including cpu/ram usage
WRKACTJOB # Displays my jobs for the current session WRKSBMJOB *JOB # work with jobs that are submitted by a job running under the same user profile as the current WRKSBMJOB SBMFROM(*USER) WRKUSRJOB
SHIFT+F4 per ordinare per CPU, con cursore sulle etichette bianche dal menu del programma è possibile vedere spool, messaggi, e kiallare
gestione della rete e dei servizi di rete
go tcpadm
free (RAM usage) RAM is normally referred to as Main Storage
WRKSYSSTS DSPSYSSTS
DU/DF
GO DISKTASKS
KILL Work with User Jobs:
WRKUSRJOB USER($USERNAME)
dal menu del programma è possibile vedere spool, messaggi, e killare
WRKUSRJOB USER(QSECOFR) STATUS(*ACTIVE) 4+F4 -> fine processo con opzioni
Come terminare: default CNTRLD(termina quando ha terminato elaborazioni) va cambiato in IMMED(termina immediatamente senza attendere)
CRON
# Look at scheduled jobs WRKJOBSCDE ADDJOBSCDE JOB(SVNCA) CMD(CALL PGM(CA_OBJ/$SVN)) FRQ(*WEEKLY) SCDDATE(*NONE) + SCDDAY(*MON *TUE *WED *THU *FRI) + SCDTIME(003000)
logging: cat /var/log/ IBM man
detta registrazione lavori in AS400.
tutte le stampe dell'utente corrente(utile a trovare errori di compilazione):
WRKSPLF # stampe di un utente specifico WRKSPLF $USER_NAME # stampe di un utente specifico filtrate per membro sorgente WRKSPLF SELECT(*CURRENT *ALL *ALL *ALL *ALL OR*)
# messaggi all'amministratore di sistema. qui si veno programmi che hanno dato errori DSPMSG QSYSOPR # Displays messages in a "message queue" DSPMSG MSGQ(QSYS/QSYSOPR) # opzioni: con ricerca per descrizione o stampa DSPMSGD RANGE(*FIRST IDU0571) # messaggi dal sistema WRKMSGF QCPFMSG # gestione di tutte le msgq WRKMSGQ MSGQ($USERNAME)
OUTQ(coda) contiene Spool files (SPLF o stampe) detailed status of a specific output queue
# Displays messages in specified OUTQ WRKOUTQ *all WRKOUTQ QEZDEBUG WRKOUTQ QEZJOBLOG
joblog per i processi in background(batch)
DSPJOBLOG DSPJOBLOG JOB(PHPJOB)
visualizza programmi in stato MSGW:
WRKUSRJOB USER($USERNAME) WRKACTJOB # subsystem WRKACTJOB SBS(QHTTPSVR) WRKACTJOB SBS(ZEND)
shows the system history log (QHST). The history log contains information about the operation of the system and system status.
DSPLOG
chmod / permissions management
DSPOBJAUT OBJ(filename) OBJTYPE(*FILE)
host/uname/ifconfig machine info, OS version:
DSPNETA SYSTEM Name DSPPTF Display the PTF and release
Uses the Copy to Stream File command (CPYTOSTMF) to create an ASCII copy of your file to the shared directory in the IFS.
CPYTOSTMF FROMMBR('/qsys.lib/mylib.lib/myfile.file/mymbr.mbr') TOSTMF('/home/mydir/file.txt') STMFCODPAG(*PCASCII) CPYTOSTMF FROMMBR('qsys.lib/qtemp.lib/qsrcf.file/temp.mbr') TOSTMF(&TOSTMF) STMFOPT(*REPLACE) CVTDTA(*AUTO) DBFCCSID(*FILE) STMFCODPAG(819) ENDLINFMT(*CRLF)
operazione invarsa, creare un sorgente da IFS
CPYFRMSTMF FROMSTMF('/ifs/path/') TOMBR('/qsys.lib/yourlib.lib/yourfile.file/filembr.mbr') MBROPT(*REPLACE) STMFCODPAG(*PCASCII) ENDLINFMT(*CRLF)
Creare un file di tipo CSV:
CRTPF FILE(USER999/CSVPC) # punta alla tabella desiderata CPYTOIMPF FROMFILE(*LIBL/DTAFIL) TOFILE(USER999/CSVPC) DSPPFM USER999/CSVPC # importare da un file CPYFRMIMPF FROMFILE(USER999/CSVPC) TOFILE(*LIBL/DTAFIL)
STRDBMON Start Database Monitor
ATTENZIONE: ENDTCPSVR *ALL stoppa tutti i terminali e mette la macchina fuori rete
# sequenza lunga, talvolta necessaria QSYS/ENDTCPSVR SERVER(*HTTP) HTTPSVR(ZENDAPP) QSYS/STRTCPSVR SERVER(*HTTP) HTTPSVR(ZENDAPP) STRTCPSVR SERVER(*SSHD) #within the same job... QSH CMD ('/QOpenSys/usr/sbin/sshd') #in a new job usein CL SBMJOB CMD(CALL PGM(QP2SHELL) PARM('/QOpenSys/usr/sbin/sshd'))
Verify that FTP is running
#looking for 'FTP' or '21' in the Local Port column: NETSTAT *CNN
gestione della rete e dei servizi di rete
GO TCPADM
errore squirrel:
"Unexpected Error occurred attempting to open an SQL connection."
errore PHP:
"SQLSTATE[08004] SQLConnect: 10061 [unixODBC][IBM][System i Access ODBC Driver]Communication link failure. comm rc=10061 - CWBCO1049 - The IBM i server application is not started, or the connection was blocked by a firewall"
SQLSTATE[08S01] SQLConnect: 10065 [unixODBC][IBM][System i Access ODBC Driver]Communication link failure. comm rc=10065 - CWBCO1003 - Sockets error, function returned 10065
se il driver ODBC non risponde, provabile sia QSERVER:
STRSBS SBSD(QSERVER)
// verificare errori di compilazione // e quali files con percorso assoluto sono utilizzati WRKSPLF SELECT(*CURRENT *ALL *ALL *ALL *ALL OR*) // errori a livello di sistema DSPMSG QSYSOPR // job in esebuzione bloccati? // con quale *LIBL gira il programma? WRKUSRJOB USER($USERNAME) WRKACTJOB job(PHPJOB) // quali files vengono utilizzati dal programma DSPPGMREF PHP_OBJ/MYPROGRAM004 // id formato file, numero campi, lunghezza record DSPFD MILIB/MYFILE00L
display error message description:
dspmsgd CPF4203