PDA

View Full Version : Same Sub-field in more than 1 Data Structure in RPG/RPGLE



Guest.Visitor
06-26-2002, 06:55 AM
Hi Sunil. As you stated, RPG does not allow this, therefore it can't be done. Not directly that is...... You can define another data structure/array of equal length and fields and perform a move from one to another, by data structure name. If you are trying to use the data structures to overlay a display file, I used to do this quite often on the /36 & /38. You define three data structures. One that meets the format of your screen layout. One that meets the format of your first data set and one that meets the format of the second data set. Then based on an IF (or ugh!, indicator) you can move the proper data structure into the screen (or report) data structure. This allows you to have seperate names for your data structure but can be just a bit wordy in the code. -Mean 1

Guest.Visitor
06-26-2002, 07:16 AM
Sunil, I believe that qualified data structure fields is a feature coming in V5R2. Bill > I want to define same field in more than 1 Data Structure in RPGLE/RPG. But, RPG/RPGLE does not allow me to define same field in more than 1 data structure. Please let me know how can I do it. > > Regards, > Sunil Bhatia

Guest.Visitor
06-26-2002, 09:16 AM
Qualified data structures is a feature that arrived in V5R1. What's coming in V5R2 is an improvement on the concept. Whereas V5R1 RPG IV allows only one level of qualification (ie, "<code>ds.subf</code>"), V5R2 allows multiple levels of qualification. For example, in V5R2, you can code something like "<code>ds.subf.subf</code>", or even something like "<code>ds(index+17).subf.subf2(j).sub3.sub4(k)</code>", if you really wanted to.

tdaly@sddsystems.com
06-26-2002, 01:34 PM
Qualified DS fields is pretty nice... kicking it up to multi levels... well - the mind reels! I think it'd be pretty cool for RPG to have a "MOVE CORRESPONDING" type operation. Way back in school is the last COBOL I coded but I still remember and like the idea. It would make Mean-1's technique really snap... just read your file into a DS, MOVE CORRESPONDING, and POW your screen DS is ready to go. Both DataStructures are extnerally defined... this would be too easy! Tom

Guest.Visitor
06-27-2002, 04:55 AM
I want to define same field in more than 1 Data Structure in RPGLE/RPG. But, RPG/RPGLE does not allow me to define same field in more than 1 data structure. Please let me know how can I do it. Regards, Sunil Bhatia

Guest.Visitor
06-27-2002, 04:55 AM
Qualified DS fields is pretty nice... kicking it up to multi levels... well - the mind reels! Well, that just gives RPG IV a feature that some languages have had for, oh, 35 years or so.