The sflcsrrrn keyword loads a fivedigit hidden field with the relative record number of the subfile record upon which the cursor is located. The other keyword is sflrcdnbr, which causes the system to display the subfile page that contains a specified record. This is a utility to create subfile code for given sql select statement. If the cursor is not located on a subfile record, this field is zero. This blog talks about the expandable subfile in rpg as400. If we do not specify this keyword, first page of the subfile is displayed by default. Subfiles are specified in the dds for a display file to allow you to handle multiple records of the same type on the display. They may be used in code as long as credit is given to the original author. Loadall subfile in loadall subfile all the records are written to the subfile buffer at once and then the data in the subfile loaded from the buffer. A rolldown61 the sflrcdnbr is the subfile record number. Subfile generator for ibm i platform arehart consulting, llc. The list of members that you can see in the pdm is an example of a subfile. This helps in validating the window subfile that appears after taking option1 on the main subfile screen.
The cursor is positioned at the first inputcapable field in the subfile record. Clearing a subfile hi pete, incorrect record number in subfile sflrcdnbr or sflsiz field. I think ive tried this before, but im too busy and lazy to look right now. In single page subfile, the sflpag sflsiz in the loadall and expandable subfile, the maximum number of records that can be loaded in subfile. A subfile is defined similarly to the way you define a database file. Sflrcdnbr will give the rrn of the first record displayed on the screen at a given time. Or, to put it another way, if you select a record on the second page of the subfile the second page. Sflrcdnbr keyword example in as400, set any record of a subfile as the first record to be displayed on the screen. The subfile record number keyword, sflrcdnbr, is used to specify that the subfile record number moved to the field is displayed on the current subfile page. Its a hidden field defined inside the sflctl record format in the dspf. He was though managing page up and page down would be difficult when using sql. Areutools is a set of development tools for the as400 platform ibm i, iseries. The programs first task is to load the subfile with one page of records in this case, nine. The rrn uniquely identifies each row in your subfile.
May 20, 2003 you can read the subfile by using the chain opcode using the rrn. Dec 16, 2010 how will you display a particular page in subfile. Move a valid relative record number rrn in the field specified using sflrcdnbr keyword in dds. Foundation figure 5 rpg program xrd001rg indicators used. You can read the subfile by using the chain opcode using the rrn. Finetuning figure 4 sample horizontal subfile figure 4.
The source for the display file and the product file used in the example. The name and data type of this field has been kept same as the rrn of this subfile in the program. Rec1pf physical file used in the below program contains 1100 records. A rdctr 4s 0h sflrcdnbr cursor a 1 27simple name list. Ibm example of cobol using subfiles with userdefined data. Sflscroll subfile scroll keyword for display files ibm. If we are writing more records in the subfile buffer than the sflsiz declared and sflsiz sflsiz is extended to accommodate all records till the size of 9999.
Every time the record is written in the buffer, buffer is cleared before writing. The sflrcdnbr keyword allows os400 to know which page of data. It controls what page of the subfile is to be displayed on the device screen. Specify the pagedown keyword on the subfile control record format so that control is passed to your program when the page down key is pressed again. Subfile command links will go to the ibm site for a more detail definition. The source for the display file and the product file used in the example follow the rpg source. The following is an rpg subfile example with a selection option.
A csrrrn 4s 0h sflrcdnbr cursor this tells the subfile to display the subfile page containing the rrn that you set in csrrrn. Using this technique you will stop reading records when you reach the end of the subfile. Dec 05, 2010 posts about iseries subfile programming written by ben. Update subfile in as400 fencer services private limited. What are the three types of keywords associated with printer file. With subfiles in freeformat rpg, you will learn how to. To position to a page, specify that the page d of the subfile. In your rpglerpgiv program you have to move a value into the.
For example, you can only sort on one subfield at a time. Another keyword that might be useful is sflrcdnbr with top as a. Acb4 description iseries as400 cobol subfile programming is a selfpaced, multimedia course providing comprehensive, practical training in the design and coding of subfile programs. Hi luqman, as you have defined you subfile for size page 10 then you can simply position for a particular subfile record eval in40 on dspatrpc eval sflnxtchg indicator on update subfile record format you may also define sflrcdnbr for size. One day a friend asked me is it hard to create a single page subfile just using sql and also with a search option. I have written the below expandable subfile program where there seems to be an issue that. Input data from the dspf will be transmitted to the program. For a zip file containing all the sources, click here.
Sflrcdnbr cursor positions the cursor on the subfile record identified by d1drrn, which is the subfile rrn defined in your program. Sflrcdnbr subfile record number keyword for display files. 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. In loadall subfile if we do pagedown and then press enter on the page, bydefault enter bring the display screen to the very first page irrespective of the current page number. Sflrcdnbr subfile record number keyword for display files you use this fieldlevel keyword on the subfilecontrol record format to specify that the page of the subfile to be displayed is the page that. Sflcsrrrn keyword example in as400,subfile cursor relative record number. Ibm db2, ibm as400 rpg,cl interview preparation by ibmi classes. Example below is the display file used for the program. As400 interview questions, mainframe as400 interview. This technique is very simple and in most cases quite a fast way to sort subfile data or any other kind of repeating data.
Update the subfile record using readc the difference between chaining the subfile with rrn is that you will read all the records, providing you increment the rrn readc will only read the changed subfile unless you use sflnxtchg. This field is returned to your program as part of the input for this subfile control record. In your rpglerpgiv program you have to move a value into the sflrcdnbr field, if you do not you will get a rnq1255 session or device. How to pick up the changed records every time in a subfile after the first change made. Hi, can anybody give me real sinario for sflrcdnbr. Stack overflow for teams is a private, secure spot for you and your coworkers to find and share information. The sflrcdnbr keyword allows os400 to know which page of data to display if you from computers 101 at iit kanpur. If we do not specify this keyword, first page of the subfile. Single page subfiles ibm i, as400 and iseries rpg waffle. Depending on your file, this may not be appropriate for your situation. Subfile record format a subfile s process can be divided mainly into 3 parts. Use screen design aid to create and maintain display files that contain subfiles. In this example, either the program or the workstation user can set the value of the field before displaying the subfile. Sql simple sql simple subfile the display dspf file.
A subfile is a display file where you can place a listing of values and process changes on the list. To use a subfile for a display file in a cobol program, you must specify. Then, execute the subroutines to clear the subfile, load the subfile, and finally show the subfile. To clear the subfile, subroutine clrsf turns off indicator 50 and writes a record to the sfctl file. Subfile processing hi marvin, so i guess you have to read the subfile record in order for the subfile to be displayed at the proper position. Records in the subfile with changed input fields modified data tags will be changed after a new page is added to the subfile by the highlevel language program. This simplifies the coding and if the beginning or end of subfile reached then the o. It may be that you are confusing the relative record number rrn with the sflrcdnbr. The window subfile facilitates entry of new record on the screen. It is used to display the page having rrn value that is in the hidden field defined as a parameter of sflrcdnbr.
This field must have the keyboard shift attribute of signed numeric with zero decimal positions. Sub files in as400 handling rrn in load all sub file youtube. The sflrcdnbr keyword should be specified so the last subfile page can be displayed after it is built by the highlevel language program. Jan 24, 2010 in load all subfile if we press the page up or page down key the control will not go to the program and the o. Mastering subfiles is often the defining moment in an rpg programmers career. Hi friends, i am using a load all subfile, and currently i. Sflrcdnbr cursor top if cursor is specified, the cursor is placed in the subfile record whose relative record number is identified by the contents of this field. In this case pageup and pagedown is taken care by system. The subfile record number keyword, sflrcdnbr, is used to specify. Hi friends, i am using a load all subfile, and currently i am in in the third page of the subfile, from third page i have selected a record and called some other program.
Paul is the author of reengineering rpg legacy applications, the programmers guide to iseries navigator and the self teach course iseries navigator for. This video explains how to handle the cursor position using rrn in load all sub file type. Here we have assigned an indicator 66 for keyword sflnxtchg. Subfile records can be read, chained to, written to, or updated much like a database file, but the data is stored temporarily in memory instead of permanently on disk. Just need to use two keywords in the dds 1sflcsrrrn return the cursor position 2 sflrcdnbr cursor help to position the rrn in the subfile. A subfile is a group of records that is read from or written to a displaydevice file. The sflrcdnbr keyword provides control over which page of the subfile is displayed when the subfile is presented. The subfile record format sfl keyword defines the format of the records in the subfile as opposed to the subfile control record format sflctl keyword, which defines how the subfile can be displayed, cleared, deleted, and initialized. Seton sflnxtchg keyword indicator and update the subfile record. You can go into a standard do loop reading the records in the subfile until you are done. Nick litten dot com is a mixture of blog posts that can be sometimes. The subfile record number keyword, sflrcdnbr, is used to specify that.
Sep 17, 2002 the examples on this page are presented as is. This is used here to display the last page whenever a new page is loaded. This book gives you the concepts, styles, and advanced techniques using freeformat rpg that will enable you to become a subfile master in your own right. Displaying more than one subfile at a time i decided to write the post after being asked if i had an example of having two subfiles on the same screen. Interview question and answer as400 subfiles nick litten. Mar 21, 2015 subfiles sample program in rpgle,cobol subfile program with read, write, update and delete fuctions. A programming guide to learn as400 toggle navigation as400 tutorial. D d s1rcdnbr is defined using the dds keyword sflrcdnbr seen on d the subfiles control record. Write complete subfile code in less than 20 seconds. Create subfile file maintenance programs in just a few minutes. A subfile can be specified in the dds for a display file to allow a program to handle multiple records of the same type on a screen. The program sends output operations to the subfile record format to build the subfile. Subfile record positioning my problem is that the cursor is on record 5.
Example subfile program using modern rpg someone asked me if i could recommend an example simple subfile program written in rpgfree. In loadall and expandable subfile, the subfile size sflsiz must be at least 1 the subfile page sflpag. The main logic of the program is to display the screen for the user to enter the salespersons number. In this case sflsiz should be atleast 1 greater than the sflpag. How to create a subfile program without using any native i. Sflscrolls field d1trrn contains the subfile rrn on the first line of the page on the display when control returns to your program. Position to with load all subfile i knew there had to be an easier way with rrn than rewriting the file to a dta. This article focuses on the typical logic flow of a subfile program. Buy the digital pdf edition at the mc press ebookstore. It uses a hidden field associated with this keyword to set the subfile record number.
Due to the growing nature of this subfile, we also call is growing or elastic subfile. Htitle edit customer file edit file as400 subfile programming it is always a. Nick litten dot com is a mixture of blog posts that can be sometimes serious, frequently playful and probably downright pointless all in the space of a day. Single page subfiles nick litten is ibmi, as400 iseries rpg. I prefer letting the user select a record with an option field, like 2work with record. So, for example, if you had 10 records on a page and you set csrrrn to 15, the subfile. Initially, we have a loadall subfile code and then we convert that to the expandable subfile code. If we are writing more records in the subfile buffer than the sflsiz declared and sflsiz. How to position cursor on particular row of subfile in. There are three fields that you use to successfully maintain position within a subfile.
Sflrcdnbr subfile record number keyword for display files you use this fieldlevel keyword on the subfile control record format to specify that the page of the subfile to be displayed is the page that contains the record whose relative record number is in this field. Focusing on subfile generation, but also ibm style menus. Subfile 9999 records youre up against a hard limit with 9,999 records in the subfile and will have to come up with a workaround. Single page subfiles nick litten is ibmi, as400 iseries. To avoid this situation, we use file information data structure to get the current page rrn number and pass it to the sflrcdnbr. Subfile cursor position and stay on the same page as400tips. Of course, you could group two subfields together if they happen to be adjacent in the subfile. In loadall subfile all the records are written to the subfile buffer at once and then the data in the subfile loaded from the buffer. Sflrcdnbr keyword example in as400, set any record of a subfile as the first. S 400 will automatically display the message like end of file reached.
By using the areutools subfile generator, subfile program. How to retain the cursor position and stay on the same page of a subfile. Example sort subfile your partner in iseries education. Sflrcdnbr subfile record number brief on the above keyword. So, for example, if you had 10 records on a page and you set csrrrn to 15, the subfile would start on the 2nd page where 15 is located. When your program receives control, it can add more records to the end of the subfile and use the sflrcdnbr. The following program is an example of a cobol program which uses subfiles and which the user can enter search criteria and get a specific display from that criteria.
The subfile record number sflrcdnbr keyword is used on the subfile control record to determine what page of the subfile will appear when the subfile is displayed. This tells the program to display the page of the subfile with the given rrn on it. This is the full source code for the subfile sort program that appeared in the may 2004 issue of the iseries extra newsletter. Minimum record format required for writing loadall subfile. Ibm i software developer, digital dad, as400 anarchist, rpg modernizer, alpha nerd and passionate eater of cheese and biscuits. It is used to govern which page is d seen after loads. Sflscroll subfile scroll keyword for display files this keyword has no parameters. Position to with load all subfile code400 the support. View notes 45633633as400subfileprogrammingpartiibasiccoding from computers 101 at iit kanpur.
He has been teaching and lecturing since the mid80s. Sflrcdnbr subfile record number ibm knowledge center. Contents of this page may not be reproduced or published in any other manner what so ever without written permission from idioma software inc. This contains the number of a record whose page you want presentedi. Basic coding figure 5 rpg program code indicator usage.