AS400 基础知识

Some websites about AS400
http://home.columbus.rr.com/jbmmdietz/iseries.html
http://www.help400.de/Freeware.htm


GO MAIN   
    - Go to IBM i Main Menu   
CHGSYSLIBL LIB(QSYS2989) OPTION(*ADD)   
    - Set system language to Chinese 
CHGSYSLIBL LIB(QSYS2989) OPTION(*REMOVE)
    - Set system language backp to English
    

GO CMD
    - Command Help
    - GO CMDDLT
Submit Job (SBMJOB)  
Work with Submitted Jobs (WRKSBMJOB)   
Work with Disk Status (WRKDSKSTS)   
    - F11 to show Protection information
Display Library (DSPLIB)    
    

Change Display File (CHGDSPF)   
    - CHGDSPF FILE(SSNAKE) WAITRCD(1) to update Maximum record wait time to 1s       
    - CHGDSPF FILE(SSNAKE) WAITRCD(*IMMED) for no waiting time       
    - CHGDSPF FILE(SSNAKE) WAITFILE(1) 
    
Work with Message Descriptions (WRKMSGD)  
Work with Message Files (WRKMSGF)  
Work with Message Queues (WRKMSGQ) 
Work with Messages (WRKMSG) 
Work with User Profiles (WRKUSRPRF)     

 
Create Data Area (CRTDTAARA)  
    - CRTDTAARA DTAARA(WITT/TSTDTAARA) TYPE(*CHAR) LEN(100)     
DSPDTAARA DTAARA(WITT/TSTDTAARA)  
Display Record Locks (DSPRCDLCK) 
Change Printer File (CHGPRTF) 
    - CHGPRTF FILE(FILENM) OUTQ(PRINTERNM) to send print file to printer
Work with Job Schedule Entries (WRKJOBSCDE)  
     

Work with Libraries (WRKLIB)  
    - WRKLIB LIB(WITT) 
    - could use it to find a LIB    
Work with Objects (WRKOBJ)   
    - WRKOBJ OBJ(*ALL/PF)  
    - could use it to find an object    
DSPSYSVAL SYSVAL(QCCSID) 
Work with Hardware Resources (WRKHDWRSC)    
    - WRKHDWRSC TYPE(*PRC)            


Backup/Restore PF with Save File
CRTSAVF FILE(WITT/PFBKP) 
DSPSAVF FILE(WITT/PFBKP)  
CLRSAVF FILE(WITT/PFBKP)        
SAVOBJ OBJ(PF) LIB(WITT) DEV(*SAVF) SAVF(WITT/PFBKP) 
RSTOBJ OBJ(*ALL) SAVLIB(WITT) DEV(*SAVF) SAVF(WITT/PFBKP) RSTLIB(WITT)                                                      
SAVLIB LIB(WITT) DEV(*SAVF) SAVF(WITT/PFBKP)   
SAVOBJ OBJ(*ALL) LIB(WITTGAMES) DEV(*SAVF) SAVF(WITTGAMPKG/SNAKEPKG)                            
RSTOBJ OBJ(*ALL) SAVLIB(WITTGAMES) DEV(*SAVF) SAVF(WITTGAMPKG/SNAKEPKG) RSTLIB(WITTGAMPLT)   


Display User Profile (DSPUSRPRF) 
CHGUSRPRF USRPRF(WITT) CCSID(037)        
    - CCSID for Coded character set identifier
Work with System Value (WRKSYSVAL)  
    - F4  ->  QCCSID   
RUNQRY QRYFILE((WITT/PF))
    - Query content of PF
    - Could use F4 and then input the file name only
RUNQRY QRYFILE((WITT/SRCPF SNDCOLMSG))     
    - Query content of PF member    
    

Work with User Jobs (WRKUSRJOB)  
    - 7=Display message to reply message   
Display Job (DSPJOB)  
Change Password (CHGPWD)   
Display Message Description (DSPMSGD)
    - view the content of MSGF
