Mixed record format Subfiles

45 pts.
Tags:
RPG
RPG/400
RPGLE
Subfile
I've been writing standard subfiles for a while now but I've seen some where, to me, it looks like the subfile has a mixed record format - i.e. a header and then a variable number of detail lines. (The fields are of different length and position in the header and detail lines). I'm writing an application where that functionality would be very useful, so how do I go about doing that?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

You could get a similar result by having a subfile record with one long field and filling the field yourself in different formats depending on which type of record you have. You could use 2 different data structures to define the 2 different record types and then move the relevant data structure to your subfile field depending on which record you need.

Not a marvellous solution, but it should get you the result.

Regards,

Martin Gilbert.

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Dave59
    Hi Gilly, I had thought of that as a last option. I just wondered if there was a kosher way of doing it or a work-around like having hidden fields that you turn on or off with indicators depending on the content. the example I've seen definitely has different fields on show - i.e. _ OO OOOOOOOOOOOOOOOOO _ OO OOOOOOOOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO _ OO OOOOOOOOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO and so on Regards Dave
    45 pointsBadges:
    report
  • Dave59
    Juts to add... The above example hasn't appeared as I wrote it as the spaces have been taken out. It should be something like _ OO OOOOOOOOOOOOOOOOO OOOOOOOOOOOOO _ O OOOOOOOOOOO OOOOOO 666666 _ O OOOOOOOOOOO OOOOOO 666666 _ OO OOOOOOOOOOOOOOOOO OOOOOOOOOOOOO _ O OOOOOOOOOOO OOOOOO 666666 Dave
    45 pointsBadges:
    report
  • Gilly400
    Hi Dave, It is possible to do it with indicators. I believe that you can't condition the field with an indicator, but you can condition the attributes, so you could specify non-display and protect for one set of fields when your indicator is OFF and the same conditioning for another set of fields when your indicator is ON. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Dave59
    Hi Martin, I've finally found something else related to this topic. It seems you can't use the non-display attribute but you can use field conditioning if the subfile page size is the same as the subfile size. Mehtinks, I'll go with the simple solution! Thanks for your help. Dave
    45 pointsBadges:
    report
  • Gilly400
    Hi Dave, Sorry, I can never remember which way around it is with the indicators - either you can't use conditioned attributes or you can't use conditioned fields. I wasn't aware that the subfile format (size to page relationship) had any impact on this, I thought it was just a rule for subfile record formats. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Mamic21f
    Hi Dave, as far as I know, there is no smart way for different sfl-record formats. Overlaying fields or attributes don't work very well. But we made an application with several SFLs in it, and the user could change from one to another with a function key. There is no mistery about it. The application filled all the record-formats at the same time, and you only have to select the right one with a programm condition. You have the same effect, and the code is readable. Have a nice day Martin
    10 pointsBadges:
    report
  • Yorkshireman
    Coming late to this discussion. . It is a primary attribute of a SFL that it only has one format - We stood back in amazement when the S/38 appeared . .. However the appearance of different stuff is simple to arange. Most flexible is to define a single character field and load it with different data. You can use a DS in RPG, in 2e I use a standard formatting function which takes care of editing, alignment, spaces etc. In ILE I'd make a service function which did the same thing, to be reusable across all situations, and avoid hard coding DS into a program. For simple on/off of a field, which your example shows, just consult the manual and set the appropriate display attributes - that's what 2e does, and I never give it a thought - Non display if condition 'x' is met. Setting up left/right scroll and behaviour dependant on screen size is good fun too... . .
    5,580 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following