Getting Session Started A58 with APIs. from RPG

Size: px
Start display at page:

Download "Getting Session Started A58 with APIs. from RPG"

Transcription

1 Getting Session Started A58 with APIs from RPG Getting Started with System APIs from RPG Susan Gantner Your partner in AS/400 and iseries Education The author, Susan Gantner, is co-founder of Partner400, a firm specializing in customized education and mentoring services for AS/400 and iseries developers. After a 15 year career with IBM, including several years at the Rochester and Toronto laboratories, Susan is now devoted to educating developers on techniques and technologies to extend and modernize their applications and development environments. This is done via on-site custom classes for individual companies as well as conferences and user group events. Together with her partner, Jon Paris, Susan authors regular technical articles for the IBM publication, IBM Systems Magazine, i5 edition (formerly iseries Magazine and eserver Magazine, iseries edition), and the companion electronic newsletter, i5 EXTRA (formerly iseries Extra). You may view articles in current and past issues and/or subscribe to the free newsletter or the magazine at: Feel free to contact the author at: partner400.com or visit the Partner400 web site at This presentation may contain small code examples that are furnished as simple examples to provide an illustration. These examples have not been thoroughly tested under all conditions. We therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. All code examples contained herein are provided to you "as is". THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Copyright Partner400, APIs from RPG - Page: 1-2

2 Using System APIs There are hundreds of System APIs From simple APIs you may already use e.g., QCMDEXC to more complex APIs to provide lists of information from the system Think of "Work With..." commands Lists of objects, spooled files, members, user profiles, jobs, programs, modules in programs, etc. APIs provide interfaces to system functions and system information Documented in the IBM iseries Information Center Choose your OS release Then in the left hand pane Expand the iseries Information Center, Version 5 Release x Expand the "Programming" topic Expand "APIs" - usually the first entry in the list List Type APIs require some detailed knowledge of using User Spaces, Pointers and the structure of List API data. We will be discussing that here. Many of the other types of APIs are simpler. Copyright Partner400, APIs from RPG - Page: 3-4

3 Finding APIs Three ways in Info Center's "API Finder" By Category Best if you don't know the name of the API Sometimes difficult to figure out the right category, however By Name Full or partial name Either the actual program or procedure name or the text name or title To get a list of APIs related to User Spaces either "QUS" because the program names begin with that or "User Space" because the API name or title includes it From an alphabetic list of all APIs When all else fails! A non-info Center approach Often a Google keyword search specifying site:ibm.com provides a faster way to get to the IBM documentation for a specific API May not be the release you want on the first hit But once you have the name, then you can use the API finder easily Sometimes, finding the API you need can be the toughest part of the task! If the IBM Information Center doesn't work for you, try Google with site:ibm.com to limit the search to IBM web pages. Copyright Partner400, APIs from RPG - Page: 5-6

4 Prototyping APIs Prototyping APIs provides many advantages compared to CALL... PARM, PARM, PARM... or to CALLB... PARM, PARM, PARM Use a more meaningful name for the API called The function of the API is often not intuitive from its name Proto options that are useful (sometimes required) with APIs Including options that: Allow for variable size parameters - Options(*VarSize) Allow for Optional parameters - Options(*NoPass) Allow for Omissible parameters - Options(*Omit) Allow the compiler to accept literal values, BIFs or values that are not exactly the right data type or size - CONST We'll have a quick review of prototyping basics by looking at a prototype for QCMDEXC But first, a look at the API documentation for QCMDEXC The option *NOPASS means that the parameter does not have to be passed on the call. Any parameters following that spec must also have *NOPASS specified. When the parameter is not passed to a program or procedure, the called program or procedure will simply function as if the parameter list did not include that parameter. The option *OMIT can be used for parameters which are not mandatory but which occur in the middle of a parameter sequence and therefore cannot be designated as *NOPASS. When the option is specified the special value *OMIT is allowed for that parameter on the call Option *VARSIZE gives the compiler permission to accept a character parameter that is shorter in length than the prototype specifies. This option is often used when the length of the passed field is also passed to the called program, such as in our QCMDEXC example coming up The use of the CONST keyword allows the compiler to accommodate mismatches in the definition of the parameters between the callee and the caller. For example, if the API we are calling expects a packed decimal value of 15 digits with 5 decimal places, we can pass a zoned decimal number of 3 digits and no decimal places if we prefer or a constant numeric value or a numeric expression.. Using the CONST keyword, you are telling the compiler that it is OK for it to make a copy of the data prior to passing it to accommodate such mismatches. This avoids the need for us to explicitly define a working variable of the correct size and type. The compiler can accommodate differences in: Size, decimal places, and type (zoned, packed, integer, etc.) - for Numeric fields The date format - for Date fields and Length and type (fixed or varying) - for Character fields The CONST keyword can be used for all API parameters documented as "Input" (see API documentation example in a later chart.) Copyright Partner400, APIs from RPG - Page: 7-8

5 Example: API Parameter Documentation Execute Command (QCMDEXC) API Required Parameter Group: 1 Command string Input Char(*) 2 Length of command string Input Packed (15,5) Optional Parameter: 3 IGC process control INPUT Char(3) Here is an example of part of the API documentation from the iseries Information Center for one of the APIs you have probably used before: QCMDEXC to execute a command from an RPG program. Note that the last parameter is marked as "Optional". In this case, it controls the use of double byte character sets, which are rarely used except in some Asian languages. Copyright Partner400, APIs from RPG - Page: 9-10

6 A Simple API: QCMDEXC Rather than call QCMDEXC via CALL... PARM, PARM This Prototype allows you to: Use a more meaningful name - OvrDBFile Use a Variable size parameter - Options(*VarSize) Avoid having to move values to pre-defined 15,5 fields - Const Have Optional parameters - Options(*NoPass) D CusMastOvr S 40 Inz('OVRDBF FILE(CustMast) + D TOFILE(NEWCUST)') D OvrDBFile PR ExtPgm('QCMDEXC') D CmdString 3000 Options(*VarSize) Const D CmdLength 15P 5 Const D CmdOpt 3 Options(*NoPass) Const C CallP OvrDBFile(CusMastOvr: %Len(CusMastOvr)) C CallP OvrDBFile('OVRDBF FILE(' + FileName + C ') TOFILE(' + NameToUse + ')' : 41) This example of a prototype for QCMDEXC demonstrates a number of the benefits of prototyping. - First it allows us to use a name indicative of the function performed - in this case OvrDBFile. We used the EXTPGM keyword to supply the "correct" name. Note: if the API you are calling is a bound API, you would need to use the EXTPROC keyword instead. - Second by using Options(*VarSize) we have made it possible to pass the 40 character parameter CusMastOvr when the prototype specifies that the length should be 3,000 characters long. That's 2,940 bytes saved! - Third we don't have to create a 15,5 work field just so that we can pass an integer length! Has that ever struck you as being rather odd? Why would a length ever need any decimal positions, much less 5 of them! CONST can be used on any API parameters defined as "Input" (see documentation chart earlier) - Lastly we can safely leave out the third parameter You did know that QCMDEXC has three parameters didn't you? If you didn't, don't feel bad - the third one is only used for DBCS (Double Byte Character Set) support. Copyright Partner400, APIs from RPG - Page: 11-12

7 Example: API Parameter Documentation Create User Space (QUSCRTUS) API Required Parameter Group: 1 Qualified user space name Input Char(20) 2 Extended attribute Input Char(10) 3 Initial size Input Binary(4) 4 Initial value Input Char(1) 5 Public authority Input Char(10) 6 Text description Input Char(50) Optional Parameter Group 1: 7 Replace Input Char(10) 8 Error code I/O Char(*) Here is an example of the API documentation from the iseries Information Center for another one of the APIs we will be using - Create User Space. We will talk about these data types and how to define them in RPG in upcoming charts. Note also the use of Optional Parameters. We will discuss the impact of these on our RPG programs in upcoming charts as well. Copyright Partner400, APIs from RPG - Page: 13-14

8 Interpreting API Documentation Translation of API documentation into RPG prototypes can be confusing Data types often seem foreign Some of the more common data types used in APIs include: API Documentation English Description Binary(4) 4 byte integer 10 I 0 Binary(2) 2 byte integer 5 I 0 Char(n) n byte Character field n A Char(*) Character field of indeterminate length n A PTR(SPP) Pointer * Note: "n" means any number of characters RPG Definition Char(*) fields are typically defined with the prototype keyword Options(*Varsize) to allow for different lengths One of the first things that seem to be mysterious about APIs to RPGers are the data types. Note the use of the I (integer) data type compared with the B (binary) data type. While many programmers (including those who write many of the examples in the IBM manuals and the includes in QSYSINC) still use the B type, it is better to use I (or U for unsigned integers). I supports the full range of possible values (which B cannot) and it also performs much better. If the API specifies an unsigned binary parameter, use type U instead of I. The length of the I or U field should be 10 for 4 byte fields or 5 for 2 byte fields. (Note: RPG also supports other length Integer fields, but they are rarely used in APIs.) Unfortunately many published examples (including most from IBM) continue to use the old fashioned type B data. Don't follow that lead - use the I or U data types. Copyright Partner400, APIs from RPG - Page: 15-16

9 Parameter Types for APIs APIs use 3 Parameter Types: Required: All of the parameters must be used in the specified order Optional: All or none of the parameters within the optional group You must either include or exclude the entire group You must include all preceding parameters Optional Parameters may (should) be specified with prototype parameter keyword Options(*Nopass) Omissible: The parameters will accept a null pointer in place of a value Omissible Parameters may (should) be specified with prototype parameter keyword Options(*Omit) AND a special value of *Omit must be passed D CrtUsrSpc Pr ExtPgm('QUSCRTUS') D SpaceQname 20a Const D SpaceAttr 10a Const D SpaceSize 10i 0 Const D SpaceInit 1a Const D SpaceAuth 10a Const D SpaceText 50a Const D Replace 10 Const Options(*NoPass) D ErrorFeedbk Like(ErrorInfo) D Options(*NoPass:*Varsize) Most, if not all, APIs have Required parameters. Many also have Optional Parameters. Omissible parameters are fairly rare among APIs. The prototype on this chart uses many of the features we have discussed on the last few charts, such as optional parameters and Binary(4) or Integer data types. Copyright Partner400, APIs from RPG - Page: 17-18

10 User Spaces What is a User Space? Contrary to popular belief, it's not what you find between a user's ears It is: An iseries object of type *USRSPC A simple stream of bytes that you can access directly from within a program Anything the programmer wants it to be! "List Type" APIs use User Spaces The API dumps a variable length list of items into the User Space Your program retrieves the list from the User Space The most efficient way to process the data in a User Space is by using one or more pointers Mapping the User Space to one or more Data Structures using the Based keyword The nearest that traditional programming can come to this concept is a data area, but you have to input and output data areas to and from programs. In contrast, you can immediately change the content of a User Space by merely changing the value of a field in your program. User Spaces have a fixed length and can be extended or truncated using the Change User Space Attributes (QUSCUSAT) API. This API also allows you to allow the User Space to automatically extend its size if necessary, much as physical files are set up by default. Copyright Partner400, APIs from RPG - Page: 19-20

11 A Few Examples of List Type APIs List Database File Members (QUSLMBR) List Database Relations (QDBLDBR) List Fields (QUSLFLD) List ILE Program Information (QBNLPGMI) List Job (QUSLJOB) List Job Log Messages (QMHLJOBL) List Module Information (QBNLMODI) List Object Locks (QWCLOBJL) List Objects (QUSLOBJ) List Objects That Adopt Owner Authority (QSYLOBJP) List Objects User Is Authorized to or Owns (QSYLOBJA) List Open Files (QDMLOPNF) List Program Temporary Fixes (QpzListPTF) List Record Formats (QUSLRCD) List Save File (QSRLSAVF) List Server Information (QZLSLSTI) List Service Program Information (QBNLSPGM) List Signed-On Users (QEZLSGNU) List Spooled Files (QUSLSPL) List Users Authorized to Object (QSYLUSRA) There are many additional List APIs available as well. Copyright Partner400, APIs from RPG - Page: 21-22

12 Layout of Data in the User Space HeaderInfo DS General Information... Offset to List Data Section List data Section Total Size Number of Items in the List Length of Each List Item format More General Information... ListItems DS List Item 1 List Item Last List Item This chart depicts how the List APIs interact with the User space. The List of Items is depicted by the box on the right. But the API puts out some Header information in the User Space as well to let you know interesting things such as the number of entries in the list, the size of each entry and where in the user space the first entry in the list is located. Copyright Partner400, APIs from RPG - Page: 23-24

13 Using Pointers Pointers have a data type of '*' and you don't define a length They actually use 16 bytes of storage Pointers are used to Base the storage of data in the program You need a value in the basing pointer before referencing the based data It can be set using the %Addr BIF or you can get the value from a called program, procedure or API In our example, we will be getting a value from an API D HeaderInfo DS Based(pHeaderInfo) D 103A D ListStatus 1A D 20A D ListOffset 10I 0 D ListSize 10I 0 D NbrEntries 10I 0 D EntryLen 10I 0 You don't actually have to define Pointers. If the compiler comes across a pointer in a Based keyword, it will automatically define it for you - so watch the spelling! In the example on the page above we do not need to explicitly defind pheaderinfo. The compiler will implicitly create it for us. Pointers are always 16 bytes in length and must be aligned on a 16 byte boundary. Therefore, definition of pointers in data structures may require the compiler to generate filler space. When defining pointers in data structures, refer to chapter 7 of the ILE RPG/400 Reference for more details on this phenomenon. In particular check out the ALIGN keyword. In our case, the address value for the pointer will come from the call to an API to get a pointer to the user space. Copyright Partner400, APIs from RPG - Page: 25-26

