If this is your first visit, be sure to check out the faq by clicking the link above. In the expandable subfile the subfile size must be at least one greater than the page size. In this chapter, you will learn step by step how to create a subfile record using sda. Pressing the function key affects the subfile containing the cursor. Started in 1959 as report program generator that copies punched cards on the ibm 1401, later evolved to pli and cobol. Generally the heading and subfile specific instructions are given here. Someone asked me if i could recommend an example simple subfile program written in rpg free. Foundation figure 1 state code subfile lookup figure 1. The rpg program s workstn fspecs define the subfile s relative record number field. Newcomers to rpg iv programming who have prior experience in c, cobol, pl1, or another freeformat language find freeformat rpg iv simple to learn and use. I use them to keep the foldunfold consistent between enter keys. There are ddsspecifications which define certain keywords to govern page initialization and positioning.
Here is a skelton program that uses dynamic sql to load up a subfile. Error message subfile rpgle applications on the iseries. However, you may define the subfile size to be less than 9999 in the record format and still load all your subfile at a time. The subfile first of all loads the data in subfile buffer. U sflclr this keyword is used to clear the records in the subfile records format. Data is always real time, most user friendly, consistent performance whether the file has 100 or 100 million records, this is the most flexible from a user and programming point of view. Advanced topics like subfiles, windows and advanced message handling are presented in this workshop. These examples can be used as reference when you design and create your online system. Subfile relative record number, page size and page. This article focuses on the typical logic flow of a subfile program, along with the coding of both the display file and the rpg400 program to control. Traditional fixedformat rpg programmers everywhere are embracing the increased productivity, better readability, and easier program maintenance that comes with the freeformat style of programming in rpg iv.
Subfiles with subfiles you can create a display file with lists of items. It can be an editable tabular format due to which it can be used in data entry screen, inquiry static screen or combination of both i. This entry was posted on saturday, may 2nd, 2009 at 6. How to create a subfile program without using any native io. You can use them as your reference when creating rpg programs. As a registered member of, youre entitled to a complimentary copy of chapter 7 of subfiles in rpg iv. This chapter teaches you how to write an online rpg program using subfile record. Creating a screenatatime subfile program in modern rpg. Example rpg program using a physical, display, and printer file. The reason that you are having the problem is because the program is using rrn field as relative record of subfile sfileformat.
Rrn is linked to the subfile in the rpg program with a continuation fspec. Inputoutput using free format most input and output functions are the same in freeformat rpg iv as in fixed format except for the location of the code within the source line. The source for the display file and the product file used in the example follow the rpg source. Once the records are available to the subfile, you use the format 5 read statement to read a specified record from the subfile transaction file. To take advantage of these control fields for new subfile programming, in addition to other fields related to the programming logicpattern established to use these fields, the following copy member is created to be copied into all subfile programs so that they are included during the programs compile phase. Rules, examples, techniques, and other cool stuff enter your mobile number or email address below and well send you a link to download the free kindle app. Makes it trivial to add sorting capability to the subfile and doesnt suffer from the where did that record go. Rpg iii language uses the original program model opm runtime environment, whereas the rpg iv language has. After a few minutes of googling most of the examples i found were in rpgiii, a few were in fixed format rpgle, and a couple had free format calculations. During d subfile loading, s1rrn is to be incremented by one for each subfile d record written. Sorting data is something rpg programs often need to do. Application development toolset plus for as400 offers the easiest, most productive, and most costeffective tools for. Basic coding figure 5 rpg program code indicator usage. This means that you load only one page of data into your subfile and you control roll up and roll back.
When you read the subfile record, the system change the rrn to t. Thanks bryce martin programmeranalyst i 5705464777 jerry c. It is referenced in the section of the rpg template labeled. The list of members that you can see in the pdm is an example of a subfile. Displaying the data from subfile buffer to the display device. Essentials of subfile programming and advanced topics in rpg essentials of subfile programming and advanced topics in rpg iv rpg ii, rpg iii, and rpg 400 with business applications 2nd edition rpg ii, rpg iii and rpg 400 the shellycashman series rpg programming success in a day. Indicators allow us to manipulate the status of the subfile from the rpg code. Initially the only the first one page of the subfile is loaded. Unlimited ebook acces essentials of subfile programming and advanced topics in rpg iv full ebook essentials of subfile programming and advanced topics in rpg ivacces here essentials of subfile programming and advanced topics in rpg ivessentials of subfile programming and advanced topics in rpg iv any file,essentials of subfile programming. The rpg program uses the subfile record format to read a subfile, write new records to a subfile, and update the subfile. Sfldrop can be specified on the same subfile control record format as the sflfold keyword. As neil points out, fields named or constant in the control record all have to appear either above or below the subfile area. Aug 05, 2012 deject d d recommended indicator usage for display files d d d indicator description d d 01 turns off the overlay when writing msgct d 10 subfile record dspatrhi d 20 subfile foldunfold mode d 21 subfile 1 end and enable rollup key d 22 subfile 2 end and enable rollup key d 23 subfile 3 end and enable rollup key d 24 subfile 4 end and.
Essentials of subfile programming and advanced topics in rpg iv 9781583040515. The operation is processed for the program device identified in the fieldname specified using the devid keyword in the file specification. Sending your own program created messages to the error subfile. Fixed format and free format rpg iv are taught in this class with the. Some basic rpg programming experience is recommended. How to create a subfile program without using any native io operations. The question should be, can you display a subfile at the same time as another record format. The subfile relative record number only needs to be two numeric as the subfile size is only 10 see when i describe the subfile. If your program sets off the indicator for sflend when displaying the subfile, either the plus sign, the more text, or the scroll bar with the scroll box one page size. That is, im sure that its possible to change the value of a variable that holds the rrn. Below is a copymember to be used by the interactive programs. When there are some active records on the subfile and we want to clear that to write a new record then we can issue an output operation on the screen with sflclr on and then can write the new records. Levinsonaccess books essentials of subfile programming and advanced topics in rpg full access.
Chapter 1 the specifics on subfiles 9 of the time, you can change the characteristics of a subfile program without having to modify the rpg code driving it. Best practice for displaying an empty subfile ahh yes. Id be interested in seeing code that could change the rrn of a subfile record. How to create basic load all subfile in as400 ibm i. Subfile page d loading is performed with a doloop at which time s1line is zero. Today, freeformat calculations in rpg iv can look like any other modern programming language. This view explains the basic steps to create your first load all sub file in as400 ibm i. Reads postoptimal analyses, parametric programming and related topics free books. A subfile is nothing but just displaying records in tabular format on a display device. Rpg and rpg ii programming, applied fundamentals a job approach to learning, william e.
A load all subfile is one in which we generally specify the subfile size as 9999 in the record format itself. Now, this popular manual has been updated from beginning to end to teach subfile concepts and programming techniques. Reading books essentials of subfile programming and advanced. The code accompanying this article is available for download here. For each record added to the subfile, field rrn is incremented by 1. Essentials of subfile programming and advanced topics in. One more substantial difference introduced in free format is the use of alternatives to a key list in database i0 for chain, set, and similar operations. About for books essentials of subfile programming and. Introduction to rpg400 programming workshop rg15 5 days 40% lecture, 60% workshop this class provides an introduction to rpg400 programming on the ibm system i as400. To take advantage of these control fields for new subfile programming, in addition to other fields related to the programming logicpattern established to use these fields, the following copy member is created to be copied into all subfile programs so that they are included during the program s compile phase. Rpg subfiles pdf this next technique came to me when i was asked to create a subfile applica tion that works. A 1 26 customer display a dspatrri a 2 02f1exit a 4 02id a dspatrul a 4 10customer name a dspatrul the source code with explanation of the ile rpg program to process the load all subfile.
They have the additional responsibility to inform the user about the state of the data being accessed or about an event which took place when manipulating the data. They have the additional responsibility to inform the user about the state. Nov 27, 2016 one technique that i have used in the past and is even easier with the size increases of v6 is to use a load all approach but to store the subfile record images in memory. A subfile is a display file where you can place a listing of values and process changes on the list. Ile rpg, provides a modern programming environment. But the real fun begins when you combine the features. In the program logic, there are certain principles that govern the type of logic required to ensure the values of the control fields work to produce a properly functioning subfile. This is done in the file specifications with a file kontinuation line.
The ddsthe same as it ever was before i get to the rpg, i need to say a few things about the dds and cl. I am sure that my examples are not the way all other ibm i developers would write theirs. This section lists some of the dds source codes as examples, including database files, dspf and subfile. Rpg and programming blog archive subfiles in rpgiv and me. There are probably as many ways to write a subfile. As400 programming languages and application development tools offers a rich set of tools to create new clientserver applications on the host or workstation. We must first identify to the rpg program the fact that there is a subfile in this display file. Chain, readc, update, or write operation codes can be used for subfile record format to transfer data between the program and the subfile. The sflcsrrrn keyword loads a fivedigit hidden field with the relative record number of the subfile record upon which the cursor is located. O ile rpg for as400 programmers guide version 4 sc09250702.
Like every other programming language, it has its keywords, variables, data types and more. If the cursor is not positioned in a subfile, the function key affects the upper subfile. You can follow any responses to this entry through the rss 2. This is the dds for the display file to list the customers. If the program device is not specified, the device used in. Controlling subfiles there are several areas of programming which make up a successful subfile program. To use a subfile for a display device file in an rpg program, you must specify the sfile keyword on a file description specification for the workstn file. Adams rpg for as400 programmers guide version 4 sc09250702. The answer is yes, but there are some things to consider. Dec 05, 2010 creating a copy member for systemwide use.
Youll need to use two keywords in the subfile control format. For multiple device files, specify a subfile record format as the name operand. Cl, dds, and rpg that make this work at the end of this chapter. International technical support organization who knew you could do that with rpg iv. Best practice for displaying an empty subfile rpg400l. Unlike database files, subfiles can store data in hidden fieldsfields that will not be displayed but can be used when you process the file. Now, this popular manual has been updated from beginning to end to teach subfile concepts and programming techniques using freeformat rpg. Redisplaying the first page of a subfile is a major annoyance to users. The program needs to identify the subfile within the display file. Rules, examples, techniques, and other cool stuff written by kevin vandever and published by mc press. The rpg program s workstn fspecs define the subfiles relative record number field. Modern rpg for the modern programmer december 2016 sg24540201. Load the subfile by entering a loop that reads a database record and writes it to a subfile record, using an rrn work variable. There are two main differences in my single page subfile program than many other single page subfiles on the internet.
If its just a simple single field array youre sorting in order to use the much faster binary search possible with %lookup, for example, then sorta works well and is simple. For a zip file containing all the sources, click here. This book is a complete dedication to the rpg 400 programming language and the as400 environment. Interactive programs present data to the user in an organized manner. Sflend subfile end keyword for display files ibm knowledge. Way to get the same results using rpg and subfile processing. On their own, each feature is simple to code in an rpg subfile program. Once i added the overlay to the footer it worked fine. They are real production programs including a customer inquiry program, a customer maintenance program and a customer order inquiry subfile program. I was writing a footer before exfmt of the control record. Introduction to cl programming ibm i as400 for beginners duration. Rules, examples, techniques, and other cool stuff, this updated and expanded work is brought up to the present with freeformat rpg examples and other new material.
The ile rpg program to process an expandable subfile has typically the following flow. This is the full source code for the subfile sort program that appeared in the may 2004 issue of the iseries extra newsletter. Use screen design aid to create and maintain display files that contain subfiles. For this application to have the necessary flexibility, the rpg program and not os400must completely control the subfile. Reading the subfile control record physically transfers records from the program device so that they can be made available to the subfile. An hll program which does all the work of pulling information from the database and moving it into the subfile. Pressing f10 rebuilds the subfile with new data and positions to the first page.
Subfile relative record number in rpgle solutions experts. To start viewing messages, select the forum that you want to visit from the selection below. You will also learn how to test subfile record using sda. Essentials of subfile programming and advanced topics in rpg iv.
Pressing f5 rebuilds the subfile with the same data and positions to the first subfile page. Pressing enter redisplays the same page of the subfile. The subfile record format control serves as a container for the fields in one row of the subfile. A subfile with paging by ibm i and highlevel language. I worked for a software development house that wanted the ibm look and feel on. Aug 05, 2012 interactive programs present data to the user in an organized manner. Find answers to using chain to access a subfile record in free format. How to create a subfile program without using any native i. Jan 23, 20 a subfile is one type of record format allowed in a display file. If the cursor is not located on a subfile record, this field is zero. Intermediate rpg iv programming workshop interactive. Notice that the s1csrrrn field is set to zero when the subfile is cleared and reloaded. Using chain to access a subfile record in free format.
Essentials of subfile programming and advanced topics in rpg. This class is intended for the rpg iv programmer who needs a better understanding of interactive programming in rpg iv. In the program logic, there are certain principles that govern the type of logic required. Kevin vandevers subfiles in rpg iv mc press, 2000 offered easytounderstand explanations of subfile concepts plus a bounty of practical examples, advanced techniques, and other cool stuff never before seen in subfile books. To view or download the pdf version of this document, select dds concepts about 1170 kb. The member is named cpysfconst and contains all constants used by the template. Your knowledge of subfiles is an important part of your professional development. In that situation the records will not be placed at contiguous memory location. This chapter, subfiles and data queues a perfect combination, looks at how to incorporate all the features in the program development manager pdm into a subfile. This bookboth learning tool and handy reference guideprovides the information you need to learn this powerful way of coding. Levinson brings his 15 years of experience as an as. This section lists three rpg online program source codes as examples. D d the s1linenbr fields are initialized differently.
Then you can start reading kindle books on your smartphone, tablet, or computer no kindle device required. If both keywords are active, the sflfold keyword is used. This was rather disappointing as rpgle is over 21 years old, free format calculations 14 years old, even free format definitions rpg is in its. You can leave a response, or trackback from your own site.
Beginners guide to fast, easy and efficient learning of rpg. When d the subfile is cleared, s1rrn should be reset to zero. This book begins with easytounderstand explanations of subfile concepts then goes on to offer a bounty of practical examples, advanced techniques, and other cool stuff never before seen in subfile books. Essentials of subfile programming and advanced topics in rpg iv teaches you to design and program subfiles, offering stepbystep instructions and realworld programming exercises that build from chapter to chapter. This line identifies a subfile record format and associates an internal rpg variable to act as its relative record number pointer. Rrn is a hidden field on the subfile control record.