You are on page 1of 34



If SQLCODE = 0 and SQLWARN0 is blank, execution was successful. If SQLCODE = 100, no data was found. For example, a FETCH statement returned no data, because the cursor was positioned after the last row of the result tab le. If SQLCODE > 0 and not = 100, execution was successful with a warning. If SQLCODE = 0 and SQLWARN0 = 'W', execution was successful with a warning. If SQLCODE < 0, execution was not successful. Level Check Error - CPF4131 / CHGPF FILE() LVLCHK(*NO) / The RPG compiler always provides the information required by level checking when an externally describe d DISK, WORKSTN, or PRINTER file is used. The level-check function can be reques ted on the create, change, and override file commands. The default on the create file command is to request level checking. Level checking occurs on a record-fo rmat basis when the file is opened unless you specify LVLCHK(*NO) when you issue a file override command or create a file. If the level-check values do not matc h, the program is notified of the error. If you have ever modified a physical fi le (e.g., added a new field or changed the length of an existing field) and you didn't recompile the programs that use that file, you probably found out the har d way about file level-checking. If level-checking is active for that file (whic h is the default), any program that has not be recompiled will receive an escape message when called. The process of level-checking for a file is to ensure that programs using that file always use the current definition of the file, hence e nsuring data integrity. Record format level identifier You can use the Display Program References command (DSPPGMREF) to view the *FILE , *PGM, *DTAARA, *SRVPGM used by a program and the associated level-identifiers / You can use Generic names EOF error - CPF0864 End of records in SQL = SQLCODE 100 Record Lock - Use chain(e) and check for status 1218. Command line - CALL PGM(QCMDEXC) PARM('QSYS/CRTLIB LIB(TEST)' 22) - Length must be a packed decimal value of length 15 with 5 decimal positions. C/Exec SQL - C/End-Exec CPF9999 will also catch other messages that are not prefixed with CPF. MCH messa ges might occur and CPF9999 will catch those whereas CPF0000 will not. Message subfile format R MSGSFL MSGKEY PGMQ R MSGCTL SFL SFLMSGRCD(24) SFLMSGKEY SFLPGMQ(10) SFLCTL(MSGSFL) OVERLAY SFLDSP SFLDSPCTL SFLINZ SFLEND SFLSIZ(0002) SFLPAG(0001) SFLPGMQ(10)


SFLINZ is used to initialize the subfile for use across the screen display in AS 400 and can also be used to change the subfile settings just before display SFLPAG keyword is used for subfile page size SFLDSP keyword is used for subfile display SFLDSPCTL keyword is used for subfile display controls Create Table EMPPHOT ( empno decimal(5, 0) , photo blob(4M) allocate(0), primary key (empno) ); ----------------HI - LO - EQ NR - ER - EOF/EQ +ve - -ve - ZERO OFF ON EQUAL ----------------Field length Range of Allowed Values 3-digit integer -128 to 127 5-digit integer -32768 to 32767 10-digit integer -2147483648 to 2147483647 20-digit integer -9223372036854775808 to 9223372036854775807 Packed fields can be up to 32 bytes long. Table 26 shows the packed equivalents for zoned-decimal fields up to 63 digits long: V5R3-63 digit/decimalpos packed/zoned -----------X - F/D Leading Zeroes Y - Date / Z - removes the sign (plus or minus) from a numeric field and suppresses leading zeros. editc and editw There are times when programmers need to convert numbers to characters. I use %EditC built in function using edit code 'X'. Example: 1. Time 34233 (say 3.42.33 am); TextFd = %EditC(Time:'X') Returns '034233' when TextFd is 6A. test field is 6 alpha 2. Number 123; TextFd = %EditC(Number:'X') Returns '000123' If you have editing requirements that cannot be met by using the edit codes desc ribed above, you can use an edit word. An edit word is a character literal or a named constant specified in positions 53 - 80 of the output specification. It de scribes the editing pattern for an numeric and allows you to directly specify: v Blank spaces v Commas and decimal points, and their position v Suppression of u nwanted zeros v Leading asterisks v The currency symbol, and its position v Addi tion of constant characters v Output of the negative sign, or CR, as a negative indicator. Edit Word Source Data Appears in Edited Result as: '' 000000001 bbbbbbb.01 '' 000000000 bbbbbbb.00 'bbb,' 00000012 bbbbbb0.12 'bbb,' 00000123 bbbbbb1.23 'b0b,' 00000123 bb0,001.23

-----------Main procedure HFDICOP / HFELICO Sub procedure PDCP procedures Pgm data / Compile time data CTDATA -----------There are four keywords required in the subfile control record format: The subfile control (SFLCTL) keyword identifies the subfile control record forma t--again, like the record (RECORD) keyword does for a typical display record for mat. The SFLCTL keyword also identifies the subfile record format that must imme diately precede it. The subfile size (SFLSIZ) keyword specifies the number of records that the subfi le may contain. The subfile page (SFLPAG) keyword specifies the number of records that one scree n of data may contain. The subfile display (SFLDSP) keyword specifies under which condition the subfile may be displayed. SFLSIZ 9999 Load-All & Expanding (ROLLUP) - Same 9999 Page-at-a-time ROLLUP / ROLLDOWN ----------------Create Procedure MyProcY ( InOut Parm1 Int ) Language RPGLE Parameter Style SQL Modifies SQL Data External Name MyPgmY Parameter declarations in MyPgmY: ....1....+....2....+....3....+....4....+....5....+....6....+ * Parameters * - - - - - - - - - - - - - - - - - - - - - - - - - - - - D Parm1 S 10I 0 D Parm1NullInd S 4B 0 D ParmSqlState S 5A D ParmProcName S 517A Varying D ParmSpecName S 128A Varying D ParmMsgText S 70A Varying . . . * Entry point * - - - - - - - - - - - - - - - - - - - - - - - - - - - - C *Entry Plist C Parm Parm1 C Parm Parm1NullInd C Parm ParmSqlState C Parm ParmProcName C Parm ParmSpecName C Parm ParmMsgText

..C *Entry Plist C Parm Parm1 C Parm Parm2 C Parm RtnMsgId --------------------------DSPLY has a lousy 52-byte max CVTDAT DATE(&WORKDATE) TOVAR(&OUTDATE10) FROMFMT(&XFORMAT) TOFMT(*ISO) TOSEP(*NO NE) TEST(DTZ) TESTN for testing (NUMBER BLANKS+NUMBER ALLBLANKS) There is a special binding directory on your AS/400 named QC2LE...6................ It contains a l ist of modules and service programs needed for the C language runtime environmen t. ..2...+....4....3........ BNDDIR('QC2LE') DFTACTGRP(*NO) EVAL RESULT = (2 + 3 * 2) ** 2 / 2 = (2+6)**2 / 2 = 8**2 / 2 = 64 / 2 ans .Create Procedure MyProcX ( In Parm1 Int.....+........ * Entry point * .......+.. InOut Parm2 Char( 10 ).32 **CTDATA UDPATES2 **CTDATA UDPATES1 CTDATA complie time data for arrays pre-runtime / compile time / runtime arrays Creating a CL program to start FTP OVRDBF FILE(INPUT) TOFILE(GERRYLIB/QCLSRC) MBR(FTPCMDS) OVRDBF FILE(OUTPUT) TOFILE(GERRYLIB/QCLSRC) MBR(FTPLOG) FTP RMTSYS(LOOPBACK) DLTOVR FILE(INPUT OUTPUT) a) The Local Data Area is associated with the current job only (it s a charac ter data area of 1024 bytes length)...D Parm1 S 10I 0 D Parm2 S 10A D RtnMsgId S 7A ..5......+.+ * Parameters * . Out RtmMsgId Char( 7 ) ) Language RPGLE Parameter Style General Reads SQL Data External Name MyPgmX Parameter declarations in MyPgmX: ............ b) The Program Initialized Parameter Data Area is associated with a pre-sta rt job (max... length 2000 bytes) ......... .1.........+.

d) General Data Area created by the users (can be of type character. /FREE etc begin at position 7 The /COPY and /INCLUDE directives have the same purpose and the same syntax. CPYF The OS/400 command called CPYTOIMPF can be used to create a stream file in CSV f ormat without us having to write any code to do it. you must specify a way for the program to end: 1.and record-level. DSPSIZ (27 132 *DS4 24 80 *DS3) . file processing in RPG/400 .keyed There cannot be more than one H spec. If your program does not contain a primary file. The ASP is like C drive D drive etc on Personal Computers except that the ASPs on AS /400 are numbered. but are handled differently by the SQL precompiler. or file-level keyword to define the leading attribute of the field that changes to a specified attribute whenever the cursor is locate d in the field.c) The Group Data Area is associated with the group job (character data are a with 512 bytes length). where is the information available to determine which member of a multiple-member physical file is currently being processed? in the file inf ormation data structure The logical partition on AS/400 is called as Auxiliary Storage Pool (ASP).consecutive.By setting the LR indicator on 2. When defined at both the field.rrn.sequential by key. ENTFLDATR Use this field-.By setting an H1 through H9 indicator on 4.By setting the RT indicator on 3.By specifying the RETURN operation code CNTFLD(width of column) Use this field-level keyword to define a field as a continued entry field. 2000 SELECT COUNT(DISTINCT WORKDEPT) SQL . record-. Conti nued-entry fields are sets of associated entry fields that are treated by the wo rk station controller as a single field during field-data entry and editing. There is no *INZSR associated with subprocedures. The format of the keyword is: ENTFLDATR[([color] [display attribute] [cursor visible])] CRTDUPOBJ vs. in an RPG/400 program. Within ASP are what are called as Libraries. decima l or logical). The ENTFLDATR keyword is ignored when the workstation is not attached to a controller that supports an enhanced data stre am. the field-leve l specification is used for the field.CURRENT_DATE Passing a pointer by value is the same thing as passing a variable by reference user: owner group other access: R W X R W X R W X bit: 9 8 7 6 5 4 3 2 1 In an RPG program.

wh ereas. 1P.KP-KY LR. L1 through L7 are also set on.not even displayable (default value used if () is used) Parameters not specified are available either immediately or by pressing F10. *TCAT < *BCAT > ----An indicator is a one byte character field All indicators except MR.runtime arrays The major difference between an Array and a Table is that an array can be proces sed by the index and its individual elements can be accessed using the index. and KP through KY can be set on wit h the SETON operation code. in case of a table it is not possible. 1stPage-1P Overflow-OA-OG.can be searched sequentially only. The LR (last record) indicator is set on when th e input files are at end of file. ----------TABLES vs ARRAYS table . LR is considered the highest level indicator a nd forces L1 through L9 to be set on. array . if L8 is set on by a control break.OV 01-99 Halt-H1-H9 Control-L1-L9 External-U1-U8 Match-M1-M9 FuncKeys-KA-KN. all indicators except MR and 1P can be set off with the SETOFF operation code.txt')" (not really but why add request message processing to the muddle?) QCMD parses out the string that it received and realises that it has to .the prompt options are: ?? displayed and changeable ?* displayed but not changeable ?.RT. ---------D P D D D c c P @__errno PR * ExtProc('__errno') errno B errno PI 10I 0 p_errno S * retval S 10I 0 based(p_errno) eval p_errno = @__errno return retval E --------------CL does not support zoned decimal numbers. compile/preruntime. parameters are passed by reference So instead of "call step3cl <address of &FILENAME>" you get "CALL QCMD PARM(call step3cl 'test.can be searched randomly compile/preruntime tables. For example. KA through KN.MR All lower level indicators are set on when a higher level indicator is set on as the result of a control break. the LOKUP operation has to be perf ormed and the elements can be accessed only sequentially.

. pointer. left-justified. Your program will use P-field @CUST# to control the display of I/O field C UST# on the panel. ---------The RESET operation is used to restore a variable to the value held at the end o f the *INIT phase. W hen STEP3CL gets called as a result of processing CVTTOPDF.rename() Positioning to a given point in the file .txt') When QCMD does his thing. Data Types and Data Formats. The CLEAR operation sets elements in a structure (record format. Next. the reset value is the same as the initial value (either the value sp ecified by the INZ{(initial value)} on page 311. ------------IFS Checking existence and permissions to files . or the default value). h e sees that he needs to run a command (not CALL) so the command processor checks the command definition for each parameter. on page 169. data structure. or date/time/timestamp). or table) or a variable (field. the AID byte will contain a hexadec imal number corresponding to a function or editing key (such as Enter or Print). First. How do you position the cursor over a field in error without resorting to indica tors? There is a keyword in DDS called CRSLOC (see Figure 4). indicator. when used by the keyword DSPATR. This keyword has t wo 3-byte fields.create some storage for the parameter 'test. character . If there i s a *INZSR subroutine.lseek() -----------DSPF The P-field @CUST# is declared as a one-byte field with a P in position 38. graphic. and it needs to be inside the record I am displaying. must be preceded by an ampersand (&) for your DSPF to com pile. subfield.unlink() Renaming IFS objects .chmod() Retrieving Stream File Stats . UCS-2. t o their default initialization value depending on field type (numeric. there is a byte in the INFDS at position 369 called AID. initialises it to blanks and loads th e constant into it. or Attenti on Indicator. QCMD creates a 32 byte storage area. you should have all of the function key keywords (such as CF01 and CF02) coded in the file or record section of the DDS for this method to work (see Figu re 4). This value is called the reset value. After the panel has been read. the reset value is the value the variable holds when the *INZSR subroutine has completed. array. The RESET operation can also be used to restore all the fields in a record format to their reset values. see Chapter 10. his definition of 50 bytes exactly matches the caller's definition of 50 bytes and All Is Well. QCMD then does a "call STEP3CL <address of i nternal storage area>" The SBMJOB results in "cvttopdf filename('test. initialises the defined amount of st orage (here it's 50 bytes) loads the internal storage areas up and away we go.stat() Deleting IFS objects (links) .txt' Because it is a character cons tant.access() / CHKOBJ Changing permissions on an existing IFS Object . For the default i nitialization value for a data type. The P-field @CUST#. which are both zoned-decimal hidden fields that control the ro w and column positioning of the cursor. If there is no *INZSR s ubroutine. array element or indicator).