14 User Space APIs Working with User Spaces involves two APIs: Create User Space (QUSCRTUS) Retrieve Pointer to User Space (QUSPTRUS) The pointer retrieved is used to set the basing pointer of the field or DS D CrtUsrSpc Pr ExtPgm('QUSCRTUS') D SpaceQname 20a Const D SpaceAttr 10a Const D SpaceSize 10i 0 Const D SpaceInit 1a Const D SpaceAuth 10a Const D SpaceText 50a Const D Replace 10 Const Options(*NoPass) D ErrorFeedbk Like(ErrorInfo) Options(*NoPass) D Ptr2UsrSpc Pr ExtPgm('QUSPTRUS') D UsrSpcName 20 Const D PtrToUsrSpc * D ErrorFeedbk Like(ErrorInfo) You must use APIs to create User Spaces and manipulate their contents unless you have a program and/or command someone has created for you to do it. Some shops have a command to create a user space from the tools package in QUSRTOOLS that was once part of OS/400. The only OS/400 user space CL command you will find is the Delete User Space (DLTUSRSPC) command. Consider writing prototypes for all the User Space APIs so they can be easily accessed from RPG programs when needed. In many cases it will be preferable to "wrapper" them with a simple RPG subprocedure. This means that only one person needs to really understand the APIs. The others in the shop can use a simplified method to access the API. This also allows for an update to the error handling process, switching to a new improved API, etc. etc. all without changes to the "using" program. The documentation for the Pointer to User Space API looks like this: Retrieve Pointer to User Space (QUSPTRUS) API Required Parameter Group: 1 Qualified user space name Input Char(20) 2 Return pointer Output PTR(SPP) Optional Parameter: 3 Error code I/O Char(*) Copyright Partner400, APIs from RPG - Page: 27-28

15 Create & Get Access to a User Space This code creates a User Space and gets access to it via the pheaderinfo pointer Note that this is the basing pointer for our Data Structure This code exerpt uses the prototypes from the previous chart After this code runs, the Data Structure is located in the User Space D HeaderInfo DS Based(pHeaderInfo) D 103A D ListStatus 1A D 20A D ListOffset 10I 0 D ListSize 10I 0 D NbrEntries 10I 0 D EntryLen 10I 0 C CallP CrtUsrSpc ('MODULEINFOQTEMP' : C 'DTA' : : '*' : '*ALL' : C 'ILE Program Info': '*YES' : ErrorInfo) C CallP Ptr2UsrSpc ('MODULEINFOQTEMP': pheaderinfo: C ErrorInfo ) In this example, we are simply creating a User Space object by calling the CrtUsrSpc prototype (which corresponds to the QUSCRTUS API - see the prototype in the D specs on the previous chart). Then we get access to the User Space by getting an address using the Ptr2UsrSpc prototype (QUSPRTUS API). Note that the address obtained is placed into the basing pointer for the DS. Copyright Partner400, APIs from RPG - Page: 29-30

16 Example of a "List Type" API To illustrate using list APIs, we will look at QBNLPGMI List module information for ILE programs There are several formats of data available Think of a format as analogous to a record format We are using only one format: PGML0100 The layout for each format is documented in the API manual(s) Our program will create a module cross-reference database file for all the ILE programs in a library To shorten the code, our example assumes the User Space already exists List APIs place data into a user space Data begins with the Header Block of information It contains the status of the list, the number of entries retrieved, length of each entry, offset to the beginning of the first entry, etc. Using this information, your program can set a pointer to the first entry After processing an entry, increment pointer by the length of the entry to advance to the next one The following pages show a coded example of using the List ILE Program API. Our sample program simply writes the module information to a DB file to provide a module cross-reference database file. Note that we pass a parameter to the program which is the name of the library for which we want to capture module information. Special values such as *ALLUSER, *LIBL, etc. are allowed as well as a specific library name. Of course, with a bit of extra logic, we could have allowed multiple library names, etc. The program collects data for all the modules for all the ILE programs in the requested library or libraries. We are collecting a subset of the data available in the API format in our sample program. The field names in the externally described DB file match the field names in the ListItems data structure. Therefore, after setting the pointer for each entry, we simply need to write the data base record. Copyright Partner400, APIs from RPG - Page: 31-32

17 Prototyping QBNLPGMI The API documentation for QBNLPGMI is included below: List ILE Program Information (QBNLPGMI) API Required Parameter Group: 1 Qualified user space name Input Char(20) 2 Format name Input Char(8) 3 Qualified ILE program name Input Char(20) 4 Error Code I/O Char(*) D ListPgmInf PR ExtPgm('QBNLPGMI') D UsrSpcNam 20A Const D Format 8A Const D QualPgmName 20A Const D ErrorFeedbk Like(ErrorInfo) The API documenation for the parameters for QBNLPGMI and the RPG translation for those parameters are shown here. On the following pages, we will see this prototype in use, along with the User Space API prototypes. Copyright Partner400, APIs from RPG - Page: 33-34

18 Documentation for Format PGML0100 Offset Dec Offset Hex Type 0 0 CHAR(10) Program name Field 10 A CHAR(10) Program library name CHAR(10) Bound module name 30 1E CHAR(10) Bound module library name CHAR(10) Source file name CHAR(10) Source file library name 60 3C CHAR(10) Source file member name CHAR(10) Module attribute CHAR(13) Module creation date and time 93 5D CHAR(13) Source file updated date and time 106 6A CHAR(10) Sort sequence table name CHAR(10) Sort sequence table library name 126 7E CHAR(10) Language identifier BINARY(4) Optimization level A subset of the API documenation for the information in the format we're going to use with the QBNLPGMI is shown here. Format PGML0100 contains much more data than is shown here. We're just providing a glimpse at what the format documentation looks like. In addition to defining more information that is available via PGML0100 format, there are 5 other different formats of information available from this API. We could decide to retrieve other information from the other formats if we wanted to. Copyright Partner400, APIs from RPG - Page: 35-36