Remove Member (RMVM)

  
Screen Design Aid (SDA)   
Display Program References (DSPPGMREF)
Display Program (DSPPGM)   
Grant Object Authority (GRTOBJAUT) 
    - GRTOBJAUT OBJ(WITT/*ALL) OBJTYPE(*ALL) USER(*PUBLIC) AUT(*READ) 
Edit Object Authority (EDTOBJAUT)      
Display Object Authority (DSPOBJAUT) 
Revoke Object Authority (RVKOBJAUT)
    
 
Start Source Entry Utility (STRSEU) 
Start DFU (STRDFU)
    - Data file utility
    - update data using temporary program
Create Physical File (CRTPF)
Change Physical File (CHGPF)
Create Logical File (CRTLF)


Create Display File (CRTDSPF)
Create Print File (CRTPRTF)
Start Report Layout Utility (STRRLU)
Update data with temporary program (UPDDTA)
Interactive SQL session (STRSQL)


Display Physical File Member (DSPPFM)
Create Journal Receiver (CRTJRNRCV)    
Create Journal (CRTJRN)    
Start Journal Physical File (STRJRNPF)                            
End Journal Physical File (ENDJRNPF)


Work with Journal Receivers (WRKJRNRCV)  
Display Journal (DSPJRN)  
Work with Object Locks (WRKOBJLCK) 
Display File Field Description (DSPFFD) 
Display Record Locks (DSPRCDLCK)


Copy File (CPYF) 
Find String Using PDM (FNDSTRPDM) 
Work with Job (WRKJOB)     
Copy To Import File (CPYTOIMPF)

  
Copy From Import File (CPYFRMIMPF)     
Work with Objects Using PDM (WRKOBJPDM)     
Work with Members Using PDM (WRKMBRPDM) 
    - F11 Display names and types / Display text 
    - option 54 Compare
    - option 2 Edit      
    - F13 Change Session Defaults  Eg: Amount to roll / Uppercase input only
    - option 25 Find string 
Work with Libraries Using PDM (WRKLIBPDM)  


Programming Development Manager (STRPDM) 
    - F18 Change Defaults to change type and text / Compile in batch ..
Delete Program (DLTPGM)


Clear Physical File Member (CLRPFM)
    - remove all data from PF member
Add Physical File Member (ADDPFM)
    - add member to PF
Run Query (RUNQRY)
Run SQL Statements (RUNSQLSTM) 


Reorganize Physical File Mbr (RGZPFM)  
    - optimize disk space 
Copy To Tape (CPYTOTAP)  
    - backup data to tape 
Copy From Tape (CPYFRMTAP)  
    - restore data from tape  
Work with System Status (WRKSYSSTS)
Work with Active Jobs (WRKACTJOB)   
    - PF16 sort by selected column
    - PF20 filter (QZDASOINIT always occupy huge storage/CPU amount during DB query by ODBC) 
                                      

Display Data Base Relations (DSPDBR)  
    - DSPDBR FILE(WITT/PF) OUTPUT(*)
    - List dependent files, eg: LF  
DSPFD FILE(WITT/PF) TYPE(*CST) OUTPUT(*)
    - List constraint details  
DSPFD FILE(WITT/PF) TYPE(*ACCPTH) OUTPUT(*)
    - List access path
DSPFD FILE(WITT/SRCPF) TYPE(*MBRLIST) OUTPUT(*)
    - List all members
DSPFD FILE(WITT/PF)     
    - DBCS capable = Yes to support Chinese (Double Byte Code Set )       
    - SBCS (Single Byte Code Set  )       


Update system object (eg: update CCSID of QSYS/QADBXREF)
WRKOBJLCK OBJ(QADBXREF) OBJTYPE(*FILE)
    - locked by system job    
QDBSRVXR     QSYS         *SHRRD     HELD           *JOB 
In 'IPL OPTION' screen of IPL procedure, update 'DEFINE OR CHANGE SYSTEM AT IPL' to 'Y'
    - Option 5 (GENERAL OBJECT COMMANDS)  ->  4 (CHANGE PHSICAL FILE)  ->  follow the screen prompt


Screen Recording
STRCPYSCN SRCDEV(*REQUESTER) OUTDEV(*NONE) UTFILE(WITT/REC1)
ENDCPYSCN


Copy SPLF to PF/PF(MBR)
CRTSRCPF FILE(WITT/SRCPF) RCDLEN(212) IGCDTA(*YES)
CRTPF FILE(WITT/PF) RCDLEN(200) IGCDTA(*YES)
CPYSPLF FILE(REGTEST) TOFILE(WITT/PF)      
CPYF FROMFILE(WITT/PF) TOFILE(WITT/SRCPF) TOMBR(REGTEST) MBROPT(*ADD) FMTOPT(*CVTSRC)
Work with Spooled Files (WRKSPLF) 
    - 5=Display to query the content of SPLF
Delete Spooled File (DLTSPLF)  


Copy data between PF/stream file
CPYTOIMPF FROMFILE(WITT/PF) TOSTMF('streamfile') MBROPT(*REPLACE) RCDDLM(*LF)  DTAFMT(*FIXED) 
CPYFRMIMPF FROMSTMF('/streamfile') TOFILE(WITT/PF2) RCDDLM(*LF) FLDDLM('|')  
                                                                  

LIB(QSYS.LIB) is a special object in AS400 system, it is used to link to other objects.
Different from the folder/files in PC/UNIX system, LIB/OBJs is single-layer. 
IFS -- Intergrated File System


FTP to transfer data between AS400 and PC
C:\Users>cd C:\Users\Folder_to_save_source
C:\Users\Folder_to_save_source>ftp IP_of_AS400
ftp> prompt off
Interactive mode Off .
ftp> asc
200 Representation type is ASCII nonprint.
ftp> quote type c 1386
200 Representation type is CCSID 1386.
ftp> put file src.cbl
file: File not found
ftp> mget
ftp> bye
221 QUIT subcommand received.
C:\Users\Folder_to_save_source>>dir >>a.txt
C:\Users\Folder_to_save_source>> rename **.** **.txt


CALL QCMD
    - Command Entry 
SHIFT + ESC -> 1
    - switch screen
SHIFT + ESC -> 2 -> 90
    - cancel the program which processing 
SHIFT + ESC -> 3
    - check spool file/job log


Debug SQLCBLLE/CBLLE
Debugging view *SOURCE
Start Debug (STRDBG)  
    - F6 add break point
    - F10 process single step
    - F12 process until reach break point
    - F22 enter sub-program
    - F9 update variable's value
ENDDBG


Debug CBL/CLP
Start ISDB (STRISDB)
    - F6 add break point
    - F4 go to break point
    - F5 process single step
    - F17 process until reach break point
    - F11 display variable's value
    - F23 update variable's value
    - F13 process until reach cursor
    - F14 add sub-program
    - F21 command panel


Debug Query
CRTDUPOBJ OBJ(QAQQINI) FROMLIB(QSYS) OBJTYPE(*FILE) TOLIB(WITT) DATA(*YES)
STRSQL 
UPDATE WITT/QAQQINI SET QQPARM = 'MESSAGES_DEBUG', QQVAL = '*YES', QQTEXT = NULL 
WHERE QQPARM = 'MESSAGES_DEBUG' and QQVAL = '*DEFAULT'
CHGQRYA QRYOPTLIB(WITT) 
WRKQRY Option 9=Run 
DSPJOBLOG OUTPUT(*PRINT) 


OVRDBF FILE(FILE-NAME) TOFILE(*LIBL/FILE-NAME) MBR(*FIRST) SHARE(*YES)    
OPNDBF FILE(FILE-NAME) OPTION(*ALL) TYPE(*PERM)  
    - solve the record lock between program and sub-program


*LDA Local Data Area
CRTDTAARA
CHGDTAARA
DSPDTAARA
DLTDTAARA


AS400 compile C program
If need to ftp source from (win/unix) to AS400, remember to use 'quote type c 1386' command
For single source, use 14 Create Bound C Program (CRTBNDC) to generate executable PGM
For sources of a moudle of a system, use 15 Create C Module (CRTCMOD) to generate Moudle
Use CRTPGM to generate executable PGM from Moudle, use UPDPGM to update existing PGM 
Use DSPJOBLOG to check compiling error, or use SP to check SPOOL FILE


Send colorful message
Code CLP SNDCOLMSG
PGM         PARM(&MSG &COLOR &MSGTYPE) 
            DCL         VAR(&MSG)      TYPE(*CHAR) LEN(80) 
            DCL         VAR(&COLOR)    TYPE(*CHAR) LEN(1) 
            DCL         VAR(&MSGTYPE)  TYPE(*CHAR) LEN(10) 
            DCL         VAR(&LASTBYTE) TYPE(*CHAR) LEN(1) VALUE(X'20')
            DCL         VAR(&TEXT)     TYPE(*CHAR) LEN(82) 

            CHGVAR      VAR(&TEXT) VALUE(&COLOR *CAT &MSG *TCAT &LASTBYTE) 
            SNDPGMMSG   MSG(&TEXT) TOPGMQ(*EXT) MSGTYPE(&MSGTYPE) 
            SNDPGMMSG   MSG(&TEXT) MSGTYPE(&MSG) 
END:        ENDPGM 

CRTCMD CMD(SNDCOLMSG) PGM(SNDCOLMSGC)
    - create command

SNDCOLMSG:  CMD         PROMPT('Send colored message')
            PARM KWD(MSG) TYPE(*CHAR) LEN(80) PROMPT('Message')
            PARM KWD(COLOR) TYPE(*CHAR) LEN(1) RSTD(*YES) 
                DFT(*GREEN) SPCVAL( 
                    (*GREEN X'20') 
                    (*GREEN_REVERSE X'21') 
                    (*WHITE X'22') 
                    (*WHITE_REVERSE X'23') 
                    (*GREEN_UNDERSCORE X'24') 
                    (*GREEN_UNDERSCORE_REVERSE X'25') 
                    (*WHITE_UNDERSCORE X'26') 
                    (*RED X'28') 
                    (*RED_REVERSE X'29') 
                    (*RED_BLINK X'2A') 
                    (*RED_REVERSE_BLINK X'2B') 
                    (*RED_UNDERSCORE X'2C') 
                    (*RED_UNDERSCORE_REVERSE X'2D') 
                    (*RED_UNDERSCORE_BLINK X'2E') 
                    (*TURQUOISE X'30') 
                    (*TURQUOISE_REVERSE X'31') 
                    (*YELLOW X'32') 
                    (*YELLOW_REVERSE X'33') 
                    (*TURQUOISE_UNDERSCORE X'34') 
                    (*TURQUOISE_UNDERSCORE_REVERSE X'35') 
                    (*YELLOW_UNDERSCORE X'36') 
                    (*PINK X'38') 
                    (*PINK_REVERSE X'39') 
                    (*BLUE X'3A') 
                    (*BLUE_REVERSE X'3B') 
                    (*PINK_UNDERSCORE X'3C') 
                    (*PINK_UNDERSCORE_REVERSE X'3D') 
                    (*BLUE_UNDERSCORE X'3E')) PROMPT('Color')
                    
            PARM     KWD(MSGTYPE) TYPE(*CHAR) LEN(10) RSTD(*YES) +
                     DFT(*INFO) VALUES(*INFO *COMP) +
                     PROMPT('Message type')

SNDCOLMSG MSG('TestColorfulMessage') COLOR(*YELLOW_REVERSE)


GO LICPGM  
    - 20. Display installed secondary languages
    - 10. Display installed licensed programs  ->  F11 to show version number          
Configure TCP/IP (CFGTCP)  
    - 2. Work with TCP/IP routes      
    - 3. Change TCP/IP attributes  


RRN in SQL/400
select rrn(file_name), field1, field2 from file_name;


Compare CRTPF against SQL CREATE TABLE 
CRTPF
    - Maximum members = default 1 
    - Member size = default 10000 could expand to 13000 as max      
    - Reuse deleted records (REUSEDLT) = *NO      
    - Max % deleted records allowed (DLTPCT) = *NONE   
CREATE TABLE
    - Maximum members = could only be 1 
    - Member size = default *NOMAX      
    - Reuse deleted records (REUSEDLT) = *YES  
    - Max % deleted records allowed (DLTPCT) = *NONE   
  

Domino for AS/400 backup and restore
GO SAVE    
    - 21. Entire system     
    - 22. System data only     
GO RESTORE
    - 21. System and user data      
    - 22. System data only          


AS/400 backup for 24-hours online system
    - MIMIX need 2 set of AS/400 and MIMIX software
    - Journal rollback
    

AS/400 DATQ (Data Queue)    
CL command
    - CRTDTAQ
    - DLTDTAQ
    - WRKDTAQ
System function
    - QCLRDTAQ 
    - QSNDDTAQ  
    - QRCVDTAQ  
Call system function by C program
    QRCVDTAQ("TCPIP     ",     /* dtaq name      */   
             "*LIBL     ",     /* dtaq lib       */   
             &DataLength,      /* length of data */   
             jobid_dq,         /* data           */   
             30.0d);           /* wait time (sec)*/   
    
    QSNDDTAQ("TCPIP     ",     /* dtaq name      */          
             "*LIBL     ",     /* dtaq lib       */          
             DataLength,       /* length of data */          
             jobid);           /* data           */          
