CRACK AS/400 1. Activation Group Substructure of a job Container for memory & resources (static program variables, dynamic storage, Open files, commitment definition, SQL cursors) Job can own many activation groups ILE programs will run only in activation groups Types of Activation Groups *NEW (PGM only) - allocates memory every time. Activation group is deleted when program ends, existing value gets lost Named (PGM & SRVPGM) SRVPGM) - one time allocation. allocation. Existing values won’t get cleared on next calls. Need Need to clear the activation group manually. RCLACTGRP *CALLER(PGM & SRVPGM) - called program runs inside the activation group of calling program. Increase in performance *ENTMOD (PGM only) - *NEW, QILE, QILETS is selected LE Type + Storage determines Non LE [i.e. not RPGLE, CLLE, CBLLE] 2. Commitment Control To process a group of database changes (update, insert, delete) as a single unit of work COMMIT guarantees that the group of operations is completed ROLLBACK guarantees that the group of operations is backed out SQL Commit, CL Commit, RPG Commit, SQL Rollback, CL Rollback, RPG Rollback FILES should have been JOURNALLED STRCMTCTL lock levels o *CHG – Lock over chain (U), lock released when COMMIT/ROLLBACK or when no change after chain o *CS - All records read read Chain(N)/Chain(U) are locked, released when when COMMIT/ROLLBACK or no change o *ALL – All records accessed are locked, lock released during COMMIT/ROLLBACK It is advisable to use separate files for input and update as ROLLBACK command/opcode resets the pointer ENDCMTCTL is not allowed when pending changes are active for interactive jobs. In batch jobs pending changes are rolled back WRKCMTDFN can be used for forced COMMIT/ROLLBACK over any jobs commitment definition STRCMTCTL is available with Activation Group/Job Levels 3. Journal Can be categorized under backup and recovery To store record level database changes and allows those changes to be rolled back PF record level changes are first recorded in journals and then applied to the database record CRTJRNRCV STRJRNOBJ for *DTA and *DTAQ CRTJRN STRJRN for *STMF,*DIR, *DTAARA, *DTAQ STRJRNPF ENDJRNPF It is advised to purge old journal receivers on regular basis as it eats up lot of space WRKJRNA to see journalled objects (files, DTA, DTAQ, IFS), receivers (current/previous), journal status RCVJRNE for user exit program to continuously receiving journal entries (write to backup system) RTVJRNE to get journal entry from the journal (can be filtered to user, job, object, etc) RMVJRNCHG to remove the changes that have been journalled (applied with required range) 4. File Transfer in AS400 Receive files from host, send files to host options in IBM Client Access Emulator Manual FTP – GET, PUT, MGET, MPUT \\hldd40.uk.fid-intl.com Copy Paste to IFS folders using windows explorer SNDDST command for *FILE, *DOC, *LMSG for sending to required email id INPUT & OUTPUT, Transfer across systems STRTCPFTP – Overridden files with name INPUT - Both IFS file and DTA file can be transferred CRTDDMF creates reference file in local server to access file located on remote server CHGNETA to setup the access security SQL, DSPPFM won’t work on DDMF. Use CPYF to access data SNDNETF, RCVNETF can be used to transfer save file or member of a physical file Third party tools ESEND, TAATOOL/SNDIFSMAIL, Connect Direct Spool file transfer using SNDNETSPLF, TAATOOL/SNDSPLMAIL 5. Save File Save file can be used with Save and Restore commands to contain data SAVF are great for transferring data (AS400 objects) between OS400 Machines During SAVF FTP, BIN should be specified. The transfer happens as image Save file is a real time saver during system backups CRTSAVF, SAVOBJ, RSTOBJ 6. Integrated File System (IFS) IFS supports stream input/output and storage management similar to personal computer Stream file can contain long continuous string of data Hierarchical directory structure Efficient handling of types of stream data, such as image, audio, video [jar files for java calls] Allows PC users to take better advantage of their graphical user interface WRKLNK, CPY, RNM, MOV, RMVLNK, CPYTOSTMF, CPYFRMSTMF, CRTDIR, RMVDIR, CPYTOIMPF, CPYFRMIMPF, CPYTOPCD All folders resides in QDLS directory [WRKFLR takes us there] All objects (Lib, file, mbr, object) resides in QSYS.LIB directory C language API’s opendir(), readdir(), closedir(), lstat(), open(), close(), read(), write() Each filename can be upto 255 characters. So support longer filenames CPYTOSTMF and CPYFRMSTMF Used to copy data between stream files and database file members Database file should be program described PF with one field or source PF with one text field Can be also used to transfer data between stream file and save file CPYTOIMPF and CPYFRMIMPF Copy data between stream files and database members [Externally described PFs] Delimiters can be specified to mark fields, record boundaries Field Definition File [FDF] can also be specified Options for converting special data types such as date, time are also provided CPYTOPCD, CPYFRMPCD [Its PC Document] Copy data between database file and PC document in a folder It is advised not to precede any entry with ‘*’ unless a special value
7. Stored Procedures and Triggers Stored Procedure can be called by an application program with an SQL CALL Statement Stored Procedure can be called locally or remotely a, SQL Stored Procedures are written in SQL language b, External Stored Procedures are written in programming languages [RPGLE, etc] c, Java Stored Procedures corresponds to a method in a java class CREATE PROCEDURE, DROP PROCEDURE, CREATE FUNCTION, DROP FUNCTION Procedure may or may not return value Function always returns a value Procedures are not allowed Function can be used in SQL Statement Procedures can return many Function can return only one value Procedure can call function SQL function cannot call procedure Procedure can have Update/Delete/Alter Function cannot have Update/Delete/Alter, etc Triggers are user written programs that are activated by the database manager when a data change is performed in a database Triggers are mainly intended for monitoring database changes & taking appropriate actions Main advantage of triggers – Triggers are activated automatically a, SQL Triggers – CREATE TRIGGER statement in SQL b, External Triggers – Used to call any supported high level language with *PGM Object (ADDPFTRG, RMVPFTRG, CHGPFTRG) Trigger events – INSERT, UPDATE, DELETE, READ (READ only for external triggers) Trigger Time – Before, After The Trigger program is called with Trigger Buffer as entry parameter with Before & After images 8. Job Scheduler You can schedule a job to run using WRKJOBSCDE (Work Job Schedule Entry), ADDJOBSCDE, RMVJOBSCDE You can schedule using iSeries Navigator – Work Management > Job Queues > Properties > Schedule the job You can schedule using Advanced Job Scheduler for Wireless WRKJOBSCDE can be used for ADDJOBSCDE CHGJOBSCDE HLDJOBSCDE RLSJOBSCDE RMVJOBSCDE Frequency = Once, Weekly, Monthly [Weekly inturn has option to select week days (mon, tue, etc) = Daily ] Monthly + Schedule date of 31/01/2010 wont run for Feb, Apr, Jun, Sep, Nov Schedule date can be set as *MONTHSTR, *MONTHEND Even SBMJOB command has Schedule Date and Schedule Time 9. Debugging in AS/400 Debugging helps to locate program errors that we cannot visually find by looking at the code Execute statement-by-statement or stopping at breakpoints If program Updates/Writes to a file in *PROD library, then Update Production File option should be *YES a, SBMJOB with HOLD(*YES) Batch Debug b, WRKSBMJOB or WRKJOBQ to get qualified job number/user/name c, STRSRVJOB JOB(job details) d, STRDBG and provide program names e, RLSJOB and F10 to show command entry display f, Add Breakpoints, F3, and then Enter Key g, ENDDBG then ENDSRVJOB Debug Commands – break, break when, eval, equate, watch (shorthand use EQ VAL1 9362100052, later on EV Mob = Val1), step n lines(statements), clear, clear PGM ADDTRC, DSPTRCDTA, RMVTRC Its is possible to debug other user’s interactive job or already running batch job using STRSRVJOB 10. Exception and Error Handling Exception/Error handling is the term given to handling unexpected exceptions/errors in programs E.g. Divide by Zero, array index error, write duplicate record to file with unique constraint The most common indication is that the program fails with a CPF message In OPM the escape message from OS is sent directly to indicate that program failed In ILE, the control flows through call stack to see if calling program handles the error, control till Act Group boundary a, *PSSR Subroutine Control automatically goes to PSSR subroutine for Program Exceptions • It is advised to have an indicator to avoid recursive failure due to exception inside PSSR subroutine • DUMP and exit from program • b, F Spec INFSR(Subroutine name) can be given for trapping file exceptions c, ERROR Extender (E) or MONMSG. Use %ERROR, %STATUS to get exact error code [in CL use RCVMSG] d, Monitor; On-Error Status_Code : Status_Code : Status_Code; EndMon; On-Error 00102; On-Error *FILE; On-Error *PROGRAM; On-Error *ALL; Information Data Structures a, PSDS – Provides information about program status (*PROC, *STATUS, *PARMS, jobname=244, user=254, jobno=264) b, INFDS – Provides information about the status of the files DS Section – File Feedback, Open Feedback, I/O Feedback, Device Specific Feedback, Get Attributes Feedback *FILE, *STATUS, *OPCODE, *RECORD, No of Recs, I/O Count, Overflow line, SFL RRN, SFL No or recs in page Priority of Handlers - Error Extender (E) > Monitor > ILE Condition Handler > INFSR/PSSR > RPG default Error Handler 11. Communicating between Programs and Procedures Parameters – CRTDTAARA, RTVDTAARA, CHGDTAARA, DSPDTAARA, DLTDTAARA, DTAARA(In, Out, Unlock, *LDA, *GDA). MaxSize=2000 chars Data Area – QSNDDTAQ, QRCVDTAQ, QCLRDTAQ, QMHRDQM, QSH DATAQ, CRTDTAQ, DLTDTAQ Data Queue FIFO, LIFO, Entry Length, Remote Data Queue DDM, Wait time during read Job Switches - *INU1 till *INU8, %SWITCH, CHGJOB SWS However database files, user space, MQ series, etc can be used 12. Indicators in AS/400 One byte character field which contains either ‘1’ (*ON) or ‘0’ (*OFF) used to condition calculation and output operations Indicators MR, 1P, KA-KN, KP-KN cannot be used with SETON opcode [MR, 1P cannot be used with SETOFF opcode] Use INDARA, INFDS (DS name) to have 99 x 2 indicators. i.e. *IN03 in DSPF does not affect *IN03 in program Declare pointer (*) with %ADDR(*IN) and a DS based (Indicator Pointer) to have named indicators *INU1 - *INU8 refers to the job switches. Can be set using CHGJOB, CRTJOBD First Page Indicator 1P is set on when RPG program starts. Used along with program with Primary File - Used to print header in first page alone. 1P is et off before first read of the primary file Last Record Indicator LR is set on after the last record from the primary file is processed (*INLR Vs Return) - Just setting on *INLR doesn’t end the program (L1 till L9 gets set on when LR is set on) - If program end with *INLR set on, the files are closed, fields are cleared Return Indicator RT to indicate internal RPG logic that control should go back to calling PGM [RT<>Return, Return=Immediate] Function Key Indicator *INKA - *INKN, *INKP - *INKY for CFxx or CAxx in Workstation file/DSPF Halt indicator H1 – H9 to indicate error. The program ends abnormally when control returns back Overflow indicators *INOA - *INOG, *INOV using OFLIND() is set on when last line in a page is printed or passed General indicators 01 - 99
13. Compiler Directives An instruction to the compiler to complete a task before formally starting to compile the code /FREE - /END-FREE specifies the beginning and end of free format calculation specification block /TITLE prints title in each page of compiler listing. Can be > 1 /TITLE. TITLE1 will be used till TITLE2 is encountered /EJECT to begin a new page in compiler listing /SPACE to print blank lines in compiler listing. Maxno=112. If no specified > lines left in page then just starts in new page /COPY or /INCLUDE is for same purpose (copybook). Differs if included code contains embedded SQL. /COPY expands embedded SQL Files can be Physical file or IFS file /COPY libname/filename,membername /COPY filename,membername /COPY membername Example /EOF will ignore the rest of the source lines in compiler listing and while generating executable code Conditional Compiler Directives allows us to conditionally include or exclude sections of source code from the compile /IF DEFINED(*ILERPG) /IF DEFINED *CRTRPGMOD, VxRxMx /DEFINE, /UNDEFINE H BNDDIR(‘Q2LE’) H DFTACTGRP(*NO) /ELSE, /ELSEIF NOT, /IF NOT DEFINED /ENDIF /ENDIF 14. Arrays in AS/400 Is short for array of variables of same type A way for grouping objects and variables together so that they are easy to work with a, Runtime Array DIM(n) b, Compile Time Array CTDATA, PERRCD(n), ** c, Pre-Runtime Array FROMFILE(filename) avoids recompilation Vs CTDATA, Coding effort Vs Runtime 15. Override Database File and Open Query File [ Its all temporary] OVRDBF is used to a, Override (replace) the file named in the program (say force RPG to refer file in a different library) b, Override certain parameters of a file (say Level Check, Record Wait Time, Record Format Lock, Inhibit Write) 2 2 2 c, (A + B) = A + B + 2BA POSITION keyword in OVRDBF can be used to access records with *RRN, *KEY, *KEYA, *KEYAE, *KEYB, *KEYBE, *START, *END OPNQRYF acts as a filter between the processing program and database records (dynamic selection) OPNQRYF should be used with OVRDBF for RPG calls. It creates a temporary file unlike CRTPF, LF o Dynamic Keyed Sequence access path o Dynamic Join o Group By, Having functionalities of SQL Select OPNQRYF can be used without OVRDBF, CPYFRMQRYF needs to be used to copy the filtered records 16. Multiple Format Logical File Lets to use related records from 2 or more physical files by referring to one logical file Multiple format logical file can be used for update as well inside RPGLE R REC1 PFILE(PF1) K FLD1 R REC2 PFILE(PF2) File Fields can be different across files K FLD1 K FLD2 Something like SELECT FLD1, FLD2 FROM FILE1 UNION SELECT FLD5 as FLD1 FROM FILE2 I SPEC record format name with indicator can be used to find which record format in logical file is used IGNORE keyword can be used to ignore the record format and its records Use record format name along with write opcode to target the correct physical file If Program (say COBOL) uses file name with write statement, a format selector program can be linked with CRTLF 17. Join Logical File It is a logical file that combines (in one record format) fields from 2 or more physical files Its just a view, cannot be used to update the records in physical files Key fields in join record format must be from first file specified on JFILE (say primary file) Select/Omit can come from any of the physical files R RECFMT JFILE(FILE1 FILE2 FILE3) J JOIN(FILE1 FILE2) JFLD(AFLD1 BFLD1) JFLD(AFLD2 BFLD2) J JOIN(FILE2 FILE3) JFLD(BFLD4 CFLD1) AFLD1 AFLD2 AFLD7 BFLD2 BFLD8 K AFLD1 K AFLD2 S BFLD8 COMP(EQ ‘Y’) Join Logical File Vs Multiple Format Logical File a, No Update (Only View) Update b, Single Read will get all file values Multiple Reads c, One Record Format Many Record Formats d, Filter only matched records All records (Like Union) e, Cannot ignore any file We can ignore specific record formats 18. SQL Cursor, Dynamic SQL, SQL Commitment When SQL runs a SELECT statement, output will be a result table. CURSOR provides a way to access result table records 1 by 1 EXEC SQL DECLARE C1 CURSOR FOR SELECT FLD1, FLD2 FROM FILE1 FOR UPDATE OF FLD2; EXEC SQL OPEN C1; EXEC SQL FETCH C1 INTO :TMPF1, :TMPF2; EXEC SQL UPDATE FILE1 SET FLD2 = :NEWVALUE WHERE CURRENT OF C1; EXEC SQL DELETE FROM FILE1 WHERE CURRENT OF C1; EXEC SQL CLOSE C1; SCROLL CURSOR – FETCH NEXT, PRIOR, FIRST, LAST, RELATIVE N EXEC SQL PREPARE P1 FROM :String -> EXEC SQL EXECUTE P1 USING :Value [? Will be used for dynamic values] => EXECUTE IMMEDIATE = PREPARE + EXECUTE EXEC SQL EXECUTE IMMEDIATE :String SQLCA, SQLCODE, SQLSTATE SET OPTION COMMIT = *NONE affects only SQL statements and not F Spec files EXEC SQL COMMIT; EXEC SQL ROLLBACK;
19. User Space User Space objects are used for storing user defined information (large amount of data) *USRSPC Max Size of 16MB Vs Data Area Max Size of 2000 chars Mostly used by LIST API’s to generate list of data QUSCRTUS, QUSRTVUS, QUSDLTUS, QUSCHGUS First retrieve the header information (No. of entries, offset, size, size of entry) then retrieve entries one by one User Space is automatically expandable 20. RPG Built-in Functions %ABS, %ADDR, %ALLOC, %BITAND, %BITNOT, %BITOR, %BITXOR, %CHAR, %CHECK, %CHECKR, %DATE, %DAYS, %DEC, %DECH, %DECPOS, %DIFF, %DIV, %EDITC, %EDITFLT, %EDITW, %ELEM, %EOF, %EQUAL, %ERROR, %FIELDS, %FLOAT, %FOUND, %GRAPH, %HOURS, %INT, %INTH, %KDS, %LEN, %LOOKUP, %MINUTES, %NULLIND, %OCCUR, %OPEN, %PADDR, %PARMS, %REALLOC, %SCAN, %SECONDS, %SHTDN, %SIZE, %SQRT, %STATUS, %STR, %SUBDT, %THIS, %TIME, %TIMESTAMP, %TLOOKUPxx, %TRIM, %TRIML, %TRIMR, %UCS2, %UNS, %UNSH, %XFOOT, %XLATE, %YEARS 21. QUERY 400 AND QMQUERY QUERY 400 is IBM provided, Easy to use and Powerful tool for viewing and printing data WRKQRY => 1=Create, 2=Change, 3=Copy, 4=Delete, 5=Display, 6=Print, 8=Run in Batch, 9=Run [even GO QUERY can be used] STRQM main command which has WRKQRY, STRQM QUERY 400 object type *QRYDFN RUNQRY command QUERY 400 allows to Select, Filter, Order, Join, Title Headings, Summary (Min, Max, Sum), Display/Print/Outfile QUERY MANAGER used to create, maintain, run queries SQL Knowledge no required to create queries QM QUERY object type *QMQUERY, *QMFORM [F15=Check Syntax when editing SQL] QM QUERY Types => Prompt, SQL STRQMQRY, RTVQMQRY, CRTQMQRY, DLTQMQRY We can build dynamic query, like, ‘WHERE FLD = &VALUE1’ and use STRQMQRY SETVAR(VALUE1 10) 22. Subfiles and Message Subfiles Used in display file programming to allow programmers to display multiple records on the display that have same record layout It is not an object or file, just a temporary place to store data Minimizes the programming effort needed to handle displaying repetitious data Allows the user to scroll, or page through the data in multiple pages Subfile is made up of two formats, Subfile format and Subfile control format We cannot delete Subfile record, just update. If delete required, then reload all 1. Load All Subfile (SFLSIZ > SFLPAG) - All records are loaded at a time. Max of 9999 - Page Up, Page Down handled by the system 2.Expanding Subfile (SFLSIZ > SFLPAG) - Load fixed number of records, display it, if page down load next set and display st - Page Down should be handled inside the program [only during 1 load, if pages loaded it remains in memory] - Max 9999 - Once all records are loaded Expanding Subfile = Load All Subfile 3. Single Page Subfile (SFLSIZ = SFLPAG) - Load SFLPAG number of records, display, clear, load, … - Page Up and Page Down needs to be handled by the program - Field option indicators are allowed only in Single Page Subfile - Need array or work file when users are allowed to select multiple records across pages Message Subfiles are special subfiles designed to hold messages They load themselves automatically from messages on a given program message queue QMHSNDPM from RPG, SNDPGMMSG from CLP, QMHRMVPM to clear the messages SFLMSGRCD(24), SFLMSGKEY, SFLPGMQ are important keywords for message subfile SFL, SFLCSRRRN, SFLCTL, SFLDLT, SFLDROP, SFLDSP, SFLDSPCT, SFLEND, SFLENTER, SFLFOLD, SFLINZ, SFLLIN, SFLMODE, SFLMSG, SFLMSGKEY, SFLMSGRCD, SFLNXTCHG, SFLPAG, SFLPGMQ, SFLRCDNBR, SFLRNA, SFLROLVAL, SFLSCROLL, SFLSIZE, ROLLUP, ROLLDOWN, READC 23. Integrated Language Environment (ILE) The Integrated Language Environment (ILE) is the current stage in the evolution of OS/400 program models Original Program Model (OPM). COBOL, RPG, CL, BASIC and PL/1 all operated in this model Extended Program Model (EPM). EPM was created to support languages like C, Pascal, and FORTRAN ILE Benefits – Binding, Modularity (reduce compilation effort), Reusable Components, Common runtime services, source debugger Include better control over resources, better control over language interactions, better code optimization Procedure
- Set of self-contained high-level language statements that performs a particular task and then returns to the caller - Local scoped variables - EXPORT keyword must be specified in P Spec (Begin of Procedure) when used from outside Module
-
A module object is a non-runnable object (*MODULE) that is the output of an ILE compiler is the basic building block for creating runnable ILE objects (*PGM, *SRVPGM) A module object can consist of one or more procedures Export is the name of a procedure or data item coded in a module object that is available for use by other ILE objects Can have Multiple Entry Points (Program Entry Procedure, User Entry Procedure)
Program
-
ILE Program (*PGM) is created from one or more copied module objects. Program gets control through a dynamic program call There is only one entry point to the program When new procedure added to module, recompile the module object and update the program. No need to re-create the program When new modules are added to the program UPDPGM can’t be used. Need to re-create using CRTPGM
Service Program
-
A service program is a collection of runnable procedures easily and directly accessible by other ILE programs or SRVPGMs An example of a set of service programs provided by OS/400 is the run-time procedures (MATH functions) for a language It is possible to update a SRVPGM without having to re-create the other ILE PGMs or SRVPGMs that use the updated SRVPGM The service program doesn’t have a PEP. Therefore, unlike a *PGM object, a SRVPGM cannot be called dynamically The SRVPGM Modules should be with H Spec NoMain UPDSRVPGM can be used when changes are made inside existing procedures. No need to UPDPGM in this case When new procedures are added, CRTSRVPGM needs to be used. As Signature changes the PGM needs to be updated using UPDPGM
Binder Language
- The binder language allows you to define the list of procedure names and data item names that can be exported for SRVPGM - To make compatible changes to a SRVPGM, new procedure names should be added to the end of the export list
- Binder Language Commands STRPGMEXP - identifies the beginning of a list of exports from a service program - identifies a symbol name available to be exported from a service program EXPORT ENDPGMEXP - identifies the end of a list of exports from a service program Eg:
-
STRPGMEXP PGMLVL(*CURRENT) LVLCHK(*YES) SIGNATURE(‘S1’) EXPORT SYMBOL(p1) EXPORT SYMBOL(p2) ENDPGMEXP
STRPGMEXP PGMLVL(*PRV) SIGNATURE(‘S1’) // Don’t give Quotes ‘ like SYMBOL(‘p1’) EXPORT SYMBOL(p1) ENDPGMEXP Signature is a value that identifies the interface supported by a service program Signature is optional, if not explicitly specified, the binder generates a signature LVLCHK parameter specifies whether the binder should automatically check the public interface to a service program Give binder source member details in CRTSRVPGM EXPORT(*SRCFILE) SRCFILE(LIB/SRCPF) SRCMBR(BNDMBR). Source Type = BND
Binding
- A method of combining two or more iSeries objects into a single program or service program - It helps reduce the overhead associated with calling programs. Binding Modules – Speeds up calls 1. Dynamic – Using CALL operation dynamically binds those programs, neither program knows about the other till CALLED 2. Static a. Bind by Copy – Accomplished by copying two or more modules into a program - Modules are copied into the PGM object during program create time b. Bind by Reference (Service Program) - During program creation time, Service Program is checked for existence and procedure names - During first call to a procedure in a SRVPGM at runtime, all Procedures are initialized and SRVPGM is loaded Binding Directory
-
A binding directory contains the names of modules and SRVPGMs that you may need when creating an ILE PGM or SRVPGM Modules or SRVPGMs listed in binding directory are used only if they provide an export In CRTPGM and CRTSRVPGM, if the number of modules to bind exceeds the limit, Binding Directory can be used CRTBNDDIR, ADDBNDDIRE, DSPBNDDIR, WRKBNDDIR, WRKBINDIRE, RMVBNDDIRE, DLTBNDDIR
Omitting Parameters
- When calling a procedure, we can leave out a parameter – Use %Addr to check if the parameter has been passed OPTIONS(*OMIT) and pass *OMIT OPTIONS(*NOPASS) and do not pass the parameter – Use %Parms (or *Parms of SDS) to find the number of variables - Eg: proc1(parm1:parm2:parm3) proc1(parm1:*omit:parm3) proc1(parm1) - If main procedure is not active, *PARMS is unreliable. It is not recommended to reference *PARMS from a sub-procedure
24. Subsystem, JOBQ, MSQ, OUTQ Subsystem - is a single, predefined operating environment through which the system coordinates the work flow and resource use - System can contain several subsystems, all operating independently of each other - The run-time characteristics of a subsystem are defined in an object called a subsystem description (*SBSD) - CRTSBSD, CRTJOBD, ADDAJE, ADDJOBQE, ADDWSE, STRSBS, ENDSBS Job Queue
-
A job queue is an ordered list of jobs waiting to be processed by a particular subsystem A job queue can be associated with several subsystems but it can only be allocated to one subsystem at a time The maximum number of jobs from a queue is specified by the MAXACT parameter on the ADDJOBQE or CHGJOBQE commands Jobs will not be selected from a job queue by a subsystem unless the subsystem is active and the job queue is not held CRTJOBQ, ADDJOBQE, CHGJOBQE, WRKJOBQ (F21 to see the linked subsystem) , HLDJOBQ, RLSJOBQ,
Message Queue
-
A message queue is like a mail box for messages. It is a place where messages accumulated in the sent order User Message Queue, Workstation Message Queue, System Operator Message Queue (QSYSOPR), History Log (QHST), Printer Queue The system automatically creates a temporary message queue for each job when the job starts The Messages/Entries don’t get automatically removed; they remain in the message queue as old messages Message Types – Request, Inquiry, Reply, Completion, Diagnostic, Escape, Notify, Info, Status Message Severity 00=Info, 10=Warning, 20=Error, 30=Severe Error, 40=Abnormal End or PGM, 50=Abnormal End of Job, 90= CRTMSGQ, RCVMSG
Output Queue
-
Output queues are objects, defined to the system, that provide a place for spooled files to wait until they are printed When a printer is configured the system creates an output queue for that printer in the QUSRSYS library A writer is an OS/400 program that takes spooled files from an output queue and produces them on an output device CRTOUTQ, HLDOUTQ, RLSOUTQ, WRKOUTQ
25. Sending Messages – SNDMSG -
in AS/400 used by a display station user to send an immediate MSG from his display station to one or more MSGQs MSG can be sent to SYSOPR, other display station users, user's MSGQ, all currently active users' MSGQs the sender can require a reply from the message receiver MSGID, MSGF are NOT ALLOWED. Only hardcoded text is allowed. MSG types *INFO and *INQ
SNDBRKMSG
- used to send an immediate MSG to one or more work station MSGQs in break mode - can be sent only to WRKSTN MSGQ (not to user id) - MSGID, MSG are NOT ALLOWED. Only hardcoded text is allowed. MSG types *INFO and *INQ
SNDPGMMSG
-
sends a message to a call MSGQ can be the A program can send a Usage of MSGID, MSGF Message Types *INFO,
SNDUSRMSG
-
used by a program to send a message to a MSGQ and optionally receive a reply to that message. (ONLY CL PGM) can be sent to a display station user in an interactive job or a specific message queue for *INQ MSG, a CL variable can be specified to receive the reply value, and the PGM will wait for a reply SNDUSRMSG = SNDPGMMSG + RCVMSG
SNDNETMSG
- sends a message to another user on the local or a remote system through the SNADS network - sends an informational message to the users and distribution lists you specify
named message queue or to a call MSGQ (This command ALLOWED ONLY from CL Programs) *EXT external MSGQ or a MSGQ associated with a call stack entry message to its own MSGQ or to a MSGQ that is associated with a different call stack entry *INQ, *RQS, *COMP, *DIAG, *NOTIFY, *ESCAPE, *STATUS
26. Edit Code, Edit Word, Edit Mask Used to format/edit the output-capable numeric fields for user display You cannot specify both EDTCDE and EDTWRD for the same field Edit Code is used to Suppress Leading Zero, Include comma, Minus sign or CR to the right, Display Zero or Blanks, etc Edit Word is used to clarifies the data by inserting characters directly, such as decimal points, commas, Currency symbol Edit Mask is used to protect the user-specified areas of the field WRKEDTD, CRTEDTD, DSPEDTD, DLTEDTD for user defined edit descriptions / / '), EDTMSK(' & & '), %EditC and %EditW inside RPGLE E.g. EDTCDE(J), EDTWRD(' 27. iSeries Navigator Powerful graphical user interface for managing and administering the server from Windows desktop. Manage multiple systems simultaneously (Add connection to various iSeries servers) Manage your hardware (configure, protect, manage all of your disk units & disk pools, work with mirroring) Secure your network (configure basic system security policy to secure end-to-end VPN connections, filter rules, SSL, etc) Work with database records (create/maintain database objects, insert/change data, monitoring and analyzing query performance) Manage your system workload Work with messages, Spool files, Active Jobs, Run SQL Queries, Run SQL Procedures, etc 28. MQSeries a communication system, provides assured asynchronous, once-only delivery of data across various hardware & software platforms ideal infrastructure for application-to-application communication (run on same/different machines/networks) supports all the important communication protocols and even provides routes between networks that use different protocols - is a string of bytes that has meaning to the applications that use it. Messages - are used for transferring data from one application to another - MQSeries messages have two parts; the application data and a message descriptor - MSG descriptor identifies the MSG & contains other control information (type of MSG, Priority) - A queue is a data structure in which messages are stored Queues - Messages may be put/get, the queue by applications or by a queue manager as part of its normal operation - Queues can exist either in your local system (local queues), or at another queue manager (remote queues) - Queue attribute determine what happens when applications reference the queue - Queue Attributes - Get Enabled, Put Enabled, Max no of messages, Max size of message, Exclusive/Shared Queue Queue Managers - A queue manager provides queuing services to applications, and manages the queues that belong to it - It ensures Messages are put on the correct queue, as requested by the application. The application is informed if this cannot be done, and an appropriate reason code is given - Each queue belongs to a single queue manager and is said to be a local queue to that queue manager MQSeries applications can be developed using a variety of programming languages and styles (C, C++, Java, Cobol, VB) WRKMQM - Display all queue managers defined to the system and to allow you maintain existing queue managers or add new ones Programming Commands – MQCONN, MQOPEN, MQGET, MQPUT, MQCLOSE, MQDISC
29. Limitations Max of Max of Max of Max of Max of Max of Max of Max of Max of Max of Max of Max of
of AS400/RPGLE/CLLE/CL,etc 5 files in CL and CLLE (DCLF + OPNID commands) 50 files in RPGLE which includes (PF, LF, DSPF, PRTF..) 32 files in Join Logical File (LF), during Join in OPNQRYF, Multiple Format Logical file 2000 chars for a normal Data Area, 1024 chars for *LDA and 512 chars for *GDA 9999 records for SFLSIZ 255 parameters for RPGLE program, 399 parameters for RPGLE procedure, 255 parameters for CLLE and CL 1 primary file in RPGLE, 8 printer files in RPGLE 12 subfiles can be active concurrently and 24 subfiles can be defined in RPGLE program 1024 records formats, 512 subfiles in a Display file 255 lines and Min of 2 lines in a page when printing 99999 record length for a file 300 triggers can be added to a physical file