19 Module Cross-Reference * Copyright Partner400, * Sample code only -- no warranties expressed or implied FXrefModuleO E DISK D Ptr2UsrSpc PR ExtPgm('QUSPTRUS') D UsrSpcName 20 Const D PtrToUsrSpc * D ErrorFeedbk Like(ErrorInfo) D ListPgmInf PR ExtPgm('QBNLPGMI') D UsrSpcNam 20A Const D Format 8A Const D QualPgmName 20A Const D ErrorFeedbk Like(ErrorInfo) D QualPgmName DS D Program 10A Inz('*ALL') D Library 10A D ErrorInfo DS * Definition of the ErrorInfo DS will be shown in a later chart D LibName S 10A D I S 10I 0 Here you see the prototypes for the necessary system APIs to build the module cross-reference file. API QBNLPGMI is the "Get ILE Program information" API. We are assuming here that the User Space object has already been created. We are simply filling it (or re-filling it for update purposes). The ErrorInfo data structure is a standard error feedback mechanism that is used by most of the list type APIs. For space reasons on this chart, it is not shown here, but we will see it in detail on a later chart. Copyright Partner400, APIs from RPG - Page: 37-38

20 Module Cross-Reference (Cont.) As noted in the source, we are only using some of the fields available in format PGML0100 See the API documentation for details of other fields available D HeaderInfo DS Based(pHeaderInfo) D 103A D ListStatus 1A D 20A D ListOffset 10I 0 D ListSize 10I 0 D NbrEntries 10I 0 D EntryLen 10I 0 * More fields are available in this format, but not used here D ListItems DS Based(pListItems) D Pgm 10A D PgmLib 10A D Mod 10A D ModLib 10A D Srcf 10A D SrcLib 10A D SrcMbr 10A The API writes information to the User Space in 2 distinct pieces: The header information, followed by multiple entries - in this example one entry represents details for a module in an ILE program. Note that we have left several bytes in the header DS unnamed because we didn't need the information the API puts in those locations. For our program's purposes, the most important entries in the Header Information that the API puts into the user space are: The list status which will hopefully contain a "C" (for complete), which means the list of program information is both complete and correct. If it contains a "P" (for partial), it means the list information is accurate, but is not complete - probably because the user space wasn't large enough to hold the information. If it contains "I" (for incomplete), the information in the user space should NOT be used because it is not accurate - probably because of some error that occurred while creating the list. The offset to the first "real" entry in the list of program information. That is, this is the beginning of the first entry for the first module in the first program in the library we requested information about. The information in each entry is outlined in the second DS, called ListItems. Note that we have only included the first few items from the format. More info is available to us, but we selected to pay attention and collect only this information. The number of entries in the API wrote to the User Space for us. This will tell us how many entries to process in our RPG logic. The length of each entry in the list. This will help us to move our pointer from one entry to the next. Copyright Partner400, APIs from RPG - Page: 39-40

21 Module Cross-Reference (Cont.) The name of the library to be analyzed is passed in as a parameter QUSPTRUS is used to obtain a pointer to an existing User Space QBNLPGMI is then used to fill that space with module information The List Offset value from the fixed portion of the data returned is used to set the basing pointer plistitems to the first entry in the list C *Entry Plist C Parm Library * Get pointer to user space (assume user space already exists) C CallP Ptr2UsrSpc ('MODULEINFOQTEMP': pheaderinfo: C ErrorInfo ) * Populate User Space with *PGM Module Info with API QBNLPGMI C CallP ListPgmInf ('MODULEINFOQTEMP': 'PGML0100': C QualPgmName: ErrorInfo ) * Position plistitems pointer to first entry in User Space * using ListOffset from Header information C Eval plistitems = pheaderinfo + ListOffset In this example, for simplicity, we assume the User Space already exists. We just need to get a pointer to it by calling the API QUSPTRUS. We could use the QUSCRTUS API (prototype for it was included earlier) to create one if it did not exist. Next we need to ask the API to dump information into the User Space for the programs we're interested in. The programs we want were passed to us as input parameters. Then, using the List Offset value from the Header information in the User Space, we set the pointer to the Data Structure for the first entry in the list. Copyright Partner400, APIs from RPG - Page: 41-42

22 Module Cross-Reference (Cont.) Relevant data from entry in the User Space is written to the database The basing pointer is then updated to point to the next entry And we loop back to process the next entry until all are processed * Process each entry in list in user space and write info to DB file C Eval I = 1 C DoW I <= NbrEntries C Write MODXREFR * Increment to next entry by adding Entry Length (from Header Info) C Eval plistitems = plistitems + EntryLen C Eval I = I + 1 C EndDo C Eval *INLR = *ON The logic to retrieve the information from the User Space is fairly simple, straightforward RPG logic. In this case, we manipulate the pointer directly to get from one "entry" in the list to the next by adding the entry length of each entry (retrieved from the Header info) to the current address of the pointer. Alternatively, we could have padded the ListItems Data Structure out to the maximum length and made it either a Multiple Occurrence Data Structure or a Data Structure array. In that case, we wouldn't need to add the length to the pointer as we did here. We would use either Occur or an array index value to move from one to the other. The potential danger in using this technique is that the API information could change over time - typically adding new information to the end of each list entry. So if you want to use this technique, it would be a good idea to have the program logic compare the EntryLength value to the length (preferably using %Len) of the ListItems DS. Copyright Partner400, APIs from RPG - Page: 43-44

23 Handling API Errors The "Bytes Used" field is set non zero to indicate an error The actual exception Id will have been placed in ExpID The message text is in ExcData (the first 80 characters in this case) The example below shows how we could have used this // Standard API Error Structure D ErrorInfo DS D BytesAv 10U 0 Inz(%Size(ErrorInfo)) D BytesUsed 10U 0 D ExpID 7A D Reserved 1A D ExcData 80A // Try to obtain pointer to User Space CallP Ptr2UsrSpc ('MODULEINFOQTEMP': pheaderinfo: ErrorInfo ); If BytesUsed <> 0; // Error - Assume means not found, so create it CallP CrtUsrSpc ('MODULEINFOQTEMP' :'DTA' : : '*' : '*ALL' : 'ILE Program Info': '*YES' : ErrorInfo); CallP Ptr2UsrSpc ('MODULEINFOQTEMP': pheaderinfo: ErrorInfo ); EndIf; Many system APIs use this same data structure for error feedback. Check the BytesUsed field for > 0 to see if an error occurred. If it did, then we can check the exception ID and/or message text. We used /Free form in this example because it occupies so much less space, it gives us the ability to get a more complete example on the chart. Note that if you prefer to just let the system API send an escape message rather than monitor for and handle it yourself, you may just pass a value of 0 (zero) in the first parameter (BytesAv in our example). Replace our Inz(%Size(ErrorInfo)) with Inz(0). Copyright Partner400, APIs from RPG - Page: 45-46

