ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Prefix keyword with one record format of a multi format LF

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

  • Prefix keyword with one record format of a multi format LF

    Hi,

    I have a logical file which has multiple recrod formats. I have declared that logical file in my RGPLE progarm. Now I want to Prefix the fields of one record format with A_. How can I achieve this? Please suggest

    Thanks in Advance !!!
    Mansi

  • #2
    Re: Prefix keyword with one record format of a multi format LF

    you can prefix the datastructures.. havent tried either just found on the web..let us know.

    Code:
    In V5R2 you can declare the external data structures like so:
    
    
            D   r945m01     e ds                  extname(FPW945MA:IPW945M01)
            D   r945m02     e ds                  extname(FPW945MA:IPW945M02)
            D   r945m03     e ds                  extname(FPW945MA:IPW945M03)
            D   r945m04     e ds                  extname(FPW945MA:IPW945M04)
            D   r945m05     e ds                  extname(FPW945MA:IPW945M05)
    
    
       Where the MA file is the multiformat logical, and each IPW are the
       multiple formats themselves.
    V5r3 >
    Code:
           Ffpw945ma  IF   E           K DISK    USROPN INFDS(INF945)
    
    
            //File information data structure
           DINF945           ds                  Qualified
           D   recname             261    270
    
    
            //File access DS
           Drec945ma       e ds                  extname(fpw945ma)
    
    
           D r945            ds                  Qualified
           D   r945m01                           likerec(IPW945M01) overlay(r945)
           D   r945m02                           likerec(IPW945M02) overlay(r945)
           D   r945m03                           likerec(IPW945M03) overlay(r945)
           D   r945m04                           likerec(IPW945M04) overlay(r945)
           D   r945m05                           likerec(IPW945M05) overlay(r945)
    
    
             /FREE
               dou %eof(fpw945ma);
                  read fpw945ma;
                  r945 = rec945ma;
                  if not %eof(fpw945ma);
    
    
                  select;
                     when INF945.recname = 'IPW945M01';
                        line = 'FPW945M01:' + r945.r945m01;
                        RC = writeline(fd:line); 
                     when INF945.recname = 'IPW945M02';
                        line = 'FPW945M02:' + r945.r945m02;
                        RC = writeline(fd:line);
                     when INF945.recname = 'IPW945M03';
                        line = 'FPW945M03:' + r945.r945m03;
                        RC = writeline(fd:line);
                     when INF945.recname = 'IPW945M04';
                        line = 'FPW945M04:' + r945.r945m04;
                        RC = writeline(fd:line);
                     when INF945.recname = 'IPW945M05';
                        line = 'FPW945M05:' + r945.r945m05;
                        RC = writeline(fd:line);
                  endsl;
    
    
                  endif;
               enddo;
              ...
             /END-FREE
    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: Prefix keyword with one record format of a multi format LF

      EGADS!!! why use a multi-format LF in today's world??? (well other than EDI where it might be useful)
      I'm not anti-social, I just don't like people -Tommy Holden

      Comment


      • #4
        Re: Prefix keyword with one record format of a multi format LF

        Originally posted by tomholden View Post
        EGADS!!! why use a multi-format LF in today's world??? (well other than EDI where it might be useful)
        Legacy Systems...

        or at least I hope that's the case

        Comment


        • #5
          Re: Prefix keyword with one record format of a multi format LF

          Sometimes, because of the choir of angels singing above of cubes, rejoicing with us in our
          perfect environments, we forget that others may be working in pure HELL!

          Everyone enjoy the weekend while I finish up this RPGII program!

          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


          • #6
            Re: Prefix keyword with one record format of a multi format LF

            Originally posted by jamief View Post
            Sometimes, because of the choir of angels singing above of cubes, rejoicing with us in out perfect environments, we forget that others may be working in pure HELL!

            Everyone enjoy the weekend while I finish up this RPGII program!

            Jamie
            usually when i run across this (and i do) i either find an existing LF with the keys i'm looking for or i create an SQL with the keys i need. the end goal is once i get rid of all of the programs referencing those evil things i'm gonna go nuke happy and purge them from my system.
            I'm not anti-social, I just don't like people -Tommy Holden

            Comment


            • #7
              Re: Prefix keyword with one record format of a multi format LF

              Originally posted by tomholden View Post
              usually when i run across this (and i do) i either find an existing LF with the keys i'm looking for or i create an SQL with the keys i need. the end goal is once i get rid of all of the programs referencing those evil things i'm gonna go nuke happy and purge them from my system.
              Oh, how I dream of the day here...

              Comment


              • #8
                Re: Prefix keyword with one record format of a multi format LF

                Originally posted by tomholden View Post
                EGADS!!! why use a multi-format LF in today's world??? (well other than EDI where it might be useful)
                The one I didn't care for was Joined Logicals. It was one where the warehouse inventory was joined with the store inventory based on item#. IIRC, there were records with the item# but a store# of zero because there were not stores with any of that item#. This is going back 12-13 years so I might not recall the situation with 100% accuracy.
                http://www.linkedin.com/in/chippermiller

                Comment


                • #9
                  Re: Prefix keyword with one record format of a multi format LF

                  Originally posted by jamief View Post
                  Sometimes, because of the choir of angels singing above of cubes, rejoicing with us in out perfect environments, we forget that others may be working in pure HELL!

                  Everyone enjoy the weekend while I finish up this RPGII program!

                  Jamie
                  Ah yes... nothing like good old 36 code:
                  Code:
                       C   31N46N23                                          
                       CANN17 55 62                                          
                       CAN 99 U3 97                                          
                       COR 31N46N23                                          
                       CAN 17N55N62                                          
                       CAN H9 98 MR                                          
                       COR 29 22N61                                          
                       CAN 80NH5N43                                          
                       CAN 46 98 97AGYSTX    COMP UN3RNS               290538
                       C   31N11N13                                          
                       CANN17 55 62                                          
                       COR 31N01N23                                          
                       COR 80 30N61                                          
                       CAN 80N33N40                                          
                       CAN 46 98 97BGYSTX    COMP RC3EDZ               514789
                       C   31N46N23                                          
                       CANN17 55 62                                          
                       CAN H1 22 97                                          
                       COR 31N76 L2
                       CAN 17N55N62                                                     
                       CAN 99 98 97                                                     
                       COR 29 MRN61                                                     
                       CAN 80N33N43          EXSR EDTSCR                     EXECUTE SUBR TO EDIT SCREEN
                  I took the liberty of adding comments where the code wasnt very intuitive.
                  http://www.linkedin.com/in/chippermiller

                  Comment


                  • #10
                    Re: Prefix keyword with one record format of a multi format LF

                    Originally posted by Chipper View Post
                    The one I didn't care for was Joined Logicals. It was one where the warehouse inventory was joined with the store inventory based on item#. IIRC, there were records with the item# but a store# of zero because there were not stores with any of that item#. This is going back 12-13 years so I might not recall the situation with 100% accuracy.
                    we have those here as well...it's yet another on my target!!!
                    I'm not anti-social, I just don't like people -Tommy Holden

                    Comment

                    Working...
                    X