PGMA and PGMB. Unicode is a code page that has several encoding forms. PGMA calls PGMB. proper variable initialization is import ant. Your program variables are left in the state they were in the last time you c alled the program. If you are using an *INZSR to initialize your program variables. For example. depending on the size of the table and how many rows are being retrieved.HTTP ASCII 37 . The DB2 SQL engine is solely responsible for creating and reusing ODP's for I/O performed from SQL-based interfaces (and does so auto matically). 2.iSeries IFS ASCII 367 . or OVRDBF commands. ------------CCSID CCSID is an abbreviation used by IBM to mean "Coded Character Set Identifier". reduce the amount of main storage needed by the job. that is only executed the first time the program is called and not on subsequent calls to th e program. file pointer posi tions. a progra m would be forced to read every row in the table to find the particular rows of interest. you'll probably want to make a separate subroutin e to initialize your variables and control the execution in your program. PGMB returns to PGMA. If that's the case. an d then PGMB is removed from the call stack since it has returned instead of SETO N LR. and storage area. and reduces file opens/clo ses. For native I/O access you can set up ODP's by specifying SHARE(*YES) on the CRTP F. Here are a couple of things to watch out for when using RETURN instead of LR: 1. This technique (known as a full table scan). SQL based I/O access is not influenced by the SHARE (*YES) setting. UTF-16 and UTF-32.North American EBCDIC EBCDIC . However. Without an access path. I t is a 16-bit number that represents a specific encoding of a specific code page . some of the resources associated t o that job stay allocated even though the program no longer exists in the call s tack. like UTF8.------Difference between ODP and Access path? Open Data Paths (ODPs) provide a way for more than one program in the same job t o share the same file status information (I/O feedback areas). A sca n using an access path tends to be more efficient than a full table scan when a small percentage of rows are selected since the length of the access path key va lue is usually shorter than the length of the table row. ---------------What does Seton LR do? If I have two programs.This the the original form of the data on the iSeries. ------ . If you use a RETURN. can be a lengthy process. CHGPF. If you are calling a program repeatedly. How will the file used remain opened when the program is not in the call s tack still? You are correct in that when you do a return. It provides a quick way of locating data. using a RETURN instead of a SETON LR has big performance advantages because the files are already open and ready to use when you call the program repeatedly from the same job. ODP's are quite useful as they can improve performance. An access path (also known as a keyed logical file or an index in SQL terms) is data structure that represents the order in which data will be retrieved from a file. 819 .

) It has three options: PGM LVL. These can be either OPM programs or ILE programs compil ed with the option DFTACTGRP(*YES). The *PRV allows you to maintain multiple export lists (more on this later). The optional special value *ELIGIBLE can be specified to reclaim all e ligible activation groups (that is. This backward compatibility is. The cool thing is that. The default is *YES. No means your service program will have a signature value of 0.RCLRSC LVL(*/*CALLER) OPTION(*NORMAL/*ABNORMAL) the Reclaim Resources (RCLRSC) command can be used for programs running in the d efault activation group. There . and I r ecommend you leave it as such. which is the default. but programs created with a *PRV signature can still run without modification. The OPTION parameter on this command not only handles sending an abnormal clos e notification to open communication files. -------STRPGMEXP PGMLVL(*CURRENT) EXPORT SYMBOL(PROC1) EXPORT SYMBOL(PROC2) EXPORT SYMBOL(PROC3) ENDPGMEXP As I mentioned. The logic th e compiler supplies is called the program cycle or logic cycle. RCLACTGRP ACTGRP(*ELIGIBLE/Act Grp Name) OPTION(*NORMAL/*ABNORMAL) The ACTGRP parameter is used to specify the name of the activation group to be r eclaimed. PGMLVL is required and has two possibilities. EXPORT. meaning that the *CURRENT signature will change. No cycle code is generated for a module when NOMAIN is specified on th e control specification. -----rpg cycle The ILE RPG compiler supplies part of the logic for an RPG program. Remember the funky 16-byte signatures I talked about earlier? Well. the list can grow. tells the service program to export this procedure. the binder source language has only three op codes: STRPGMEXP. LVLCHK has two options. and SIGNATURE. SIGNATURE. after all. so let's go over e ach one STRPGMEXP (or Start Program Export) signifies the beginning of an EXPORT list. and for the life of me I cannot conceive of a scenario whe n I would be even remotely interested in using *NO. The last option. you can have multi ple signatures per service program. As a result. The program cycl e is a series of ordered steps that the main procedure goes through for each rec ord read. *CURRENT and *PRV. in conjunction with *PRV mentioned above. and only one. ( You can have more than one. but also determines whether to commi t or roll back pending changes for an activation group level commitment definiti on. *CURRENT. The next code. activation groups that are no longer in use) . LVLCHK. and ENDPGMEXP. is really the heart of what makes binder source so c ool. The two parameters on the RCLRSC command are used to define the call level at which the cleanup should occur and to indicate whether an abnormal close notification should be sent to open communication fil es. which I'll discuss later. *GEN is what creates them. The default value is *GEN and will serve you just fine. and they are always used in that order. *YES and *NO. E XPORT. There must alwa ys be one. t he whole point of using binder source.


allowing you to make business logic changes in a singl e place that automatically affect all dependent applications 4. The invocation of a stored procedure is treated as a regular external call.Stored procedures are called independently.Non-keyed logical file Index . 3. if you have an inventory table that cashiers must update each time an item is sold (to decrement the inventory for that item by 1 unit).UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT sect ion where as Stored procedures cannot be.Record Schema . which usually runs on a separate database server. in response to a u ser request.Journal Isolation level . The application waits for the stored procedure to terminate. rather than permission to a ccess the underlying tables.Stored procedures improve performance by reducing network traffic and CPU load SP Vs UDF 1.Stored procedure allow you to enhance application security by granting users a nd applications permission to use stored procedures. Store d procedures may return a scalar value.iSeries term Table .Functions must always return a value (either a scalar value or a table).Reusing code from one program to another.Commitment control level STRPCO STRPCCMD PCCMD(NOTEPAD.EXE) ---SQL stored procedures External procedures SQL Triggers External triggers SQL UDFs External UDFs Sourced UDFs 1. rather than al lowing them to make arbitrary changes to the inventory table.SQL term .Hiding the SQL details. doing away with the overhead of communicating large amounts of data back and forth. cutting down on program development time 2. a table value or nothing at all. it is run directly by the database engine.Library. w hile functions are called from within another SQL statement 2. you can gr ant cashiers permission to use a decrement_item stored procedure.The advantage of a stored procedure is that when it is run. Stored procedures provide the ability to restrict u ser actions at a much more granular level than standard SQL Server permissions.Keyed logical file Column . For example. it has direct access to the data it needs to manipulate and only needs to send its results back to the user. The CREATE PROCEDURE statement differs from the DECLARE PROCEDURE since it adds procedure and parameter definitions to the system catalog tables (SYSROUTINES an . and parameters can be p assed back and forth.Centralize maintenance. using the SQL CALL/EXEC command. As such. allowing database developers to worry about SQL and ap plication developers to deal only in higher-level languages 3. Stored procedures can be called locally (on the same syste m where the application runs) and remotely on a different system.Physical file View .Field Row . Collection. 5. Schema Log . 4.

You can specify the required parameter style when the procedure is created. For Creation/Deletion/Testing of Stored Procedures. Therefore.sysroutines " In *SYS. these two procedures cannot exist in the same library: MyStorProc( char(5)) MyStorProc( int) Important: The stored procedure signature differs from the UDF signature. "select * from qsys2.d SYSPARMS). Th e signature of a procedure can be defined as a combination of the qualified name and the number of parameters in the procedure. To drop the second procedure. or collection. This means that you can have two or more procedures with the same name in the same library. SYSFUNCS view. "select * from qsys2/sysroutines" if you want to re-create or delete an existing procedure. and types of parameters. you need to use one of the methods listed here: Specify the specific procedure name: drop specific procedure spintchar. number. use the DROP PROCEDURE statement. the SYSPROCS view. This section shows you how to view the stored procedure information using the SY SROUTINES PF catalog. For example. The following t wo UDFs can coexist in the same library: myUDF( char(5) ) myUDF ( int ) In *SQL naming convention. The number and type of additional parameters passed depends on the parameter style. The UD F signature consists of a name. char ). int) MyStorProc( int) However. Include the parameter types on the DROP PROCEDURE statement: drop procedure myStorproc( int. th e following two stored procedures can coexist in the same library: MyStorProc( char(5). DB2 UDB for iSeries supports four parameter styles: SQL parameter style DB2SQL parameter style GENERAL WITH NULLS parameter style GENERAL parameter style The DB2 UDB for iSeries stored procedures support the following SQL statements f or the transaction management: COMMIT SAVEPOINT ROLLBACK and ROLLBACK TO SAVEPOINT . No two procedures in the library can have the same signature. no two procedures with the same name an d the same number of parameters can coexist in the same library. DB2 Universal Database for iSeries supports the concept of procedure overloading . and the SYSPARMS view. schema. provided they have different signatures. Use the DROP PROCEDURE statement to delete the stored procedure catalog informat ion entry. use iSeries Navigator "Run a SQL Script" option DB2 UDB for iSeries passes a number of parameters to the procedure in addition to those specified on the parameter list .

S/36 S/38 AS/400 Programming Development Manager PDM AS/400's S/36 environment When a S/38 object is restored onto the AS/400. (6) The fields of the selected input records are moved from the record to a proc essing area. RPG38.RELEASE SAVEPOINT SET TRANSACTION ------AS/400 Starter Kit notes ---------------------------------------------Figure 5. (5) It is determined if the LR indicator is on. They are conditioned by an L1 through L9 o r LR indicator. the system attaches the suffix " 38" to the object attribute (CLP38. (2) The next input record is read and the record identifying and control level i ndicators are set on. PF38) *ALLOBJ special authority special QSECOFR profile The AS/400 provides five levels of security: 10(0-security). 30(user+pwd-allobj). and 50(+DOD C2 security) CHGSYSVAL SYSVAL(QSECURITY) VALUE(XX) IPL the system = PWRDWNSYS OPTION(*IMMED) RESTART(*YES) CHGSYSVAL SYSVAL(QPWDMINLEN) VALUE(7) CHGSYSVAL SYSVAL(QPWDMAXLEN) VALUE(10) CHGSYSVAL SYSVAL(QPWDRQDDGT) VALUE('1') CHGSYSVAL SYSVAL(QPWDLMTREP) VALUE('1') CHGSYSVAL SYSVAL(QPWDLMTAJC) VALUE('1') CHGSYSVAL SYSVAL(QPWDEXPITV) VALUE(60) WRKSYSVAL . or an L0 entry. RPG IV Program Logic Cycle (1) All heading and detail lines (H or D in position 17 of the output specificat ions) are processed. the program is ende d. (7) All detail calculations are processed (those not conditioned by control leve l indicators in positions 7 and 8 of the calculation specifications) on the data from the record read at the beginning of the cycle. 40(-MI+OpSysIntg). If it is on. (4) All total output lines are processed. (3) Total calculations are processed. Field indicators are set on. 20(user+pwd+allobj) . (identified by a T in position 17 of t he output specifications).

job control. hold. save system. save system. and subsystem QSPL. The user can also control spooled files in output queues where OPRCTL(*YES) is specified. or delete user pro files. restore.. QCMN. and job control authorities. subsystem QBASE. and DLTUSRPRF (Delete User Profile) = QSECOFR or *SECADM (security administrator) DspLibD QSys System Service Tools to trace communication lines and data QINTER. QSPL is the spooling subsystem that provides the operating environment (mem ory and processing priorities and parameters) for programs that read jobs onto j ob queues to wait for processing and write files from an output queue to an outp ut device. modify. you cannot sign on as that user profil e. SERVICE (service authority) means users can perform functions from the System Se rvice Tools. assign each user to one of the following classes SECOFR (security officer) grants the user all authorities: all object. SPLCTL (spool control authority) allows users to delete. however. This authorit y alone. and communications j obs. SAVSYS (save system authority) lets users save. USER (user) grants no special authorities. a group of executable programs used for various service functions ( e. security administrator. spool control.Some user profiles do not have passwords. display. Subsystem QBASE i s a memory pool used to execute all the interactive. and rele ase their own spooled files and spooled files owned by other users.g. some have same passwords as name QSECOFR (security officer) QPGMR (programmer) QUSER (user) QSYSOPR (system operator) QSRVBAS (basic service representative) QSRV (service representative) CHGUSRPRF USRPRF(profile_name) PASSWORD(password) PWDEXP(*YES) RTVUSRPRF GO SETUP. QBATCH. . PGMR (programmer) grants save system and job control authorities. and QSPL Memory is divided into the machine pool. SYSOPR (system operator) grants save system and job control authorities. line traces and run diagnostics). Th e system uses the machine pool to interface with the hardware. CHGUSRPRF (Change User Profile). option 11 CHGSYSVAL SYSVAL(QAUTOCFG) VALUE('0') WRKSYSSTS CHGSYSVAL SYSVAL(QCTLSBSD) VALUE('QCTL QGPL') CRTSBSD RTVCLSRC PGM(QSYS/QSTRUP) SRCFIL(QGPL/QCLSRC) CRTUSRPRF (Create User Profile). The AS/400 provides six special authorities: ALLOBJ (all object authority) lets users access any system object. c ancel. hold. JOBCTL (job control authority) allows users to change. does not allow the users to create. and clear all jobs on the system. AUDIT (audit authority) allows users to start and stop security auditing as well as control security auditing characteristics. release. service. and free storage for al l objects. SECADM (security administrator authority) allows users to create and change user profiles. and audit autho rities (each of these special authorities is explained below). display. SECADM (security administrator) grants security administrator. batch.

CHGPRTF FILE(library_name/file_n ame) PAGESIZE(51 132) OVRFLW(45) DSPFD QSYSPRT DSPJOB (Display Job) or the DSPJOBLOG (Display Job Log) . break handling programs. CHGMSGD. RMVRPYLE (Remove Reply List Entry) DSPMSGD (Display Message Descriptions) The system reply list handles only inquiry messages. CHGSPLFA. SNDBRKMSG (Send Break Message ). or SNDNETMSG (Send Network Message) *INFO or *INQ (with reply) WRKDIR (Work with Directory). SAVLIB LIB(*IBM) WRKCMTDFN JOB(*ALL) STATUS(*RESYNC) WRKHLDOPTF (Work with Held Optical Files) WRKACTJOB PTF. while a break handler can p rocess any type of message. CHGJOBD (Change Job Description) WRKRPYLE (Work with Reply List Entries). ADDRPYLE (Add Reply List Entry). RCLSTG. CHGRPY LE (Change Reply List Entry). SNDPTFORD (Send PTF Order). GO DISKTASKS DLTPTF RCLSPLSTG reclaim spool storage.auxiliary storage pool (ASP) = group of disk units A save file is a special type of physical file to which you can target your back up operation disk-mirroring. SBMJOB (Submit Job). CRTJOBD (Create Jo b Description). DSPPTF (Display Program Temporary Fix). CHGJOB (Change Job). CLRMSGQ. DSPMSGD. WRKMSGD print files = QSYSPRT QSUPPRT QQRYPRT CRTPRTF (Create Print File). WRKSYSSTS (Work with System Status) GO SAVE. SNDMSG (Send Message). direct address storag e drive DASD workstations and printers cumulative Program Temporary Fix (PTF) release STRS36E or CALL QCL command to enter the S/36 or S/38 environment QUSRSYS QSYS QGPL QTEMP three categories of authority to an object Object authority Data authority Field authority V4R4M0 V6R0M0 DSPNETA CHGMSGQ QSYSOPR *BREAK SEV(95). CRTDSTL (Create Distribution List). or program temporary fix ANZPRB GO PTF. LODP TF DSPLOG LOG(QHST) PERIOD((start_time start_date)) Deleted records continue to occupy disk space until you execute a RGZPFM (Reorga nize Physical File Member) send user-to-user messages. RAID Redundant Array of Independent Disks. ADDDSTLE (Add Distribution List Entry) System Network Architecture Distribution Services (SNADS) be active message processing: the system reply list. SAVSYS. and default replies BCHJOB (Batch Job). CLRSAVF GO LICPGM. such as a completion message or an informational mes sage CHGMSGQ MSGQ(library/msgq_name) DLVRY(*BREAK) PGM(program_name) SEV(severity_cod e) ADDMSGD (Add Message Description). OVRPRTF.

QSpCrtSp (Create Spooled Fi le). Save . c all level-1 2 3 4 TfrCtl (Transfer Control) Activation groups. diskette. GRTOBJAUT (Grant Object Authority). or field manipulation PF-DTA and PF-SRC. field-level DSPFFD ADDPFM OVRDBF PF.PF. WRKWTR (Work with Writer) . output queues contain spooled files WRKOUTQ QPRINT. are further division of jobs into smalle . backup media devices = save file. relative record number. CRTSRCPF. DSPPFM LF. one record format. Device . OS/400 will send an entry to the associated data queue. and job number = unique job CHGCMDDFT Change Command Default RRTJOB (Reroute Job) TFRJOB (Transfer Job) 5 file types and 10 sub-types : Database . Source . QSpGetSp (Get Spooled File Data). reco rd-level DSPF. QSpCloS p (Close Spooled File) An access path describes the order in which the records in a database file are p rocessed. job queue. user profile name. key fields. Recovery and Media Services BRMS DspRcyAP DspHdwRsc DspSbsD DspSfwRsc DspObjD WrkJrnA DspUsrPrf DspJobD CpySplF. tape. DDMF access remote files call stack = ordered list of active programs. D DM . QSpPutSp (Put Spooled File Data). TYPE(*FILE) and ATTR(PF).DSPOBJD OBJ(A) OBJTYPE(*ALL) DETAIL(*SERVICE) SavChgObj (Save Changed Objects) command to save only changed objects since a li brary or group of libraries was last saved or since a particular date and time SavSys SavDLO (Save Document Library Objects) Sav (Save) SavLib (Save Library) S avObj (Save Object) SavSecDta SavCfg PrtSysInf (Print System Information) Backup.msg severity 00 = info 99 = critical CRTOUTQ (Create Output Queue). reflects depth of program calls. field selection. select/omit logic. RVKOBJAUT (Revoke Object Authority) STRPRTWTR WRITER(writer_name) OUTQ(QPRINT) CRTOUTQ and CHGOUTQ commands let you associate a data queue with an output queue so that when a spooled file becomes ready on the output queue. QUSRSplA (Retrieve Spo oled File Attributes). TYPE(*FILE) and ATTR(LF). and optical routing entries / autostart job. WRKSPLF (Work with Spooled Files) status of spooled file = OPN CLO HLD RDY SAV WTR EDTOBJAUT (Edit Object Authority). workstation.DSPF PRTF TAPF DKTF ICFF. ADDJOBSCDE CHGJOBSCDE HLDJOBSCDE RLSJOBSCDE RMVJOBSCDE WRKJOBSCDE userspace QUSCRTUS QUSRTVUS DSPOBJD OBJ(QSYS/QHST*) OBJTYPE(*FILE) = list of files Display source . QUSLSpl (List Spooled Files).SAVF. spooled file APIs. QRCVDTAQ QSNDDTAQ CLRJOBQ WRKJOBQ only 1 *JOBSCD job schedule object. file-level DSPFD. CLROUTQ (Clear Output Queue) QEZJOBLOG QEZDEBUG. communications + presta rt main storage = machine pool (*MACHINE) and base pool (*BASE) controlling subsystem QCTL instead of QBASE STRSBS DSPSBSD CRTJOBQ ADDJOBQE ADDCMNE ADDPJE ADDAJE ADDRTGE job name.DDMF files described at 4 levels = object-level *FILE DSPOBJD.PF LF. QSpOpnSp (Open Spooled File). introduced with ILE.

O. . Manager Commands Change Message Queue Manager Connect Message Queue Manager Create Message Queue Manager CHGMQM CCTMQM CRTMQM . . . : : : : WebSphere MQ 6.r substructures Scoping an Override = Call level. is not controlled by the open options. . .(Production) WebSphere MQ Commands . all records in the physical file are indexed. The open options are *INP (input only). . Job level all jobs = 1 default activation group + optional named activation groups Original Program Model (OPM) programs can run only in the default activation gro up Within a single call level. VALUES. Blank position)= COMP. . . . If you specify SHARE(*YES) for a file . . . the options specified on the OPNDBF ( Open Data Base File) command or by the high-level language definition of the fil e determine the open options. . *OUT (outp ut only). only the most recent override is in effect Because the call level doesn't change. the overrides aren't combined Protecting an Override = Secure(*Yes) on the override command Call level: DltOvr File(File1) OvrScope(*). the first open establishes the open options Record locking. . . RANGE = must have Keys (or *NO NE) OR DYNSLT keyword ALL keyword with Select/Omit When you use DYNSLT. the initial program's open of the file must use all the open options required for any subsequent programs in the same job. Activation group level: DltOvr File( File2) OvrScope(*ActGrpDfn). and delete operations). . on the other hand. Job level: DltOvr File(File3) OvrScope(*Job) OvrMsgF logical file rcd fmt = pf rcd fmt (PFILE) OR new rcd fmt / key fields (K) / prim ary key(UNIQUE) Select/Omit (S. and *ALL (input. .0. . . update. 2. . when you specify SHARE(*YES). ALCOBJ = exclusive sharing of objects ODP = file status and file pointer SHARE(*YES) = When a program opens a file. output. .5 p600-205-080922 IKAP . Activation group level. . . . and the selec t/omit logic is not performed until the file is accessed. 3. Version . . These options are significant when you use shared ODPs. CMVC level BuildType ------CMDMQM Select one of the following: Queue 1. but by the RPG compiler CHGOBJOWN MONMSG -------------Sample pgm on PUB1 AS400 system MQ library is MQMQ Display MQ Version Name .2. .

Display WebSphere MQ Process 29. 22. Change WebSphere MQ Process 25. 11. 10. Display WebSphere MQ Namelist 35. 8. 9.4. Command Server Commands 12. 20. Start WebSphere MQ Command Server Queue 15.. Work with WebSphere MQ Processes Namelist Commands 30. Delete WebSphere MQ Process 28. Copy WebSphere MQ Namelist 32.. Create WebSphere MQ Namelist 33. Work with WebSphere MQ Namelists CHGMQMPRC CPYMQMPRC CRTMQMPRC DLTMQMPRC DSPMQMPRC WRKMQMPRC CHGMQMNL CPYMQMNL CRTMQMNL DLTMQMNL DSPMQMNL WRKMQMNL More. Create WebSphere MQ Process 27.... Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Process Commands 24. 19. . Display WebSphere MQ Command Server Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: 13.. 17. 23. 18. Delete WebSphere MQ Namelist 34. Delete Message Queue Manager Disconnect Message Queue Manager Display Message Queue Manager Display Message Queue Manager Status End Message Queue Manager Start Message Queue Manager Start WebSphere MQ Trigger Monitor Work with Message Queue Managers DLTMQM DSCMQM DSPMQM DSPMQMSTS ENDMQM STRMQM STRMQMTRM WRKMQM DSPMQMCSVR More. 5. 21. Copy WebSphere MQ Process 26. Change WebSphere MQ Namelist 31. End WebSphere MQ Command Server 14. 16. 7. 6. Commands Change WebSphere MQ Queue Clear WebSphere MQ Queue Copy WebSphere MQ Queue Create WebSphere MQ Queue Delete WebSphere MQ Queue Display WebSphere MQ Queue Work with WebSphere MQ Messages Work with WebSphere MQ Queues Work with WebSphere MQ Queue Status ENDMQMCSVR STRMQMCSVR CHGMQMQ CLRMQMQ CPYMQMQ CRTMQMQ DLTMQMQ DSPMQMQ WRKMQMMSG WRKMQMQ WRKMQMQSTS More.

. Resume WebSphere MQ Cluster Queue Manager 39. Work with WebSphere MQ Authority Data Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Channel Commands 48. Work with WebSphere MQ Clusters 41. Revoke WebSphere MQ Object Authority 45. Work with WebSphere MQ Authority 47. End WebSphere MQ Channel 54. Ping WebSphere MQ Channel 55.. Refresh WebSphere MQ Cluster 37. Display WebSphere MQ Object Authority 43. Start WebSphere MQ Channel Initiator 59. Create WebSphere MQ Channel 51. Copy WebSphere MQ Channel 50.Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Cluster Commands 36. Create WebSphere MQ Listener Object CHGMQMLSR CPYMQMLSR CRTMQMLSR CHGMQMCHL CPYMQMCHL CRTMQMCHL DLTMQMCHL DSPMQMCHL ENDMQMCHL PNGMQMCHL RSTMQMCHL RSVMQMCHL STRMQMCHL STRMQMCHLI WRKMQMCHL WRKMQMCHST More. Grant WebSphere MQ Object Authority 44. Work with WebSphere MQ Cluster Queues Authority Commands 42. Reset WebSphere MQ Channel 56. Suspend WebSphere MQ Cluster Queue Manager 40. Resolve WebSphere MQ Channel 57. Delete WebSphere MQ Channel 52. Change WebSphere MQ Channel 49. RFRMQMCL RSTMQMCL RSMMQMCLQM SPDMQMCLQM WRKMQMCL WRKMQMCLQ DSPMQMAUT GRTMQMAUT RVKMQMAUT RFRMQMAUT WRKMQMAUT WRKMQMAUTD More. Change WebSphere MQ Listener Object 62.. Start WebSphere MQ Channel 58. Display WebSphere MQ Channel 53. Refresh WebSphere MQ Object Authority 46. Copy WebSphere MQ Listener Object 63. Work with WebSphere MQ Channel Status Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Listener Commands 61. .. Reset WebSphere MQ Cluster 38. Work with WebSphere MQ Channels 60.

End WebSphere MQ Broker 81.. 76. 65. Create WebSphere MQ Listener Object 64. Work with WebSphere MQ Connections Broker Commands 79. Delete WebSphere MQ Listener Object Display WebSphere MQ Listener Object Start WebSphere MQ Listener End WebSphere MQ Listener Work with WebSphere MQ Listeners DLTMQMLSR DSPMQMLSR STRMQMLSR ENDMQMLSR WRKMQMLSR CHGMQMSVC CPYMQMSVC CRTMQMSVC DLTMQMSVC More. Delete WebSphere MQ Service Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: 73. Copy WebSphere MQ Service 71. Copy WebSphere MQ Service 71. End WebSphere MQ Connection 78.. Start WebSphere MQ Listener 67. Delete WebSphere MQ Broker . 68.. Change WebSphere MQ Service 70. Change WebSphere MQ Listener Object 62. Connection Commands 77. Copy WebSphere MQ Listener Object 63. Clear WebSphere MQ Broker 83. Create WebSphere MQ Service 72.64. 75. Start WebSphere MQ Broker 80. Create WebSphere MQ Service 72. Delete WebSphere MQ Service Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve CMDMQM Select one of the following: Listener Commands 61. Display WebSphere MQ Service Start WebSphere MQ Service End WebSphere MQ Service Work with WebSphere MQ Services F12=Cancel WebSphere MQ Commands CHGMQMLSR CPYMQMLSR CRTMQMLSR DLTMQMLSR DSPMQMLSR STRMQMLSR ENDMQMLSR WRKMQMLSR CHGMQMSVC CPYMQMSVC CRTMQMSVC DLTMQMSVC More. Delete WebSphere MQ Listener Object 65. Display WebSphere MQ Listener Object 66. 67. Change WebSphere MQ Service 70.. 66. Service Commands 69. End WebSphere MQ Listener 68. Work with WebSphere MQ Listeners Service Commands 69. Display WebSphere MQ Broker 82. 74... DSPMQMSVC STRMQMSVC ENDMQMSVC WRKMQMSVC ENDMQMCONN WRKMQMCONN STRMQMBRK ENDMQMBRK DSPMQMBRK CLRMQMBRK DLTMQMBRK More.

Trace WebSphere MQ Name Command 91. Delete WebSphere MQ Authentication Information 88. Work with WebSphere MQ Authentication Information Trace Command 90. Convert WebSphere MQ Data Type WebSphere MQ Dead-Letter Queue Handler 98..Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Authentication Information Commands 84. Change WebSphere MQ Authentication Information 85. Create WebSphere MQ Authentication Information 87. Run WebSphere MQSC Commands 96. Display WebSphere MQ Object Names CHGMQMAUTI CPYMQMAUTI CRTMQMAUTI DLTMQMAUTI DSPMQMAUTI WRKMQMAUTI TRCMQM DSPMQMOBJN More. Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: Media 92. Recovery Commands Record WebSphere MQ Object Image Recreate WebSphere MQ Object Work with WebSphere MQ Transactions RCDMQMIMG RCRMQMOBJ WRKMQMTRN RUNMQSC STRMQMMQSC CVTMQMDTA STRMQMDLQ More. Start WebSphere MQ Dead-Letter Queue Handler . Display WebSphere MQ Version WebSphere MQ Route Information DSPMQMVER WebSphere MQSC Commands 95.. Start WebSphere MQSC Commands Data Conversion Exit Command 97. Display WebSphere MQ Authentication Information 89. Copy WebSphere MQ Authentication Information 86. Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel ------CMDMQM WebSphere MQ Commands Select one of the following: WebSphere MQ Version Details 99. 93. 94...

drop procedure will allow you to delete a procedure. You can look this up using the WRKLICINF command. You can create logical files that point to a particular member or use the SQL CR EATE ALIAS function. 1. DSPMSGD SQL0030 MSGF(QSQLMSG) gives first level text of 'Number of host variables less than result values. DROP SPECIFIC PROCEDURE SpecificName 2.' with the option of viewing more information about the error. If SQLCOD > 10000 use 'SQ' instead of 'SQL' for the concatenation. DROP PROCEDURE MyProcedure(Dec(5. You can look this up using the WRKLICINF comm and. Char(10) . What is the SQL equivalent of CHAIN to see if a single record exists? SELECT 1 FROM QSQPTABL WHERE EXISTS (SELECT * FROM ITEMMASTER WHERE ITEMNUMBER = 8) how can I find or delete a procedure in SQL select * from sysprocs will allow you to locate all the procedures on the system . # iSeries or AS/400 Serial Number.). Maximum number of records that can be edited is 32764 in SEU PDM. Birgitta Hauser adds the following tip: Because a procedure can be overloaded (you can have several procedures with the same name in the same schema with a different number of parameters).. you should either use the specific name of the procedure or list the parameter description in the DROP PROCEDURE statement. this means a subfield of a data structure that is defined with 4 byt .100. if SQLCOD = 0000030 the equivalent error message would be SQL0030.. BINARY(4) means a 4-byte binary number.rpgnext. In RPG III. Display WebSphere MQ Route Information DSPMQMRTE Bottom Selection or Command ===> F3=Exit F4=Prompt F9=Retrieve ------F12=Cancel # iSeries or AS/400 System Name.php If you want to know what an SQLCOD value means you can display them by concatena ting the last four digits of the SQLCOD value to 'SQL' and using the DSPMSGD com mand to display the associated message. Here's an example: CREATE ALIAS mylib/SALESJAN for prodlib/ SALESFIL(JAN).com/tutorials. # Processor group. For example. http://www. 2). You can look this up on your sign-on screen or with the WRKLICINF command.

A 2-byte binary field can only hold up to 4 digits. IF Dec = 0 Then Set Data = Char(Decimal(Data.30.1)*Sign). This always causes problems calling the API.g.3.4.3)*Sign). 10I-0 or 9B-0. ELSEIF Dec = 2 Then Set Data = Char(Decimal(Decimal(Data)/ Save your profile somewhere on your hard driv e (e. In RPG IV.Len)). Then create a CL like this: STRPCO PCTA(*YES) MONMSG MSGID(IWS4010) STRPCCMD PCCMD('RTOPCB C:\profile. Set Data = SUBSTR(HEX(SUBSTR(Rcd. The 10-digit integer is better when dealing with APIs.1. ELSEIF Dec = 1 Then Set Data = Char(Decimal(Decimal(Data)/10. and has the 'B' type. c:\).1) ='F' THEN 1 ELSE -1 END.1)).30).30.0) FROM CUSTFLAT ----> CREATE FUNCTION UNPACK(Rcd VarChar(1000). Set Ulen = Len *2-1. Start Integer. and 21544 has 5 d igits. ELSEIF Dec = 3 Then Set Data = Char(Decimal(Decimal(Data)/1000. Retrieve current job type RTVJOBA TYPE(&JOBINFO) Submit job if currently interactive IF COND(&JOBINFO = '1') THEN(DO) (job-number/user-name/job-name) RMVMSG PGMQ(*SAME) CLEAR(*ALL) RCVMSG PGMQ(*SAME *) MSGTYPE(*ANY) MSG(&msg) MSGDTA(&msgdta) MSGID(&msgid) RTNTYPE(&rtntyp) MSGF(&msgf) MSGFLIB(&msgflib) How can I send files to the PC from a CL pgm?? Create a profile in client access. The value 21544 cannot be represented in a 2-byte binary field even though it on ly uses bits in the loworder two bytes. Declare ULen Integer. Len Integer.dtt" profil e and use RFROMPCB in place of the RTOPCB. UNPACK(CUSTFLAT. Declare Sign Integer. SELECT SUBSTR(CUSTFLAT. Dec Integer) RETURNS VARCHAR(30) LANGUAGE SQL DETERMINISTIC BEGIN Declare Data Char(30).Ulen).0)*Sign).1.Len. there are two kinds of 4-byte binary number: the 10-digit integer or the 9-digit binary.2)*Sign). .dft') PAUSE(*YES) You could also send files from your PC to the AS400 by creating a "*. A very common error is to define a BINARY(4) field or parameter using length not ation as 4B-0.30. you give the number of digits. If you define an integer or binary number using length notation (no from-positio n). Set Sign = CASE WHEN SUBSTR(HEX(SUBSTR(Rcd.

many different file systems can be accessed using a common interface . SUBSTR(CUSTFLAT.4)*Sign).RMVM.6)*Sign). ELSE Set Data = Char(Decimal(Decimal(Data)/1000000.30.CHGPF.0 SRCDTA -Where the C-specs/D-specs/F-specs reside length: 100 DIndicators DS Based(IndicatorP) D SFLNXTCHG 8 8 DIndicatorP S * Inz(%Addr(*IN)) Data Types in DB2/400A alphanumeric 32766 characters P packed decimal 31 digits.CRTPF. ELSEIF Dec = 5 Then Set Data = Char(Decimal(Decimal(Data)/100000.30) FROM CUSTFLAT List ILE Program Information (QBNLPGMI) API CRTPF FILE(QTEMP/SPOOLPF) RCDLEN(132) MAXMBRS(*NOMAX) SIZE(*NOMAX) AUT(*ALL) CPYSPLF FILE(&MBR) TOFILE(QTEMP/SPOOLPF) SPLNBR(*LAST) MBROPT(*REPLACE) CHGCMDDFT RUNSQLSTM SRCFILE(MCSD027UTL/MPTOOLSRC) SRCMBR(MPQRY) COMMIT(*NONE) RUNQRY *N QTEMP/FILEPF RUNQRY QRY(MCSD027UTL/RESULT8) * New line constant D C_CRLF C CONST(x'0d25') All source files have three fields: SRCSEQ -The sequence number length: 6.5)*Sign). END IF.30. END select * from TABLE (getcustf()) as CUSTFLAT ----> A Table Function CREATE FUNCTION GETCUSTF () RETURNS TABLE(CUSTNO CHAR(7). RETURN Data. CUSTNAM CHAR(30)) LANGUAGE SQL READS SQL DATA NO EXTERNAL ACTION NOT DETERMINISTIC DISALLOW PARALLEL RETURN SELECT UNPACK(CUSTFLAT.CLRPFM.4.31 digits.1.30. 30 decimal positions S zoned decimal .3. 30 decimal positions L Long date 4 bytes Z Time stamp 10 bytes T Time 6 bytes F Floating point 1 9 digits in single precision & 1 n H Hexadecimal 32766 bytes 17 digits in double precisio ADDPFM.CHGPFM.ELSEIF Dec = 4 Then Set Data = Char(Decimal(Decimal(Data)/10000.0).DLTF-File/Record/Field/KeyField key words ADDPFCST To copy the PF object the command used is CPYF which has got various options for specifying the source and the destination files and also to create/replace the file and its members and also to map/drop the fields.DSPPFM.2 SRCDAT -The change date off to the right length: 6. In the IFS.

5. At this time. the printer output from that job is sent to an output queue where it waits to be sent to a printer device or file. BNDDIR('QC2LE') But. printing). such as the memory pool to use. any pro gram that you expect to call from the command line. Once the job moves to the subsystem it is alloc ated memory in which to run. The job finishes and moves to the output queue\ When a job finishes. it moves to the job queue where it waits to enter the subsystem.file/proof. Therefore. the job moves to the job queue where it waits to ent er the subsystem. Submit a job On submitting a job to an iSeries server. The simplest rule is the one that handles decimal literals. They can be thought of as "waiting rooms" for the subsystem. Once the job receives its job description and defines its prop erties. where the v alue is 15 digits long. The job uses several piec es of information before it can receive memory to run. the properties of a job are given to the job. All decimal literals will be converted to packed decimal format with a length of (15 5). like job priority on t he job queue. the routing entry. and will automatically convert it to C's format by adding the terminating "null" character at the end. you can better understand how ot her work is completed on the system by learning more about the topics below: 1. it cannot run. it is sent to a printer o utput queue to await further instruction on what to do (for example. needs to dec lare it's numeric input parameters as *DEC(15 5). The amount of memory from a memory pool. and the initial user portion of the library list. and the maximum active jobs. in that it controls how the output is made available to the prin t devices. the job will be pulled off the job que ue to start running in the subsystem. however. Not every job follows this exact path. as well as how many other jobs are co mpeting for memory affect how efficiently a job runs. the RPG compil er will automatically allow any length string. The job enters the subsystem When the job enters the subsystem it becomes active. the maximum active jobs. The job description holds properties the job will use to go through the work management life-cycle. Until a job gets its activi ty level and memory from a memory pool. 4. carries information. Type of STMF. 2.DSPF. When the job is complete. The subsyst em gives the memory pool the information it needs to process the order in which jobs are allocated memory.EDTF. The output queue allows the user to control what files are printed fi rst. When all of these factors work together. WRKLNK. The job is then sent to a job queue where it waits to ent er a subsystem where it can run. and the memory pool allocates memory for the job to r un to completion.. The output queue is like the job queue. and we use "options(*string)". The life of a simple batch job begins when you su bmit it to the system. A number of factors affect whe n the job is pulled off the job queue into the subsystem. Once the pr operties have been defined. follow a simple batch job a s it moves through the system. The memory pool allocates memory to the subsystem Memory is a resource from the memory pool that the subsystem uses to run the job . . The subsystem description . it (the job) is created and enters the system. the sequence number of the job queue. as well as others.. the request data (which tells the job what it will do). These properties include the user profile the job will start to run under.RMVLNK. 3. Stream files. or SBMJOB etc. and the number of active jobs curre ntly in the subsystem. Subsystems use different m emory pools to support different types of jobs that run within them./QSYS. like the job description. of which 5 digits are decimal places. if we use a pointer by value.LIB/qgpl. The job enters a job queue Job queues are work entry points for batch jobs to enter the system. A job's life To understand the basics of iSeries work management.mbr.lib/qrpgles rc.

and padded on the right with blanks. debugging view = *SOURCE. and these commands will take care of all of the p arameters for you. regardless of whether or not the caller actually allocated that much storage fo r it. commitment control *NONE SQLRPGLE or RPGLE. I asked to keep them only for reference. Otherwise for tasks like this (new Programs)we donot keep commented code in the source When you are working on a client that uses version 8 of BPCS. the commands are d ifferent than using option 14. remember that the system converts literals to variables in the background. and that char literals greater than 32 bytes are converted to variables of equiv alent size. . On clients who When compiling When compiling Display files: BPCS don't have version 8 of BPCS. you'll see ORD programs. You are correct when doing changes in existing programs. but not least: the called program "sees" as much storage as it declares for an input parameter. remember that decimal literals are always converted to *DEC(15 5). The first is that any character literal up to 32 characters in length will be converted to a 32 byte variable. But this is a new program you can add t he line without any mod mark. like ORD (customer orders) or SFC ( Shop floor control). CRTPRTFILE.Character literals are a little bit more complicated. and that char literals less than or equal to 32 bytes are converted to *CHAR(32) . but still fairly straightf orward. the parms to change are: SQLRPG or SQLRPGLE. as in the following Things to Remember always match the type/size of parameters on your pgm to pgm calls. If you type ORD in the men u screen. and CRTDSPLY. and last. The second rule is that character literals longer than 32 bytes are converted to a variable of the same length as the literal value itself. restore display *YES. You have to modmark whe n commenting a line and adding new line. There are two rules to remember. ON_HAND = * * * * Opening Balance (for the fiscal month) plus month-to-date Receipts minus month-to-date Issues plus month-to-date Adjustments Available Inventory = On hand minus allocations -----BPCS All BPCS programs begin with a module name. These are also the menu names. The valu e is left justified. regarding old lines you can keep them until testin g after completing all you changes and testing you have to remove them. CL' s can still be compiled using option14 and no parms are needed to be changed. The commands to use are RPGLE.

Archive Recovery 24. Concurrent Development 34. Object Code Administration: 41. Network Configuration 47. Environment 38. System Control 46. Lock 33. Move Promotion Requests by System/Environment Other 11.ZMM ZMO Menu Master Menu Options Changed the exit points through BPCS menu option Product Interface Maintenance SYS635D1 Created/Changed records in ZPA using System Parameters Maintenance SYS100D1 from SYS menu ZPA file System Table Maintenance SYS105D1 from SYS03 menu ZCC file ZMO menu options file Menu Print using F13 and then 10=Menu Print BPCS Entry Key generation = CALL PGM(SYS664) PARM(SYS664) -----MKS Implementer Menu ADDLIBLE MKSIM STRIM Implementation: 1. User 37. common tasks: Work with Objects Request Inquiry Request Maintenance Manage Concurrent Development Work with Projects Job Log Inquiry Emergency handling: 21. Archive to Tape Reports: 31. Activity 32. Check Out 3. 14. Users 42. Emergency Create Request 23. 16. 12. Environments 43. 15. Create Promotion Request 4. Request 36. 13. Emergency Check Out 22. My Workbench 2. Object Codes 45. MKS Integrity Setup . Environment Groups 44. Compile Promotion Requests 5. Move Promotion Requests 6. Archive History 35.

Compile Requests command (ICMPRQS) 84.48. Merge Member (IMRGMBR) 87. Check Out command (ICHKOUT) 82. Workbench Compile (ICOMPILE) 88. Release Status 54. Release Deployment Menu Commands: 81. Release Types 53. Set to Environment Library List (ISETLIBL) --------------BPCS Configurable Enterprise Financials Multi-Mode Manufacturing Supply Chain Management Cross-Product Application Cost Accounting Accounts Payable Processing Accounts Receivable Processing Multiple Currencies Cash Management Fixed Assets Advanced Remittance Processing Credit and Deduction Management Configurable Ledger Trade Funds Management Configurable Enterprise Accounting Cartera Receivable Management Manufacturing Data Management Shop Floor Control Capacity Planning Master Production Scheduling Material Requirements Planning JIT/Repetitive Manufacturing Advanced Process Industries Performance Measurement Quality Laboratory Management Configuration Management Lean Manufacturing Process Electronic Signature MDM SFC CAP MPS MRP JIT API PRF QMS CFG LMP ESG CST ACP ACR MLT CSH FXA ARP CDM CLD TFM CEA CAR CEF MMM SCM XPA . Compare Member (ICMPMBR) 86. Create Request command (ICRTRQS) 83. MKS Source Setup 49. Function Keys Release Control: 51. Implementer Server 50. Products 52. Move Requests command (IMOVRQS) 85.

.html&hl=nl&ie=UTF-8&sl=ja&tl=en (READ THIS. FKEY_CONST ** ** Description . . .The RPG IV Network ** ** ----------------------------------------** ** Program . .com/tips/c400/index . . . ** ** in this Generate C/C++ Source Create Bound C Program Create Bound C++ Program Create C Module Create C++ Module Create SQL ILE C++ Object Create SQL ILE C object GENCSRC CRTBNDC CRTBNDCPP CRTCMOD CRTCPPMOD CRTSQLCPPI CRTSQLCI INV PUR ORD BIL SAL DRP FOR PRO WHM OLM CFG RMS ILM SYS DOC ECM C CPP C CPP SQLCPP SQLC Source Headers in QSYSINC/H files http://translate. ** ** ** *********************************************************** D F1 C CONST(X'31') D F2 C CONST(X'32') D F3 C CONST(X'33') D F4 C CONST(X'34') D F5 C CONST(X'35') D F6 C CONST(X'36') D F7 C CONST(X'37') D F8 C CONST(X'38') D F9 C CONST(X'39') . .google. All attention identification ** ** byte codes for each ** ** function key. . .as400-net. Function key named constants ** ** ** ** Features . . . . . . . BIG ARTICLE on C/400) *********************************************************** ** RPGTOOLS ** ** (c) 2000 .Inventory Management Purchasing Management Order Management Billing Sales Analysis Distribution Resource Planning Forecasting Management Promotions and Deals Warehouse Management Outbound Logistics Management Configuration Management Release Management Inbound Logistics Management System Functions Documentation Electronic Commerce Manager C / C++ / SQLCPP on iSeries. .

D D D D D D D D D D D D D D D D D D D D D D D F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 CLEAR ENTER HELP ROLLDN ROLLUP PRINT RCBKSP AUTENT C C C C C C C C C C C C C C C C C C C C C C C DS 369 369 CONST(X'3A') CONST(X'3B') CONST(X'3C') CONST(X'B1') CONST(X'B2') CONST(X'B3') CONST(X'B4') CONST(X'B5') CONST(X'B6') CONST(X'B7') CONST(X'B8') CONST(X'B9') CONST(X'BA') CONST(X'BB') CONST(X'BC') CONST(X'BD') CONST(X'F1') CONST(X'F3') CONST(X'F4') CONST(X'F5') CONST(X'F6') CONST(X'F8') CONST(X'3F') D WSDS D functionKey DMYPSDS SDS D PROC_NAME *PROC * Procedure name D PGM_STATUS *STATUS * Status cod e D PRV_STATUS 16 20S 0 * Previous status D LINE_NUM 21 28 * Src list line num D ROUTINE *ROUTINE * Routine name D PARMS *PARMS * Num passed parms D EXCP_TYPE 4 0 42 * Exception type D EXCP_NUM 43 46 * Exception number D PGM_LIB 81 90 * Prog ram library D EXCP_DATA 91 170 * Exception data D EXCP_ID 171 174 * Exception Id D DATE 191 198 * Date (*DATE fmt) D YEAR 199 200S 0 * Year (*YEAR fmt) D LAST_F ILE 201 208 * Last file used D FILE_INFO 209 243 * File error info D JOB_NAME 24 4 253 * Job name D USER 254 263 * User name D JOB_NUM 264 269S 0 * Job number D JOB_DATE 270 275S 0 * Date (UDATE fmt) D RUN_DATE 276 281S 0 * Run date (UDATE) D RUN_TIME 282 287S 0 * Run time (UDATE) D CRT_DATE 288 293 * Create date D CRT_ TIME 294 299 * Create time D CPL_LEVEL 300 303 * Compiler level D SRC_FILE 304 3 13 * Source file D SRC_LIB 314 323 * Source file lib D SRC_MBR 324 333 * Source file mbr D PROC_PGM 334 343 * Pgm Proc is in D PROC_MOD 344 353 * Mod Proc is in -----Table 23. 26-32) To (Pos. Contents of the Program Status Data Structure From (Pos. 33-39) .

it includes a source ID other than zero) . 16 20 Zoned decimal 5. 40 42 Character 3 Exception type (CPF for an operating system exception or MCH for a machine exception). 37 39 Zoned decimal 3. This subfield is updated at the beginning of an RPG IV routine o r after a program call only when the *STATUS subfield is updated with a nonzero value. this field contains a CPF message number. 29 36 Character 8 *ROUTINE Name of the RPG IV routine in which the exception or error occurred. the name associated with the main source section. it contains a machine exception num ber.0 Previous status code. If no infor mation is available.0 *PARMS Number of parameters passed to this program from a calling program. Logic that takes t he program out of the normal RPG IV cycle may cause *ROUTINE to reflect an incor rect value. s ee Program Status Codes. The organization of information will not always be . For a CPF exception. Note: *ROUTINE is not valid unless you use the normal RPG IV cycle. if there is one. This area is only meant for internal use by the ILE RPG compiler. For a description of these codes. otherwise.Format Length Keyword Information 1 10 Character 10 *PROC Name of the main procedure. 43 46 Character 4 Exception number. 21 28 Character 8 RPG IV source listing line number or statement number.0 *STATUS Status code. The so urce listing line number is replaced by the source listing statement number if O PTION(*SRCSTMT) is specified instead of OPTION(*NOSRCSTMT). For a machine exception. The full statement n umber is included when it applies to the root source member. -1 is returned. If the statement nu mber is greater than 6 digits (that is. the first 2 positions of the 8-byte feedback area will have a "+ " indicating that the rest of statement number is stored in positions 354-355. 11 15 Zoned decimal 5. The following names identify the routines: *INIT Program initialization *DETL Detail lines *GETIN Get input record *TOTC Total calculations *TOTL Total lines *DETC Detail calculations *OFL Overflow lines *TERM Program ending *ROUTINE Name of program or procedure called (first 8 characters). 47 50 Character 4 Reserved 51 80 Character 30 Work area for messages. The value is the same as that returned by %PARMS.

the RPG IV opcode. 304 313 Character 10 Source file name. In the case of batch jobs submitted for overnight processing. 314 323 Character 10 Source library name. It is updated only w hen an error occurs. The 'century' value i n positions 199 . the sourc e listing line number or statement number. The same as the fir st 2 digits of *YEAR. For example. CPF messages are placed in this s ubfield when location *STATUS contains 09999. The full state ment number is included when it applies to the root source member. If the statem ent number is greater than 6 digits (that is. See User Date Special Words for a description of UDATE. 175 184 Character 10 Name of file on which the last file operation occurred (up dated only when an error occurs). This file name will be truncated if a long file name is used. If the yea r part of this value is between 40 and 99. If the year part of this value is between 40 and 99. 300 303 Character 4 Level of the compiler. The 'century' value in positions 199 . 324 333 Character 10 Source file member name. the RPG IV routine name. 185 190 Character 6 Unused. This value is derived from the job date. 270 275 Zoned decimal 6. it includes a source ID other than zero). 209 243 Character 35 Status information on the last file used. . Note: This century field does not apply to the dates in positions 276 to 281.0 Time (in the format hhmmss) of the program running. a nd this century field would be 19. 201 208 Character 8 Name of file on which the last file operation occurred (upd ated only when an error occurs). and record name. 282 287 Zoned decimal 6.200 does not apply to this field. 191 198 Character 8 Date (*DATE format) the job entered the system.0 Date of program running (the system date in UDATE for mat). It can be displayed by the user. 81 90 Character 10 Name of library in which the program is located. the date is between 1940 and 1999. 171 174 Character 4 Identification of the exception that caused RNX9001 excepti on to be signaled.275 has the combined information of the value in pos itions 191 -198. Otherwise the date is between 2000 and 2039. Note: The opcode name is in the same form as *OPCODE in the INFDS The source listing line number is replaced by the source listing statement numbe r if OPTION(*SRCSTMT) is specified instead of OPTION(*NOSRCSTMT). UDATE would be 990627. This field applies to the century part of the date in posi tions 270 to 275. 264 269 Zoned decimal 6.consistent. The value in this field in conjunction with t he value in positions 270 . The date represented by this value is t he same date represented by positions 270 . the first 2 positions of the 8-byte feedback area will have a "+ " indic ating that the rest of statement number is stored in positions 356-357.275.198. The date repres ented by this value is the same date represented by positions 191 . This information includes the status code. the date is between 1 940 and 1999. 288 293 Character 6 Date (in UDATE format) the program was compiled. 294 299 Character 6 Time (in the format hhmmss) the program was compiled. This is commonly known as the 'job date'.0 Job number.200 does not apply to this field. or posit ions 288 to 293. 91 170 Character 80 Retrieved exception data. those that run after midnight will carry the next day's date. Ot herwise the date is between 2000 and 2039. See positions 175-184 for long file name information.0 Date (in UDATE format) the program started running in the system (UDATE is derived from this date). 199 200 Zoned decimal 2. This information always contains the full file name. with t he year expanded to the full four years.0 First 2 digits of a 4-digit year. 254 263 Character 10 User name from the user profile. 244 253 Character 10 Job name. 276 281 Zoned decimal 6. for the date 1999-06-27.

358 368 372 380 343 353 355 357 367 371 379 429 Character Character Binary 2 Binary 2 10 Program containing procedure.0 Integer 20. Source Id matching the statement number from positions 228-235 Current user profile name. 10 Module containing procedure. Source Id matching the statement number from positions 21-28. External error code XML elements set by operation Unused.0 Character 50 COLOR HEX CODES D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D White C CONST( X'22' ) White_UL C CONST( X'26' ) White_RI C CONST( X'23' ) White_RI_CS C CONST( X'33' ) PR_White C CONST( X'A2' ) PR_White_UL C CONST( X'A6' ) PR_White_RI C CONST( X'A3' ) PR_White_RI_CS C CONST( X'B3' ) Green C CONST( X'20' ) Green_RI C CONST( X'21' ) Green_UL C CONST( X'24' ) Green_UL_RI C CONST( X'25' ) PR_Green C CONST( X'A0' ) PR_Green_RI C CONST( X'A1' ) PR_Green_UL C CONST( X'A4' ) PR_Green_UL_RI C CONST( X'A5' ) Red C CONST( X'28' ) Red_RI C CONST( X'29' ) Red_HI C CONST( X'2A' ) Red_HI_RI C CONST( X'2B' ) Red_UL C CONST( X'2C' ) Red_UL_RI C CONST( X'2D' ) Red_UL_BL C CONST( X'2E' ) PR_Red C CONST( X'A8' ) PR_Red_RI C CONST( X'A9' ) PR_Red_HI C CONST( X'AA' ) PR_Red_HI_RI C CONST( X'AB' ) PR_Red_UL C CONST( X'AC' ) PR_Red_UL_RI C CONST( X'AD' ) PR_Red_UL_BL C CONST( X'AE' ) Turq_CS C CONST( X'30' ) Turq_CS_RI C CONST( X'31' ) Turq_UL_CS C CONST( X'34' ) Turq_UL_RI_CS C CONST( X'35' ) PR_Turq_CS C CONST( X'B0' ) PR_Turq_CS_RI C CONST( X'B1' ) PR_Turq_CS_UL C CONST( X'B4' ) PR_Turq_CSULRI C CONST( X'B5' ) Yellow_CS C CONST( X'32' ) Yellow_CS_UL C CONST( X'36' ) PR_Yellow_CS C CONST( X'B2' ) PR_Yellow_CSUL C CONST( X'B6' ) Pink C CONST( X'38' ) Pink_RI C CONST( X'39' ) Pink_UL C CONST( X'3C' ) Pink_UL_RI C CONST( X'3D' ) PR_Pink C CONST( X'B8' ) PR_Pink_RI C CONST( X'B9' ) . Character 10 Integer 10.334 344 354 356 .

D D D D D D D D PR_Pink_UL C CONST( X'BC' ) PR_Pink_UL_RI C CONST( X'BD' ) Blue C CONST( X'3A' ) Blue_RI C CONST( X'3B' ) Blue_UL C CONST( X'3E' ) PR_Blue C CONST( X'BA' ) PR_Blue_RI C CONST( X'BB' ) PR_Blue_UL C CONST( X'BE' ) .