24 List API Conclusions That's it! List APIs all work using the same techniques we have discussed here You simply need to know how to: Find the right API Read/interpret the API documentation and translate it into: RPG prototypes for the APIs, and Data definitions for the list items Defined a based variable or DS (based on a pointer) Create a User Space object and get access to it via a pointer in your program Define the generic List API header DS They all have the same header information and format Manipulate the basing pointer to the List Items Position to the first entry, then move through the list by adding the entry length each time Detect errors that may occur when calling APIs Via the error feedback structure and the List Status field in the list API header And we've covered all that So go find the list API you need and you should be able to use it! That's All Folks! Questions? Copyright Partner400, APIs from RPG - Page: 47-48

ILE Essentials, Part 1 Static Binding and Service Programs

ILE Essentials, Part 1 Static Binding and Service Programs ILE Essentials, Part 1 Static Binding and Service Programs Susan Gantner susan.gantner@partner400.com www.partner400.com SystemiDeveloper.com Your partner in IBM i Education In this session, we will take

More information

A Modern Programmers Tool Set: CODE

A Modern Programmers Tool Set: CODE A Modern Programmers Tool Set: CODE OCEAN Technical Conference Catch the Wave Susan M. Gantner Partner400 susan.gantner @ partner400.com www.partner400.com Your partner in AS/400 and iseries Education

More information

RPG IV Subprocedure Basics

RPG IV Subprocedure Basics RPG IV Subprocedure Basics Jon Paris & Susan Gantner jon.paris@partner400.com susan.gantner@partner400.com www.partner400.com SystemiDeveloper.com Your partner in System i Education The author, Susan Gantner,

More information

Procedures and Parameters

Procedures and Parameters Procedures and Parameters The Inside Story with Bob Cozzi What are Procedures SubProcedure can be a function or a procedure They can accept parameters and returns values Functions Subprocedures that return

More information

RPG Subprocedures Basics

RPG Subprocedures Basics RPG Subprocedures Basics Susan Gantner susan.gantner@partner400.com www.partner400.com SystemiDeveloper.com Your partner in IBM i Education Susan doesn t code subroutines any more. In her opinion, subprocedures

More information

Vendor: IBM. Exam Code: Exam Name: ILE RPG Programmer. Version: Demo

Vendor: IBM. Exam Code: Exam Name: ILE RPG Programmer. Version: Demo Vendor: IBM Exam Code: 000-972 Exam Name: ILE RPG Programmer Version: Demo Questions: 1 Which of the following operation codes is supported in both fixed form and /Free form? A. CALL B. EVALR C. ALLOC

More information

RPG IV Subprocedures Basics

RPG IV Subprocedures Basics RPG IV Subprocedures Basics Jon Paris Jon.Paris@Partner400.com www.partner400.com Your Partner in AS/400 and iseries Education Partner400, 2002-2003 Unit 6 - Subprocedures Basics - Page 1-2 What is a Subprocedure?

More information

Exceptions! Users can t live with em Programmers can t live without em. i want stress-free IT. i want control. i want an i IBM Corporation

Exceptions! Users can t live with em Programmers can t live without em. i want stress-free IT. i want control. i want an i IBM Corporation Exceptions! Users can t live with em Programmers can t live without em Barbara Morris IBM i want stress-free IT. i want control. Agenda Why exceptions are good for you (yes, they are) Exception handling

More information

RPG IV: Subprocedures Beyond the Basics

RPG IV: Subprocedures Beyond the Basics RPG IV: Subprocedures Beyond the Basics Techniques to Leverage Subprocedures OEAN Technical onference atch the Wave Jon Paris jon.paris@partner400.com www.partner400.com Your Partner in AS/400 and iseries

More information

"Instant" Web Services and Stored Procedures

Instant Web Services and Stored Procedures "Instant" Web Services and Stored Procedures Jon Paris Jon.Paris @ Partner400.com www.partner400.com www.systemideveloper.com Notes Jon Paris is co-founder of Partner400, a firm specializing in customized

More information

ILE Activation Groups

ILE Activation Groups ILE Activation Groups & Binder Language Susan Gantner susan.gantner@partner400.com www.partner400.com www.systemideveloper.com Your partner in IBM i Education In this session in the ILE Essentials series,

More information

Preface to the Second Edition... xi A Note About Source Entry... xi

Preface to the Second Edition... xi A Note About Source Entry... xi Contents Preface to the Second Edition... xi A Note About Source Entry... xi Chapter 1: Pre Free-Format RPG IV... 1 RPG IV... 1 Extended Factor 2... 2 Built-in Functions... 2 Subprocedures... 3 Other Changes...

More information

INDEX. A Absolute Value of Expression (%ABS), 26, 27 activation groups for database triggers, 257, 267, 279

INDEX. A Absolute Value of Expression (%ABS), 26, 27 activation groups for database triggers, 257, 267, 279 %ABS, 26, 27 %ADDR, 26, 28-31 %CHAR, 26, 31-32 %DEC, 26, 32-34 %DECH, 26, 32-34 %DECPOS, 26, 34-35 %DIV, 26, 35-36 %EDITC, 26, 36-39 %EDITFLT, 26, 36-39 %EDITW, 26, 36-39 %ELEM, 39-40 %EOF, 26, 40-41 %EQUAL,

More information

Externally Described SQL -- An SQL iquery API

Externally Described SQL -- An SQL iquery API Externally Described SQL -- An SQL iquery API Introduced as a beta test API in SQL iquery v4r7, Externally Described SQL is a simple set of APIs that provide the ability for RPG programmers to leverage

More information

Jim Buck Phone Twitter

Jim Buck Phone Twitter Jim Buck Phone 262-705-2832 Email jbuck@impowertechnologies.com Twitter - @jbuck_impower www.impowertechnologies.com Presentation Copyright 2017 impowertechnologies.com 5250 & SEU Doesn t work anymore!

More information

RPG Does XML! New Language Features in V5R4

RPG Does XML! New Language Features in V5R4 RPG Does XML! New Language Features in V5R4 Common Europe Congress 2007 Jon Paris Jon.Paris @ Partner400.com www.partner400.com SystemiDeveloper.com Your Partner in System i Education This presentation

More information

Externally Described SQL -- An SQL iquery API

Externally Described SQL -- An SQL iquery API Externally Described SQL -- An SQL iquery API Introduced as a beta test API in SQL iquery v4r7, Externally Described SQL is a simple set of APIs that provide the ability for RPG programmers to leverage

More information

Exam Code: Exam Name: ILE RPG Programmer. Vendor: IBM. Version: DEMO

Exam Code: Exam Name: ILE RPG Programmer. Vendor: IBM. Version: DEMO Exam Code: 000-972 Exam Name: ILE RPG Programmer Vendor: IBM Version: DEMO Part: A 1: Which of the following operation codes is supported in both fixed form and /Free form? A.CALL B.EVALR C.ALLOC D.EXTRCT

More information

Change Object Description (QLICOBJD) API

Change Object Description (QLICOBJD) API Page 1 of 9 Change Object Description (QLICOBJD) API Required Parameter Group: 1 Returned library name Output Char(10) 2 Object and library name Input Char(20) 3 Object type Input Char(10) 4 Changed object

More information

This is a sample chapter from Brad Stone s training e-rpg Powertools Stone on CGIDEV2 Get your copy of this important training now.

This is a sample chapter from Brad Stone s training e-rpg Powertools Stone on CGIDEV2 Get your copy of this important training now. Stone on CGIDEV2 This is a sample chapter from Brad Stone s training e-rpg Powertools Stone on CGIDEV2 Get your copy of this important training now. With Stone on CGIDEV2 RPG programmers quickly learn

More information

Processing and Creating JSON from RPG

Processing and Creating JSON from RPG Processing and Creating JSON from RPG Jon Paris Jon.Paris @ Partner400.com www.partner400.com www.systemideveloper.com About Me: I am the co-founder of Partner400, a firm specializing in customized education

More information

Test Driven Development Best practices applied to IBM i with the assistance of tooling. Barbara Morris RPG compiler lead Edmund Reinhardt RDi lead

Test Driven Development Best practices applied to IBM i with the assistance of tooling. Barbara Morris RPG compiler lead Edmund Reinhardt RDi lead Test Driven Development Best practices applied to IBM i with the assistance of tooling Barbara Morris RPG compiler lead Edmund Reinhardt RDi lead The Vision IBM i developers are able to confidently change

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays

CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays C Arrays This handout was written by Nick Parlante and Julie Zelenski. As you recall, a C array is formed by laying out all the elements

More information

RPG Samples for Rendezvous

RPG Samples for Rendezvous 1 RPG Samples for Rendezvous The Rendezvous installation package for IBM i includes ILE RPG samples (source files and executables). The samples tibrvlisten.rpgle and tibrvsend.rpgle parallel the functionality

More information

Garbage Collection (1)

Garbage Collection (1) Coming up: Today: Finish unit 6 (garbage collection) start ArrayList and other library objects Wednesday: Complete ArrayList, basics of error handling Friday complete error handling Next week: Recursion

More information

ERserver. User Interface Manager APIs. iseries. Version 5 Release 3

ERserver. User Interface Manager APIs. iseries. Version 5 Release 3 ERserver iseries User Interface Manager APIs Version 5 Release 3 ERserver iseries User Interface Manager APIs Version 5 Release 3 Note Before using this information and the product it supports, be sure

More information

13 File Structures. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

13 File Structures. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to: 13 File Structures 13.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define two categories of access methods: sequential

More information

Annotation Annotation or block comments Provide high-level description and documentation of section of code More detail than simple comments

Annotation Annotation or block comments Provide high-level description and documentation of section of code More detail than simple comments Variables, Data Types, and More Introduction In this lesson will introduce and study C annotation and comments C variables Identifiers C data types First thoughts on good coding style Declarations vs.

More information

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction CS106L Spring 2009 Handout #21 May 12, 2009 static Introduction Most of the time, you'll design classes so that any two instances of that class are independent. That is, if you have two objects one and

More information

V5R3 CL Enhancements. Larry Bolhuis Arbor Solutions, Inc.

V5R3 CL Enhancements. Larry Bolhuis Arbor Solutions, Inc. V5R3 CL Enhancements Larry Bolhuis Arbor Solutions, Inc. lbolhuis@arbsol.com CL Command Enhancements There have been new and changed IBM CL commands in EVERY release For V5R3: 57 new CL commands 247 changed

More information

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration Who am I? I m a python developer who has been working on OpenStack since 2011. I currently work for Aptira, who do OpenStack, SDN, and orchestration consulting. I m here today to help you learn from my

More information

Here's how you declare a function that returns a pointer to a character:

Here's how you declare a function that returns a pointer to a character: 23 of 40 3/28/2013 10:35 PM Violets are blue Roses are red C has been around, But it is new to you! ANALYSIS: Lines 32 and 33 in main() prompt the user for the desired sort order. The value entered is

More information

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!   We offer free update service for one year PASS4TEST IT Certification Guaranteed, The Easy Way! \ http://www.pass4test.com We offer free update service for one year Exam : 000-972 Title : ILE RPG Programmer Vendors : IBM Version : DEMO Get Latest

More information

An Introduction to SQL for System i. A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE

An Introduction to SQL for System i. A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE An Introduction to SQL for System i A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE Quote heard from IBM at a Conference 80% of everything you will need to know three years

More information

3/7/2018. Sometimes, Knowing Which Thing is Enough. ECE 220: Computer Systems & Programming. Often Want to Group Data Together Conceptually

3/7/2018. Sometimes, Knowing Which Thing is Enough. ECE 220: Computer Systems & Programming. Often Want to Group Data Together Conceptually University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Structured Data in C Sometimes, Knowing Which Thing is Enough In MP6, we

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

Pointers in C/C++ 1 Memory Addresses 2

Pointers in C/C++ 1 Memory Addresses 2 Pointers in C/C++ Contents 1 Memory Addresses 2 2 Pointers and Indirection 3 2.1 The & and * Operators.............................................. 4 2.2 A Comment on Types - Muy Importante!...................................

More information

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships Instructor: Craig Duckett Lecture 04: Thursday, April 5, 2018 Relationships 1 Assignment 1 is due NEXT LECTURE 5, Tuesday, April 10 th in StudentTracker by MIDNIGHT MID-TERM EXAM is LECTURE 10, Tuesday,

More information

EIDR: ID FORMAT. Ver January 2012

EIDR: ID FORMAT. Ver January 2012 EIDR: ID FORMAT Ver. 1.02 30 January 2012 Copyright 2012 by the Entertainment ID Registry Association EIDR: ID Format. The content of this manual is furnished for information use only and is subject to

More information

Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin

Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Types are probably the hardest thing to understand about Blitz Basic. If you're using types for the first time, you've probably got an uneasy

More information

Game keystrokes or Calculates how fast and moves a cartoon Joystick movements how far to move a cartoon figure on screen figure on screen

Game keystrokes or Calculates how fast and moves a cartoon Joystick movements how far to move a cartoon figure on screen figure on screen Computer Programming Computers can t do anything without being told what to do. To make the computer do something useful, you must give it instructions. You can give a computer instructions in two ways:

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

Section Notes - Week 1 (9/17)

Section Notes - Week 1 (9/17) Section Notes - Week 1 (9/17) Why do we need to learn bits and bitwise arithmetic? Since this class is about learning about how computers work. For most of the rest of the semester, you do not have to