Call system function by RPG program
    CALL      'QRCVDTAQ'                            
    PARM      'QNAME   '  P@QNAME          10     
    PARM      '*LIBL     '  P@LIBNM          10     
    PARM                    P@FLDLEN          5 0   
    PARM                    P@DATA                  
    PARM      10            P@WAIT            5 0   
    PARM      'EQ'          P@ORDER           2     
    PARM      11            P@KEYLEN          3 0   
    PARM                    P@KEY            11     
    PARM      20            P@SNDLEN          3 0   
    PARM                    P@SNDER          20     
    
    CALL      'QSNDDTAQ'                            
    PARM      'QNAME  '  P@QNAME          10     
    PARM      '*LIBL     '  P@LIBNM          10     
    PARM                    P@FLDLEN          5 0   
    PARM                    P@DATA                  
    PARM      11            P@KEYLEN          3 0   
    PARM                    P@KEY            11     


Journal related command
Add Remote Journal     - ADDRMTJRN 
Apply Journaled Changes     - APYJRNCHG 
Change Journal     - CHGJRN    
Change Remote Journal     - CHGRMTJRN 
Compare Journal Images     - CMPJRNIMG 
Create Journal     - CRTJRN    
Delete Journal     - DLTJRN    
Display Audit Journal Entries    DSPAUDJRNE
Display Journal     - DSPJRN    
End Journal     - ENDJRN    
End Journal Access Path     - ENDJRNAP  
End Journal Object     - ENDJRNOBJ
End Journaling PF Changes     - ENDJRNPF 
Receive Journal Entry     - RCVJRNE  
Remove Journaled Changes     - RMVJRNCHG
Remove Remote Journal     - RMVRMTJRN
Retrieve Journal Entry     - RTVJRNE  
Send Journal Entry     - SNDJRNE  
Start Journal     - STRJRN   
Start Journal Access Path     - STRJRNAP 
Start Journal Object     - STRJRNOBJ
Start Journal Physical File     - STRJRNPF 
Work with Journal     - WRKJRN   
Work with Journal Attributes     - WRKJRNA  
Accounting Commands     - CMDACG   
Commit Commands     - CMDCMT   
File Commands     - CMDFILE  
Journal Receiver Commands     - CMDJRNRCV
Receive Commands     - CMDRCV  


