ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

subfile problem.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • subfile problem.

    is it possible to display two or more different formats in a single subfile??

    just like this:
    ------------------------------------------------------------------------
    AAAAAAAAAA 99999 BBBBB
    CCCCCCCCCCCCCCCCCCCCCC
    AAAAAAAAAA 99999 BBBBB
    AAAAAAAAAA 99999 BBBBB
    CCCCCCCCCCCCCCCCCCCCCC


    thanks in advance.

  • #2
    Re: subfile problem.

    yes define only one subfile field -- lets say 75 *char

    then define datastructures for the (two) formats)

    populate them with your favorite opcodes... Then write them to the subfile.

    KAPOW! like magic two (or more) formats on one subfile)

    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: subfile problem.

      yes define only one subfile record with all your fields -- and use a Field conditioning indicator

      then define all your fields for the (two) formats with the Field conditioning indicator on / off

      populate them with your data. Set the Field conditioning indicator and write them to the subfile.

      KAPOW! like magic two (or more) formats on one subfile !

      marc
      Last edited by Marc_d; March 12, 2009, 06:34 AM.

      Comment


      • #4
        Re: subfile problem.

        My magic is stronger than your magic
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: subfile problem.

          guys,,,thanks for your replies..

          but if i want the fields for both input and output for the later updating operation..how can i do?

          Comment


          • #6
            Re: subfile problem.

            To answer some ???

            Q. I would like to change the attributes of various fields on my screen through the RPG program.
            All this time I was defining my fields in the display file with different indicators related to different attributes, and then I change the indicators on/off in my RPG program.
            This method seems too cumbersome, especially when there are lots of fields on the screen.
            Is there another way to do this?

            A. You could append an attribute byte to the beginning of any output field that you want to use special attributes on.
            You would also need to append an attribute byte at the end of the field to set the attributes back to normal.
            These derived output fields would have to be two bytes larger than the data (one byte for the beginning attribute and one byte for the ending attribute). If you use this method, you may want to create an array where each element represents a line on the screen and load the array element with each field and its attributes.

            ----------

            Q.Hello, I have a subfile with 1 long data field in it (char(77)).
            The subfile line is re-defined in a data structure with different "sub-fields".

            How kan I force one of these sub- fields to be showed with a display attribute or a color attribute ?
            The rest of the subfile line have to be in a "normal" green-color.
            Thanks !

            A. by B.Hauser : Use Hex-Values for Color
            try this:
            Code:
            D DSSflFld 	DS
            D Field1 		10A
            D ColorRed 		 1A inz(x'28')
            D Field2 		 5A
            D ColorGreen             1A inz(x'20')
            
            or
            
            /Free
            ColorRed = x'28';
            ColorGreen = x'20';
            /End-Free
            Birgitta ! Thank you !

            Q.It it possible that this doesn't works if I use the OVERLAY-keyword in my data structure ? Thanks ...

            A. by Lynne Noll

            Birgitta showed you a method that would work if the attributes were always the same.
            But you can put the attribute in place any way you like.
            Code:
            Eval FieldAttr1=x'28'
            or
            Eval %subst(FieldAttr1:10:1)=x'28'
            or
            Eval FieldAttr1=ColorRed where Colorred is initialized to x'28'.
            -----------------------------------------
            Article: SAY GOODBYE TO INDICATORS ! ( with a subfile example )

            P-fields are one-byte codes that control the color and attributes of a field in a display file.

            Before P-fields were added to data description specifications (DDS),
            it was necessary for a programmer to make decisions about color and attributes during development.
            Whichever attributes were selected had to be included in the DDS.

            To apply different attributes to a field in different circumstances required the use of conditioning indicators.

            In the following example, we show you how to read more...

            Comment


            • #7
              Re: subfile problem.

              Originally posted by Marc_d View Post
              yes define only one subfile record with all your fields -- and use a Field conditioning indicator

              then define all your fields for the (two) formats with the Field conditioning indicator on / off

              populate them with your data. Set the Field conditioning indicator and write them to the subfile.

              KAPOW! like magic two (or more) formats on one subfile !

              marc
              Field conditioning indicator can not be set to any field of a subfile...

              Comment


              • #8
                Re: subfile problem.

                Field conditioning indicator can not be set to any field of a subfile...
                Oh, I see, well, you can in fact, it depends on the subfile type: http://www.code400.com/forum/showpos...58&postcount=6

                Comment


                • #9
                  Re: subfile problem.

                  Originally posted by Marc_d View Post
                  Oh, I see, well, you can in fact, it depends on the subfile type: http://www.code400.com/forum/showpos...58&postcount=6
                  when i define the subfile:
                  -------------------------------------------------------
                  A R SFL1 SFL
                  A 77 FLD001 10 B 7 1
                  A N77 FLD002 30 O 7 26

                  and then compile the DDS source,the compiler tells me:
                  * CPD5238 30 1 Message . . . . : No valid record found in source.
                  * CPD7814 30 1 Message . . . . : Option indicators not allowed on fields in subfile record.

                  Comment

                  Working...
                  X