BeginnerIntermediate This course is designed to teach developers how to write RPG400 online program using available tools and utilities on iSeries and.Ok, so, youve passed ANZOBJCVN, upgraded to V6R1, and now run STROBJCVN so your users do not pay the first touch penalty.I think we discussed this on a thread but.AS400 tutorials,programming,learning,guide.Free AS400 tutorial.A programming guide to learn as400 with well managed as400 content.Update Subfile As400' title='Update Subfile As400' />Go.As.Free AS4.A programming guide to learn as.I/41rwQ4hbRSL.jpg' alt='Update Subfile As400' title='Update Subfile As400' />Read operation code extenders RPGPGM.COMOperation code extenders on a Read operation in RPG are those letters that are follow the operation code in parentheses.I am sure the two most commonly known ones are.TESTFILE.Key.Field TESTFILE. Microsoft Digital Image Suite 10 Free Download . Each one provides a little bit extra functionality that compliments the Read operation.On performing research for this post I found that with free format Read operations a number of additional extenders were added, some are available with only some of the Read operations in V5.R4 and later releases.The operation codes extenders available for read operations are E Error handling.N Record is read but not locked.H Half adjust is performed on the numeric value.M Default precision rules for numeric values.R Result decimal position precision rules.This table shows each of the read operations and the extenders that can be used with it.And I am including Chain, CHAIN, as a read operation as it is just the same as a Set lower limit, SETLL, and a Read equal, READE, combined into one operation.Operation code E N H M R Fixed format RPGREAD Read.YYREADE Read equal.YYREADP Read prior.YYREADPE Read prior equal.YYREADC Read changed record.YCHAIN Chain.YYFree format RPGREAD Read.YYREADE Read equal.YYYYYREADP Read prior.YYREADPE Read prior equal.YYYYYREADC Read changed record.YCHAIN Chain.YYYYYError E operation code extender.This must be the most widely used operation extender as it is available not just to the Read operations, but to many others operations codes too.By using the E when an error occurs with the read the Error flag, ERROR, is set on.I can then use the subfields in the Program Data Structure to determine what the error was.For example.Pgm.Ds. 0. 2 extnameRPG4.DS psds qualified.TESTFILE usageupdate keyed.Key.FLD1 inz1.Key. 1 TESTFILER.Found FLD2.Pgm. Ds.Rtv. Excptdt 1 5.Those of you who are familiar with my code know that I like to use an external file for my Program data structure.If you want to learn more about how I do this see the post Externally described Data Structures.In this example I have included this external data structure in lines 1 3.As I am only interested in the Retrieved Exception Data I could have code it as an internal data structure like this.Pgm.Ds psds qualified.Rtv.Excpt. Dt char8.On line 4 I have defined by file, TESTFILE, for update and with a key.I have defined a variable on line 5 to be the same as the key field in TESTFILE, and initialized it with the value 1.The record with the key 1.So when I perform the chain, on line 6, as the record is locked the chain will fail and the ERROR flag will come on.As the FOUND flag is off, line 7, the next test is for ERROR on line 9.As this is an error I display what is basically the error text for the lock by using the Retrieved Exception Data field, Rtv.Excpt.Dt. Alas the DSPLY operation will only display 5.I use the substring built in function, SUBST to display the first 5.DSPLY Record 1 in use by job 8.SUSIEQQPADEV0.While this way works well I prefer to use the Monitor operation code in my code.You can learn about it in Monitor for errors in RPG.Record is read but not locked N operation code extender.This is the extender I use the most with Read operations.If the input file is coded for update any record that is read is locked until it is released, either by another read of the same file or by using the Unlock operation code, UNLOCK.If the file is read in a Do loop or a For group the last record read is locked.If I use the operation code extender N the record I read is not locked.Why would I do this I could have a file maintenance program.I need to write records from the file to a subfile, and when one of the subfile records is selected update that record in the file.OK, this example is a bit unreal as I am not going to add records to the file, but I am sure you will get the idea.TESTFILE usagepdate keyed.RRN1 1 to 1.TESTFILER.Key. 1 TESTFILER.Update.Record. TESTFILER.TESTFILE.It will to come to no surprise to regular readers that I am using TESTFILE again, line 1.It is coded for update and is keyed.I am performing 1.For operation, FOR, as if I am loading a subfile.The read on line 3 has the N operation code extender so records are not locked when they are read.This is important as if I had not used the N the last record read would still be locked when I exit this For group.When I select a record in the subfile I have to chain the file to get the record selected, line 8.This time I want the record locked as I am going to update it.After making the changes I desire I would press Enter and the indicator variable Update.Record would be set on, or I would have pressed F1.Update.Record would be off.If Update.Record is on, line 9, then the update is performed on line 1.If Update.Record is off I need to release the locked record, which I do using the UNLOCK, line 1.The other operation code extenders.Using the other three operation extenders, H, M and R, sounds a little bit weird and freaky to me.I do struggle to come up with a scenario where I would consider using them, rather than move the value I want to use as a key into a variable which I would then use as the key field.The key field in the file TESTFILE, FLD1, is a packed field, see below.A R TESTFILER.A FLD1 5.P 2. A FLD2 5.A.A K FLD1. If I Chain to TESTFILE using 1.As the Chain is successful, FOUND is on, then I will display the value in FLD2.TESTFILER.Found FLD2. Rather than use a value as the key I could use a variable that has more decimal places than the key field instead.Key.Key. 1 TESTFILER.Found FLD2.As I said I am not sure if I will ever use this, but it is out there for you to use if you so choose.You can learn more about this on the IBM website This article was written for IBM i 7.Auto Tune Evo Vst Download Crack Idm .Clarification. I have received several messages about how the H, M, and R operation codes go back to before V5.R4.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |