Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Softcoded field names

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

  • Softcoded field names

    Hi S K. RPG does not allow for the use of soft coded field names. In the past, I wrote a program that used the DSPFFD output from a file and allowed me to map it to another file. The fields did not have to be in the same order, but they did have to be the same length. Anyway, the program used two MODS to hold the from, to, type, etc stats of the two files, and I would type in the MAP to field from the second file. The program used MOVE, MOVEL, EVAL etch to do the match up, based on my input of justification. I no longer have that code, but it should be fairly easy to replicate from scratch if you have time. -Mean 1

  • #2
    Softcoded field names

    Assuming CPYF is insufficient for your purposes, what about using dynamic SQL? Construct the appropriate SELECT, and read from that to the target file. Or possibly contruct INSERT statements.

    Comment


    • #3
      Softcoded field names

      Is it just me or is everyone having trouble reading Hans' responses that use the HTML tag? The code displays as a very light blurry gray. Here is an example: Eval a = b + c Chris

      Comment


      • #4
        Softcoded field names

        Hi Chris, Thanks for pointing that out. I made it a little easier to read. Brian

        Comment


        • #5
          Softcoded field names

          Think I'll have to look into the dynamic SQL option. Think it will give me the most chance of achieving what I'm after. Thanks for the suggestions

          Comment


          • #6
            Softcoded field names

            S K, The thing you will find with SQL is that dynamic input is very easy to define with a prepared statement. The output side, which is what I believe you are after, is more difficult. The only way I know of to vary the output target with SQL is to use an SQLDA. The open source DYNSQL module that is part of the iSeries-toolkit simplifies that type of processing. You might check out the Dynamic SQL examples. The last example shows how to build a physical file from an SQL statement. I am working on a command wrapper for that procedure right now. David Morris

            Comment


            • #7
              Softcoded field names

              I am trying to develop an application to map data from one data file into a target file. I don't want to hardcode the target field names into the RPG, instead holding them in a definition file. I can't find a way of doing this. Any ideas? Any suggestions would be appreciated

              Comment


              • #8
                Softcoded field names

                Input and output will be my eventual aims. I will investigate the Dynamic SQL examples as suggested.

                Comment

                Working...
                X