Basic Operation
* WRK    - Work
* CRT    - Create
* ADD    - Add
* CHG    - Change
* DLT    - Delete
* DSP    - Display
* EDT    - Edit
* CPY    - Copy
* MOV    - Move
* RNM    - Rename
* SAV    - Save
* RST    - Restore
* RTV    - Retrieve
* GRT    - Grant
* DMP    - Dump


CL Statements
CALL    - Call
CALLPRC    - Call Procedure
RETURN    - Return
PGM    - program 
ENDPGM    - End Program 
IF    - If 
ELSE    - Else 
DO    - Do 
ENDDO    - End Do 
GOTO    - Go To 
CHGVAR    - Change Variable 
DCL    - Declare 
CHGVAR    - Change Variable 
CVTDAT    - Convert Date 
CHGDTAARA    - Change Data Area
CRTDTAARA    - Create Data Area
DLTDTAARA    - Delete Data Area
DSPDTAARA    - Display Data Area
RTVDTAARA    - Retrieve Data Area
ENDRCV    - End Receive 
DCLF    - Declare File 
RCVF    - Receive File 
RTVMBRD    - Retrieve Member Description 
SNDF    - Send File 
SNDRCVF    - Send/Reveive File
WAIT    - Wait 
MONMSG    - Monitor Message
RCVMSG    - Receive Message
RMVMSG    - Remove Message
RTVMSG    - Retrieve Message
SNDPGMMSG    - Send Program Message
SNDRPY    - Send Reply
SNDUSRMSG    - Send User Message
CHKOBJ    - Check Object
PRTCMDUSG    - Print Command Usage
RTVCFGSRC    - Retrieve Configuration Source
RTVCFGSTS    - RetrieveConfiguration Status
RTVJOBA    - Retrieve Job Attributes 
RTVSYSVAL    - Retrieve System Value
RTVUSRPRF    - Retrieve User Profile
CRTCLMOD    - Create CL Module
DLTMOD    - Delete Module
DLTPGM    - Delete Program
CRTBNDCL    - Create Bound Control Language Program
CRTPGM    - Create Program
CRTSRVPGM    - Create Service Program


 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值