More information

A Quick Introduction to IFF

A Quick Introduction to IFF A Quick Introduction to IFF Jerry Morrison, Electronic Arts 10-17-88 IFF is the Amiga-standard "Interchange File Format", designed to work across many machines. Why IFF? Did you ever have this happen to

More information

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;

More information

CS102: Variables and Expressions

CS102: Variables and Expressions CS102: Variables and Expressions The topic of variables is one of the most important in C or any other high-level programming language. We will start with a simple example: int x; printf("the value of

More information

3. Simple Types, Variables, and Constants

3. Simple Types, Variables, and Constants 3. Simple Types, Variables, and Constants This section of the lectures will look at simple containers in which you can storing single values in the programming language C++. You might find it interesting

More information

CS 161 Computer Security

CS 161 Computer Security Wagner Spring 2014 CS 161 Computer Security 1/27 Reasoning About Code Often functions make certain assumptions about their arguments, and it is the caller s responsibility to make sure those assumptions

More information

Chapter 3 EXPRESSIONS

Chapter 3 EXPRESSIONS Chapter 3 EXPRESSIONS EXPRESSIONS in RPG 97 NATURAL EXPRESSIONS 97 Priority of Operators 99 Expression Continuation 100 Expressions in Assignment Statements 100 Expressions in Compare Statements 102 Expressions

More information

Variables and Data Representation

Variables and Data Representation You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented

More information

Basic Types, Variables, Literals, Constants

Basic Types, Variables, Literals, Constants Basic Types, Variables, Literals, Constants What is in a Word? A byte is the basic addressable unit of memory in RAM Typically it is 8 bits (octet) But some machines had 7, or 9, or... A word is the basic

More information

There are functions to handle strings, so we will see the notion of functions itself in little a detail later. (Refer Slide Time: 00:12)

There are functions to handle strings, so we will see the notion of functions itself in little a detail later. (Refer Slide Time: 00:12) Programming Data Structures, Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module - 13b Lecture - 19 Functions to handle strings;

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

Variable A variable is a value that can change during the execution of a program.

Variable A variable is a value that can change during the execution of a program. Declare and use variables and constants Variable A variable is a value that can change during the execution of a program. Constant A constant is a value that is set when the program initializes and does

More information

Chapter 2: Number Systems

Chapter 2: Number Systems Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

More information

SYSTEM 2000 Essentials

SYSTEM 2000 Essentials 7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical

More information

Pointer Casts and Data Accesses

Pointer Casts and Data Accesses C Programming Pointer Casts and Data Accesses For this assignment, you will implement a C function similar to printf(). While implementing the function you will encounter pointers, strings, and bit-wise

More information

IBM ILE RPG Programmer. Download Full Version :

IBM ILE RPG Programmer. Download Full Version : IBM 000-972 ILE RPG Programmer Download Full Version : http://killexams.com/pass4sure/exam-detail/000-972 Answer: A QUESTION: 61 A programmer has just converted a subroutine to a subprocedure. When compiling

More information

Lab 5 - Linked Lists Git Tag: Lab5Submission

Lab 5 - Linked Lists Git Tag: Lab5Submission UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE-13/L: COMPUTER SYSTEMS AND C PROGRAMMING WINTER 2016 Lab 5 - Linked Lists Git Tag: Lab5Submission Introduction This lab

More information

COMP-202 Unit 7: More Advanced OOP. CONTENTS: ArrayList HashSet (Optional) HashMap (Optional)

COMP-202 Unit 7: More Advanced OOP. CONTENTS: ArrayList HashSet (Optional) HashMap (Optional) COMP-202 Unit 7: More Advanced OOP CONTENTS: ArrayList HashSet (Optional) HashMap (Optional) Managing a big project Many times, you will need to use an Object type that someone else has created. For example,

More information

System i CGI Toolkits

System i CGI Toolkits System i CGI Toolkits Bradley V. Stone Topics Where to Start What You Need to Know Toolkit Concepts How Does a Toolkit Help Me? Toolkit Functionality The Template and Substitution Variables The Toolkit

More information

Memory Addressing, Binary, and Hexadecimal Review

Memory Addressing, Binary, and Hexadecimal Review C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

iseries Job Attributes

iseries Job Attributes iseries Job Attributes iseries Job Attributes Copyright ternational Business Machines Corporation 5. All rights reserved. US Government Users Restricted Rights Use, duplication or disclosure restricted

More information

IBM Software Technical Document

IBM Software Technical Document Page 1 of 5 IBM Software Technical Document Document Information Document Number: 19175649 Functional Area: Host Servers Subfunctional Area: File Server Sub-Subfunctional Area: General OS/400 Release:

More information

Programming Object APIs

Programming Object APIs System i Programming Object APIs Version 6 Release 1 System i Programming Object APIs Version 6 Release 1 Note Before using this information and the product it supports, read the information in Notices,

More information

Assignment 1: grid. Due November 20, 11:59 PM Introduction

Assignment 1: grid. Due November 20, 11:59 PM Introduction CS106L Fall 2008 Handout #19 November 5, 2008 Assignment 1: grid Due November 20, 11:59 PM Introduction The STL container classes encompass a wide selection of associative and sequence containers. However,

More information

About the Authors. Preface

About the Authors. Preface Contents About the Authors Acknowledgments Preface iv v xv 1: Introduction to Programming and RPG 1 1.1. Chapter Overview 1 1.2. Programming 1 1.3. History of RPG 2 1.4. Program Variables 6 1.5. Libraries,

More information

Invasion of APIs and the BLOB,

Invasion of APIs and the BLOB, Invasion of APIs and the BLOB, or how I learned to stop worrying and love the acronym. By Eamonn Foley Senior Programmer Analyst Who I Am 15+ Years in Synon/2e DBA, Architect, Developer, Instructor, Consultant,

More information

AO IBM i Advanced Modernization Workshop Curriculum

AO IBM i Advanced Modernization Workshop Curriculum AO IBM i Advanced Modernization Workshop Curriculum This workshop is intended to provide the IBM i professional, specifically the RPG programmer, with an overview of the newest capabilities which have

More information

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto Side Effects The 5 numeric operators don't modify their operands Consider this example: int sum = num1 + num2; num1 and num2 are unchanged after this The variable sum is changed This change is called a

More information

Linked Lists. What is a Linked List?

Linked Lists. What is a Linked List? Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the

More information

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so!

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices

More information

EIDR: ID FORMAT Ver. 1.1 August 19, 2013

EIDR: ID FORMAT Ver. 1.1 August 19, 2013 EIDR: ID FORMAT Ver. 1.1 August 19, 2013 Copyright by the Entertainment ID Registry Association EIDR: ID Format. The content of this manual is furnished for information use only and is subject to change

More information

A variable is a name for a location in memory A variable must be declared

A variable is a name for a location in memory A variable must be declared Variables A variable is a name for a location in memory A variable must be declared, specifying the variable's name and the type of information that will be held in it data type variable name int total;

More information

12. Pointers Address-of operator (&)

12. Pointers Address-of operator (&) 12. Pointers In earlier chapters, variables have been explained as locations in the computer's memory which can be accessed by their identifer (their name). This way, the program does not need to care

More information

CS367 Test 1 Review Guide

CS367 Test 1 Review Guide CS367 Test 1 Review Guide This guide tries to revisit what topics we've covered, and also to briefly suggest/hint at types of questions that might show up on the test. Anything on slides, assigned reading,

More information

Radix Searching. The insert procedure for digital search trees also derives directly from the corresponding procedure for binary search trees:

Radix Searching. The insert procedure for digital search trees also derives directly from the corresponding procedure for binary search trees: Radix Searching The most simple radix search method is digital tree searching - the binary search tree with the branch in the tree according to the bits of keys: at the first level the leading bit is used,

More information

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis Handout written by Julie Zelenski with edits by Keith Schwarz. The Goal In the first programming project, you will get

More information

Create Table Like, But Different. By Raymond Everhart

Create Table Like, But Different. By Raymond Everhart reate Table Like, But Different By Raymond Everhart reate Table Like, But Different Author: Raymond Everhart As iseries programmers explore the use of embedded SQL in their applications, the natural tendency

More information

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018 Pointer Basics Lecture 13 COP 3014 Spring 2018 March 28, 2018 What is a Pointer? A pointer is a variable that stores a memory address. Pointers are used to store the addresses of other variables or memory

More information

Brian May IBM i Modernization Specialist Profound Logic Software. Webmaster and Coordinator Young i Professionals

Brian May IBM i Modernization Specialist Profound Logic Software. Webmaster and Coordinator Young i Professionals Brian May IBM i Modernization Specialist Profound Logic Software Webmaster and Coordinator Young i Professionals Overview Discuss advantages of using data structures for I/O operations Review the I/O opcodes

More information

Have examined process Creating program Have developed program Written in C Source code

Have examined process Creating program Have developed program Written in C Source code Preprocessing, Compiling, Assembling, and Linking Introduction In this lesson will examine Architecture of C program Introduce C preprocessor and preprocessor directives How to use preprocessor s directives

More information

Oracle. Engagement Cloud Using Service Request Management. Release 12

Oracle. Engagement Cloud Using Service Request Management. Release 12 Oracle Engagement Cloud Release 12 Oracle Engagement Cloud Part Number E73284-05 Copyright 2011-2017, Oracle and/or its affiliates. All rights reserved. Author: Joseph Kolb This software and related documentation

More information

CvtRPGIV S. 160 th St. Ste. #401 Omaha, NE Telephone: (402) Toll free: (800)

CvtRPGIV S. 160 th St. Ste. #401 Omaha, NE Telephone: (402) Toll free: (800) CvtRPGIV By 2809 S. 160 th St. Ste. #401 Omaha, NE 68130 Telephone: (402) 697-7575 Toll free: (800) 228-6318 Web: http://www.prodatacomputer.com Email Sales: sales@prodatacomputer.com Email Tech Support:

More information

(C) Copyright. Andrew Dainis =============================================================================

(C) Copyright. Andrew Dainis ============================================================================= (C) Copyright. Andrew Dainis ============================================================================= The C3D data file format was developed by Andrew Dainis in 1987 as a convenient and efficient

More information

Slide 1 CS 170 Java Programming 1 Expressions Duration: 00:00:41 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Expressions Duration: 00:00:41 Advance mode: Auto CS 170 Java Programming 1 Expressions Slide 1 CS 170 Java Programming 1 Expressions Duration: 00:00:41 What is an expression? Expression Vocabulary Any combination of operators and operands which, when

More information

Programming Virtual Terminal APIs

Programming Virtual Terminal APIs System i Programming Virtual Terminal APIs Version 6 Release 1 System i Programming Virtual Terminal APIs Version 6 Release 1 Note Before using this information and the product it supports, read the information

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Brewing Mixed Java and RPG Applications

Brewing Mixed Java and RPG Applications Brewing Mixed Java and RPG Applications Yet More Things You Can o With Prototypes! Jon Paris Jon.Paris @ Partner400.com www.partner400.com Your Partner in AS/400 and iseries Education Agenda Syntax Extensions

More information

ECMA-119. Volume and File Structure of CDROM for Information Interchange. 3 rd Edition / December Reference number ECMA-123:2009

ECMA-119. Volume and File Structure of CDROM for Information Interchange. 3 rd Edition / December Reference number ECMA-123:2009 ECMA-119 3 rd Edition / December 2017 Volume and File Structure of CDROM for Information Interchange Reference number ECMA-123:2009 Ecma International 2009 COPYRIGHT PROTECTED DOCUMENT Ecma International

More information

Operator overloading

Operator overloading 1 Introduction 2 The copy constructor 3 Operator Overloading 4 Eg 1: Adding two vectors 5 The -> operator 6 The this pointer 7 Overloading = 8 Unary operators 9 Overloading for the matrix class 10 The

More information

Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few

Most of the class will focus on if/else statements and the logical statements (conditionals) that are used to build them. Then I'll go over a few With notes! 1 Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few useful functions (some built into standard

More information

,879 B FAT #1 FAT #2 root directory data. Figure 1: Disk layout for a 1.44 Mb DOS diskette. B is the boot sector.

,879 B FAT #1 FAT #2 root directory data. Figure 1: Disk layout for a 1.44 Mb DOS diskette. B is the boot sector. Homework 11 Spring 2012 File Systems: Part 2 MAT 4970 April 18, 2012 Background To complete this assignment, you need to know how directories and files are stored on a 1.44 Mb diskette, formatted for DOS/Windows.

More information

Chapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc.

Chapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc. Chapter 1 INTRODUCTION SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Different types of file access available to the programmer. How to define fields in a program. The flow of

More information

nptr = new int; // assigns valid address_of_int value to nptr std::cin >> n; // assigns valid int value to n

nptr = new int; // assigns valid address_of_int value to nptr std::cin >> n; // assigns valid int value to n Static and Dynamic Memory Allocation In this chapter we review the concepts of array and pointer and the use of the bracket operator for both arrays and pointers. We also review (or introduce) pointer

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

If Statements, For Loops, Functions

If Statements, For Loops, Functions Fundamentals of Programming If Statements, For Loops, Functions Table of Contents Hello World Types of Variables Integers and Floats String Boolean Relational Operators Lists Conditionals If and Else Statements

More information